Date: Mon, 16 Apr 2018 17:29:50 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332627 - stable/11/tools/tools/syscall_timing Message-ID: <201804161729.w3GHToXI032699@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Mon Apr 16 17:29:50 2018 New Revision: 332627 URL: https://svnweb.freebsd.org/changeset/base/332627 Log: MFC r325318: Add benchmark for access(2). Modified: stable/11/tools/tools/syscall_timing/syscall_timing.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/tools/syscall_timing/syscall_timing.c ============================================================================== --- stable/11/tools/tools/syscall_timing/syscall_timing.c Mon Apr 16 17:28:59 2018 (r332626) +++ stable/11/tools/tools/syscall_timing/syscall_timing.c Mon Apr 16 17:29:50 2018 (r332627) @@ -339,6 +339,28 @@ test_socketpair_dgram(uintmax_t num, uintmax_t int_arg } uintmax_t +test_access(uintmax_t num, uintmax_t int_arg, const char *path) +{ + uintmax_t i; + int fd; + + fd = access(path, O_RDONLY); + if (fd < 0) + err(-1, "test_access: %s", path); + close(fd); + + benchmark_start(); + for (i = 0; i < num; i++) { + if (alarm_fired) + break; + access(path, O_RDONLY); + close(fd); + } + benchmark_stop(); + return (i); +} + +uintmax_t test_create_unlink(uintmax_t num, uintmax_t int_arg, const char *path) { uintmax_t i; @@ -715,6 +737,7 @@ static const struct test tests[] = { { "socketpair_dgram", test_socketpair_dgram }, { "socket_tcp", test_socket_stream, .t_int = PF_INET }, { "socket_udp", test_socket_dgram, .t_int = PF_INET }, + { "access", test_access, .t_flags = FLAG_PATH }, { "create_unlink", test_create_unlink, .t_flags = FLAG_PATH }, { "bad_open", test_bad_open }, { "open_close", test_open_close, .t_flags = FLAG_PATH },
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804161729.w3GHToXI032699>