Add getpriority(2) benchmark; it's a lightweight syscall which does pretty

much nothing - just like getuid(2) - but takes arguments.

Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
This commit is contained in:
trasz 2017-11-02 12:12:18 +00:00
parent e058fbb452
commit 86f70c08a7

View File

@ -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)
return (i);
}
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)
{
@ -634,6 +651,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 },