Sort the benchmarks even more.

MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
This commit is contained in:
Edward Tomasz Napierala 2018-07-04 14:15:48 +00:00
parent 08dc972a43
commit 32a3b2e07a

View File

@ -603,6 +603,71 @@ test_setuid(uintmax_t num, uintmax_t int_arg __unused, const char *path __unused
return (i);
}
static uintmax_t
test_shmfd(uintmax_t num, uintmax_t int_arg __unused, const char *path __unused)
{
uintmax_t i;
int shmfd;
shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
if (shmfd < 0)
err(-1, "test_shmfd: shm_open");
close(shmfd);
benchmark_start();
BENCHMARK_FOREACH(i, num) {
shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
if (shmfd < 0)
err(-1, "test_shmfd: shm_open");
close(shmfd);
}
benchmark_stop();
return (i);
}
static uintmax_t
test_shmfd_dup(uintmax_t num, uintmax_t int_arg __unused, const char *path __unused)
{
uintmax_t i;
int fd, shmfd;
shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
if (shmfd < 0)
err(-1, "test_shmfd_dup: shm_open");
fd = dup(shmfd);
if (fd >= 0)
close(fd);
benchmark_start();
BENCHMARK_FOREACH(i, num) {
fd = dup(shmfd);
if (fd >= 0)
close(fd);
}
benchmark_stop();
close(shmfd);
return (i);
}
static uintmax_t
test_shmfd_fstat(uintmax_t num, uintmax_t int_arg __unused, const char *path __unused)
{
struct stat sb;
uintmax_t i;
int shmfd;
shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
if (shmfd < 0)
err(-1, "test_shmfd_fstat: shm_open");
if (fstat(shmfd, &sb) < 0)
err(-1, "test_shmfd_fstat: fstat");
benchmark_start();
BENCHMARK_FOREACH(i, num) {
(void)fstat(shmfd, &sb);
}
benchmark_stop();
close(shmfd);
return (i);
}
static uintmax_t
test_socket_stream(uintmax_t num, uintmax_t int_arg, const char *path __unused)
{
@ -687,71 +752,6 @@ test_socketpair_dgram(uintmax_t num, uintmax_t int_arg __unused, const char *pat
return (i);
}
static uintmax_t
test_shmfd_dup(uintmax_t num, uintmax_t int_arg __unused, const char *path __unused)
{
uintmax_t i;
int fd, shmfd;
shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
if (shmfd < 0)
err(-1, "test_shmfd_dup: shm_open");
fd = dup(shmfd);
if (fd >= 0)
close(fd);
benchmark_start();
BENCHMARK_FOREACH(i, num) {
fd = dup(shmfd);
if (fd >= 0)
close(fd);
}
benchmark_stop();
close(shmfd);
return (i);
}
static uintmax_t
test_shmfd(uintmax_t num, uintmax_t int_arg __unused, const char *path __unused)
{
uintmax_t i;
int shmfd;
shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
if (shmfd < 0)
err(-1, "test_shmfd: shm_open");
close(shmfd);
benchmark_start();
BENCHMARK_FOREACH(i, num) {
shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
if (shmfd < 0)
err(-1, "test_shmfd: shm_open");
close(shmfd);
}
benchmark_stop();
return (i);
}
static uintmax_t
test_shmfd_fstat(uintmax_t num, uintmax_t int_arg __unused, const char *path __unused)
{
struct stat sb;
uintmax_t i;
int shmfd;
shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
if (shmfd < 0)
err(-1, "test_shmfd_fstat: shm_open");
if (fstat(shmfd, &sb) < 0)
err(-1, "test_shmfd_fstat: fstat");
benchmark_start();
BENCHMARK_FOREACH(i, num) {
(void)fstat(shmfd, &sb);
}
benchmark_stop();
close(shmfd);
return (i);
}
static uintmax_t
test_vfork(uintmax_t num, uintmax_t int_arg __unused, const char *path __unused)
{
@ -874,15 +874,15 @@ static const struct test tests[] = {
{ "read_1000000", test_read, .t_flags = FLAG_PATH, .t_int = 1000000 },
{ "select", test_select, .t_flags = 0 },
{ "setuid", test_setuid, .t_flags = 0 },
{ "shmfd", test_shmfd, .t_flags = 0 },
{ "shmfd_dup", test_shmfd_dup, .t_flags = 0 },
{ "shmfd_fstat", test_shmfd_fstat, .t_flags = 0 },
{ "socket_local_stream", test_socket_stream, .t_int = PF_LOCAL },
{ "socket_local_dgram", test_socket_dgram, .t_int = PF_LOCAL },
{ "socketpair_stream", test_socketpair_stream, .t_flags = 0 },
{ "socketpair_dgram", test_socketpair_dgram, .t_flags = 0 },
{ "socket_tcp", test_socket_stream, .t_int = PF_INET },
{ "socket_udp", test_socket_dgram, .t_int = PF_INET },
{ "shmfd_dup", test_shmfd_dup, .t_flags = 0 },
{ "shmfd", test_shmfd, .t_flags = 0 },
{ "shmfd_fstat", test_shmfd_fstat, .t_flags = 0 },
{ "vfork", test_vfork, .t_flags = 0 },
{ "vfork_exec", test_vfork_exec, .t_flags = 0 },
};