From 4cb2adf3f8696bad9b5ca832dec990362ad143f3 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Wed, 4 Jul 2018 13:28:43 +0000 Subject: [PATCH] Add getprogname(3) (ie null) benchmark. Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA, AFRL --- tools/tools/syscall_timing/syscall_timing.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/tools/syscall_timing/syscall_timing.c b/tools/tools/syscall_timing/syscall_timing.c index bd602da8e89..5a910c4f39b 100644 --- a/tools/tools/syscall_timing/syscall_timing.c +++ b/tools/tools/syscall_timing/syscall_timing.c @@ -184,6 +184,23 @@ test_getpriority(uintmax_t num, uintmax_t int_arg, const char *path) 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) { @@ -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 },