Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2018 17:25:52 +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: r332623 - stable/11/tools/tools/syscall_timing
Message-ID:  <201804161725.w3GHPqWJ031751@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 },



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804161725.w3GHPqWJ031751>