svn commit: r332624 - stable/11/tools/tools/syscall_timing

Edward Tomasz Napierala trasz at FreeBSD.org
Mon Apr 16 17:26:33 UTC 2018


Author: trasz
Date: Mon Apr 16 17:26:32 2018
New Revision: 332624
URL: https://svnweb.freebsd.org/changeset/base/332624

Log:
  MFC r325314:
  
  Add getpriority(2) benchmark; it's a lightweight syscall which does pretty
  much nothing - just like getuid(2) - but takes arguments.

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

Modified: stable/11/tools/tools/syscall_timing/syscall_timing.c
==============================================================================
--- stable/11/tools/tools/syscall_timing/syscall_timing.c	Mon Apr 16 17:25:52 2018	(r332623)
+++ stable/11/tools/tools/syscall_timing/syscall_timing.c	Mon Apr 16 17:26:32 2018	(r332624)
@@ -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>
@@ -162,6 +163,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;
@@ -648,6 +665,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-all mailing list