Convert bench to C.

This commit is contained in:
Jonas 'Sortie' Termansen 2016-02-28 16:42:57 +01:00
parent 114aa29878
commit 08ec6cafc8
3 changed files with 9 additions and 9 deletions

View File

@ -5,9 +5,9 @@ include ../build-aux/version.mak
include ../build-aux/dirs.mak
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CFLAGS?=$(OPTLEVEL)
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
CFLAGS:=$(CFLAGS) -Wall -Wextra
BINARIES:=\
benchsyscall \
@ -21,8 +21,8 @@ install: all
mkdir -p $(DESTDIR)$(BINDIR)
install $(BINARIES) $(DESTDIR)$(BINDIR)
%: %.cpp
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@
%: %.c
$(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) $< -o $@
clean:
rm -f $(BINARIES) *.o

View File

@ -15,12 +15,13 @@
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
benchctxswitch.cpp
benchctxswitch.c
Benchmarks the speed of context switches.
*******************************************************************************/
#include <err.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -37,7 +38,7 @@ static int uptime(uintmax_t* usecs)
return 0;
}
int main(int /*argc*/, char* /*argv*/[])
int main(void)
{
pid_t slavepid = fork();
if ( slavepid < 0 )

View File

@ -15,8 +15,7 @@
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
benchsyscall.cpp
benchsyscall.c
Benchmarks the speed of system calls.
*******************************************************************************/
@ -35,7 +34,7 @@ static int uptime(uintmax_t* usecs)
return 0;
}
int main(int /*argc*/, char* /*argv*/[])
int main(void)
{
uintmax_t start;
if ( uptime(&start) )