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

View File

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

View File

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