svn commit: r236797 - stable/9/tools/tools/syscall_timing

Konstantin Belousov kib at FreeBSD.org
Sat Jun 9 08:23:55 UTC 2012


Author: kib
Date: Sat Jun  9 08:23:55 2012
New Revision: 236797
URL: http://svn.freebsd.org/changeset/base/236797

Log:
  MFC r236686:
  Add gettimeofday() test.

Modified:
  stable/9/tools/tools/syscall_timing/syscall_timing.c
Directory Properties:
  stable/9/tools/tools/syscall_timing/   (props changed)

Modified: stable/9/tools/tools/syscall_timing/syscall_timing.c
==============================================================================
--- stable/9/tools/tools/syscall_timing/syscall_timing.c	Sat Jun  9 08:13:57 2012	(r236796)
+++ stable/9/tools/tools/syscall_timing/syscall_timing.c	Sat Jun  9 08:23:55 2012	(r236797)
@@ -142,6 +142,22 @@ test_clock_gettime(uintmax_t num, uintma
 }
 
 uintmax_t
+test_gettimeofday(uintmax_t num, uintmax_t int_arg, const char *path)
+{
+	struct timeval tv;
+	uintmax_t i;
+
+	benchmark_start();
+	for (i = 0; i < num; i++) {
+		if (alarm_fired)
+			break;
+		(void)gettimeofday(&tv, NULL);
+	}
+	benchmark_stop();
+	return (i);
+}
+
+uintmax_t
 test_pipe(uintmax_t num, uintmax_t int_arg, const char *path)
 {
 	int fd[2], i;
@@ -608,6 +624,7 @@ static const struct test tests[] = {
 	{ "getuid", test_getuid },
 	{ "getppid", test_getppid },
 	{ "clock_gettime", test_clock_gettime },
+	{ "gettimeofday", test_gettimeofday },
 	{ "pipe", test_pipe },
 	{ "socket_local_stream", test_socket_stream, .t_int = PF_LOCAL },
 	{ "socket_local_dgram", test_socket_dgram, .t_int = PF_LOCAL },


More information about the svn-src-stable-9 mailing list