diff options
author | trasz <trasz@FreeBSD.org> | 2018-04-16 17:26:32 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2018-04-16 17:26:32 +0000 |
commit | b5b6e9b5ab05542d6240f733e153a5d7c135189c (patch) | |
tree | a0b86896cf63fa82980112a1251c9fa5db6de2f0 /tools | |
parent | a6c304e2b95861adb582564b2ec13c2f6bc536ad (diff) | |
download | FreeBSD-src-b5b6e9b5ab05542d6240f733e153a5d7c135189c.zip FreeBSD-src-b5b6e9b5ab05542d6240f733e153a5d7c135189c.tar.gz |
MFC r325314:
Add getpriority(2) benchmark; it's a lightweight syscall which does pretty
much nothing - just like getuid(2) - but takes arguments.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/syscall_timing/syscall_timing.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/tools/syscall_timing/syscall_timing.c b/tools/tools/syscall_timing/syscall_timing.c index b9d2c0b..b8100ce 100644 --- a/tools/tools/syscall_timing/syscall_timing.c +++ b/tools/tools/syscall_timing/syscall_timing.c @@ -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, const char *path) } 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 }, |