PERFORCE change 174204 for review

Robert Watson rwatson at FreeBSD.org
Wed Feb 3 01:13:25 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=174204

Change 174204 by rwatson at rwatson_vimage_client on 2010/02/03 01:13:08

	Microbenchmark for vfork.

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/tools/tools/syscall_timing/syscall_timing.c#6 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/tools/tools/syscall_timing/syscall_timing.c#6 (text+ko) ====

@@ -388,6 +388,32 @@
 }
 
 void
+test_vfork(int num)
+{
+	pid_t pid;
+	int i;
+
+	pid = vfork();
+	if (pid < 0)
+		err(-1, "test_vfork: vfork");
+	if (pid == 0)
+		exit(0);
+	if (waitpid(pid, NULL, 0) < 0)
+		err(-1, "test_vfork: waitpid");
+	benchmark_start();
+	for (i = 0; i < num; i++) {
+		pid = vfork();
+		if (pid < 0)
+			err(-1, "test_vfork: vfork");
+		if (pid == 0)
+			exit(0);
+		if (waitpid(pid, NULL, 0) < 0)
+			err(-1, "test_vfork: waitpid");
+	}
+	benchmark_stop();
+}
+
+void
 test_pdfork(int num)
 {
 	struct pollfd pollfd;
@@ -545,6 +571,7 @@
 	{ "fstat_cap_shmfd", test_fstat_cap_shmfd },
 	{ "cap_enter", test_cap_enter },
 	{ "fork", test_fork },
+	{ "vfork", test_vfork },
 	{ "pdfork", test_pdfork },
 	{ "sandbox", test_sandbox },
 };


More information about the p4-projects mailing list