svn commit: r325314 - head/tools/tools/syscall_timing

Edward Tomasz Napierala trasz at FreeBSD.org
Thu Nov 2 12:12:19 UTC 2017


Author: trasz
Date: Thu Nov  2 12:12:18 2017
New Revision: 325314
URL: https://svnweb.freebsd.org/changeset/base/325314

Log:
  Add getpriority(2) benchmark; it's a lightweight syscall which does pretty
  much nothing - just like getuid(2) - but takes arguments.
  
  Obtained from:	CheriBSD
  MFC after:	2 weeks
  Sponsored by:	DARPA, AFRL

Modified:
  head/tools/tools/syscall_timing/syscall_timing.c

Modified: head/tools/tools/syscall_timing/syscall_timing.c
==============================================================================
--- head/tools/tools/syscall_timing/syscall_timing.c	Thu Nov  2 12:11:20 2017	(r325313)
+++ head/tools/tools/syscall_timing/syscall_timing.c	Thu Nov  2 12:12:18 2017	(r325314)
@@ -31,6 +31,7 @@
 
 #include <sys/types.h>
 #include <sys/mman.h>
+#include <sys/resource.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -163,6 +164,22 @@ test_gettimeofday(uintmax_t num, uintmax_t int_arg, co
 }
 
 uintmax_t
+test_getpriority(uintmax_t num, uintmax_t int_arg, const char *path)
+{
+	uintmax_t i;
+
+	benchmark_start();
+	for (i = 0; i < num; i++) {
+		if (alarm_fired)
+			break;
+		(void)getpriority(PRIO_PROCESS, 0);
+	}
+	benchmark_stop();
+	return (i);
+}
+
+
+uintmax_t
 test_pipe(uintmax_t num, uintmax_t int_arg, const char *path)
 {
 	int fd[2], i;
@@ -634,6 +651,7 @@ static const struct test tests[] = {
 	{ "getppid", test_getppid },
 	{ "clock_gettime", test_clock_gettime },
 	{ "gettimeofday", test_gettimeofday },
+	{ "getpriority", test_getpriority },
 	{ "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-head mailing list