Author: trasz
Date: Mon Apr 16 17:25:52 2018
New Revision: 332623
URL: https://svnweb.freebsd.org/changeset/base/332623

Log:
  MFC r325317:
  
  Add bad_open benchmark, which measures failed opens by calling
  open("", O_RDONLY);.

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:24:33 2018        (r332622)
+++ stable/11/tools/tools/syscall_timing/syscall_timing.c       Mon Apr 16 
17:25:52 2018        (r332623)
@@ -334,6 +334,21 @@ test_open_close(uintmax_t num, uintmax_t int_arg, cons
 }
 
 uintmax_t
+test_bad_open(uintmax_t num, uintmax_t int_arg, const char *path)
+{
+       uintmax_t i;
+
+       benchmark_start();
+       for (i = 0; i < num; i++) {
+               if (alarm_fired)
+                       break;
+               open("", O_RDONLY);
+       }
+       benchmark_stop();
+       return (i);
+}
+
+uintmax_t
 test_read(uintmax_t num, uintmax_t int_arg, const char *path)
 {
        char buf[int_arg];
@@ -641,6 +656,7 @@ static const struct test tests[] = {
        { "socket_tcp", test_socket_stream, .t_int = PF_INET },
        { "socket_udp", test_socket_dgram, .t_int = PF_INET },
        { "create_unlink", test_create_unlink, .t_flags = FLAG_PATH },
+       { "bad_open", test_bad_open },
        { "open_close", test_open_close, .t_flags = FLAG_PATH },
        { "open_read_close_1", test_open_read_close, .t_flags = FLAG_PATH,
            .t_int = 1 },
_______________________________________________
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