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

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


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

Log:
  Add benchmark for getresuid(2) - three pointers, although only "output" ones,
  and quite lightwait.
  
  The purpose of this commit, and the previous one, is to be able to measure
  overhead of pointer arguments - in case you're running a strange architecture
  where pointers and integers are quite different things at the hardware level.
  
  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:13:02 2017	(r325315)
+++ head/tools/tools/syscall_timing/syscall_timing.c	Thu Nov  2 12:14:42 2017	(r325316)
@@ -132,6 +132,22 @@ test_getppid(uintmax_t num, uintmax_t int_arg, const c
 }
 
 uintmax_t
+test_getresuid(uintmax_t num, uintmax_t int_arg, const char *path)
+{
+	uid_t ruid, euid, suid;
+	uintmax_t i;
+
+	benchmark_start();
+	for (i = 0; i < num; i++) {
+		if (alarm_fired)
+			break;
+		(void)getresuid(&ruid, &euid, &suid);
+	}
+	benchmark_stop();
+	return (i);
+}
+
+uintmax_t
 test_clock_gettime(uintmax_t num, uintmax_t int_arg, const char *path)
 {
 	struct timespec ts;
@@ -673,6 +689,7 @@ struct test {
 static const struct test tests[] = {
 	{ "getuid", test_getuid },
 	{ "getppid", test_getppid },
+	{ "getresuid", test_getresuid },
 	{ "clock_gettime", test_clock_gettime },
 	{ "gettimeofday", test_gettimeofday },
 	{ "getpriority", test_getpriority },


More information about the svn-src-head mailing list