Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Feb 2010 01:13:24 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 174204 for review
Message-ID:  <201002030113.o131DOLs058692@repoman.freebsd.org>

index | next in thread | raw e-mail

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

Change 174204 by rwatson@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 },
 };


help

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