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

Edward Tomasz Napierala trasz at FreeBSD.org
Wed Jul 4 13:28:44 UTC 2018


Author: trasz
Date: Wed Jul  4 13:28:43 2018
New Revision: 335938
URL: https://svnweb.freebsd.org/changeset/base/335938

Log:
  Add getprogname(3) (ie null) benchmark.
  
  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	Wed Jul  4 13:28:16 2018	(r335937)
+++ head/tools/tools/syscall_timing/syscall_timing.c	Wed Jul  4 13:28:43 2018	(r335938)
@@ -184,7 +184,24 @@ test_getpriority(uintmax_t num, uintmax_t int_arg, con
 	return (i);
 }
 
+/*
+ * The point of this one is to figure out the cost of a call into libc,
+ * through PLT, and back.
+ */
 uintmax_t
+test_getprogname(uintmax_t num, uintmax_t int_arg, const char *path)
+{
+	uintmax_t i;
+
+	benchmark_start();
+	BENCHMARK_FOREACH(i, num) {
+		(void)getprogname();
+	}
+	benchmark_stop();
+	return (i);
+}
+
+uintmax_t
 test_pipe(uintmax_t num, uintmax_t int_arg, const char *path)
 {
 	int fd[2], i;
@@ -678,6 +695,7 @@ static const struct test tests[] = {
 	{ "clock_gettime", test_clock_gettime },
 	{ "gettimeofday", test_gettimeofday },
 	{ "getpriority", test_getpriority },
+	{ "getprogname", test_getprogname },
 	{ "pipe", test_pipe },
 	{ "select", test_select },
 	{ "socket_local_stream", test_socket_stream, .t_int = PF_LOCAL },


More information about the svn-src-all mailing list