From owner-svn-src-head@freebsd.org Thu Nov 2 12:16:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4371FE583D0; Thu, 2 Nov 2017 12:16:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12D287C8C6; Thu, 2 Nov 2017 12:16:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA2CGBVx026076; Thu, 2 Nov 2017 12:16:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA2CGBVo026075; Thu, 2 Nov 2017 12:16:11 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201711021216.vA2CGBVo026075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 2 Nov 2017 12:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325318 - head/tools/tools/syscall_timing X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/tools/tools/syscall_timing X-SVN-Commit-Revision: 325318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Nov 2017 12:16:12 -0000 Author: trasz Date: Thu Nov 2 12:16:11 2017 New Revision: 325318 URL: https://svnweb.freebsd.org/changeset/base/325318 Log: Add benchmark for access(2). Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/tools/tools/syscall_timing/syscall_timing.c Modified: head/tools/tools/syscall_timing/syscall_timing.c ============================================================================== --- head/tools/tools/syscall_timing/syscall_timing.c Thu Nov 2 12:15:39 2017 (r325317) +++ head/tools/tools/syscall_timing/syscall_timing.c Thu Nov 2 12:16:11 2017 (r325318) @@ -340,6 +340,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; @@ -716,6 +738,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 },