Author: trasz
Date: Mon Apr 16 17:27:13 2018
New Revision: 332625
URL: https://svnweb.freebsd.org/changeset/base/332625

Log:
  MFC r325315:
  
  Add select(2) benchmark.  It takes four pointers; unfortunately it's
  somewhat heavy.

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:26:32 2018        (r332624)
+++ stable/11/tools/tools/syscall_timing/syscall_timing.c       Mon Apr 16 
17:27:13 2018        (r332625)
@@ -177,7 +177,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)
 {
@@ -207,6 +206,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;
@@ -667,6 +691,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 },
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to