From owner-svn-src-head@freebsd.org Thu Nov 2 12:13:03 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 59789E5817E; Thu, 2 Nov 2017 12:13:03 +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 264107C39C; Thu, 2 Nov 2017 12:13:03 +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 vA2CD2BR025833; Thu, 2 Nov 2017 12:13:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA2CD23H025832; Thu, 2 Nov 2017 12:13:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201711021213.vA2CD23H025832@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:13:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325315 - 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: 325315 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:13:03 -0000 Author: trasz Date: Thu Nov 2 12:13:02 2017 New Revision: 325315 URL: https://svnweb.freebsd.org/changeset/base/325315 Log: Add select(2) benchmark. It takes four pointers; unfortunately it's somewhat heavy. 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:12:18 2017 (r325314) +++ head/tools/tools/syscall_timing/syscall_timing.c Thu Nov 2 12:13:02 2017 (r325315) @@ -178,7 +178,6 @@ test_getpriority(uintmax_t num, uintmax_t int_arg, con return (i); } - uintmax_t test_pipe(uintmax_t num, uintmax_t int_arg, const char *path) { @@ -208,6 +207,31 @@ test_pipe(uintmax_t num, uintmax_t int_arg, const char } uintmax_t +test_select(uintmax_t num, uintmax_t int_arg, const char *path) +{ + fd_set readfds, writefds, exceptfds; + struct timeval tv; + uintmax_t i; + int error; + + FD_ZERO(&readfds); + FD_ZERO(&writefds); + FD_ZERO(&exceptfds); + + tv.tv_sec = 0; + tv.tv_usec = 0; + + benchmark_start(); + for (i = 0; i < num; i++) { + if (alarm_fired) + break; + (void)select(0, &readfds, &writefds, &exceptfds, &tv); + } + benchmark_stop(); + return (i); +} + +uintmax_t test_socket_stream(uintmax_t num, uintmax_t int_arg, const char *path) { uintmax_t i; @@ -653,6 +677,7 @@ static const struct test tests[] = { { "gettimeofday", test_gettimeofday }, { "getpriority", test_getpriority }, { "pipe", test_pipe }, + { "select", test_select }, { "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 },