Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2017 12:16:11 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325318 - head/tools/tools/syscall_timing
Message-ID:  <201711021216.vA2CGBVo026075@repo.freebsd.org>

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



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