Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d17475d9 authored by Michael Neuling's avatar Michael Neuling Committed by Michael Ellerman
Browse files

powerpc/selftest: Add gettimeofday() benchmark



This adds a benchmark directory to the powerpc selftests and adds a
gettimeofday() benchmark to it.

Suggested-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 26cd835e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ CFLAGS := -Wall -O2 -flto -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CUR

export CFLAGS

SUB_DIRS = pmu copyloops mm tm primitives stringloops vphn switch_endian dscr
SUB_DIRS = pmu copyloops mm tm primitives stringloops vphn switch_endian dscr benchmarks

endif

+1 −0
Original line number Diff line number Diff line
gettimeofday
+12 −0
Original line number Diff line number Diff line
TEST_PROGS := gettimeofday

CFLAGS += -O2

all: $(TEST_PROGS)

$(TEST_PROGS): ../harness.c

include ../../lib.mk

clean:
	rm -f $(TEST_PROGS) *.o
+31 −0
Original line number Diff line number Diff line
/*
 * Copyright 2015, Anton Blanchard, IBM Corp.
 * Licensed under GPLv2.
 */

#include <sys/time.h>
#include <stdio.h>

#include "utils.h"

static int test_gettimeofday(void)
{
	int i;

	struct timeval tv_start, tv_end;

	gettimeofday(&tv_start, NULL);

	for(i = 0; i < 100000000; i++) {
		gettimeofday(&tv_end, NULL);
	}

	printf("time = %.6f\n", tv_end.tv_sec - tv_start.tv_sec + (tv_end.tv_usec - tv_start.tv_usec) * 1e-6);

	return 0;
}

int main(void)
{
	return test_harness(test_gettimeofday, "gettimeofday");
}