summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmarks/libmicro/DESCR5
-rw-r--r--benchmarks/libmicro/MESSAGE24
-rw-r--r--benchmarks/libmicro/Makefile72
-rw-r--r--benchmarks/libmicro/PLIST164
-rw-r--r--benchmarks/libmicro/distinfo16
-rwxr-xr-xbenchmarks/libmicro/files/run-libmicro4
-rw-r--r--benchmarks/libmicro/patches/patch-aa46
-rw-r--r--benchmarks/libmicro/patches/patch-ab42
-rw-r--r--benchmarks/libmicro/patches/patch-ac42
-rw-r--r--benchmarks/libmicro/patches/patch-ad38
-rw-r--r--benchmarks/libmicro/patches/patch-ae13
-rw-r--r--benchmarks/libmicro/patches/patch-af27
-rw-r--r--benchmarks/libmicro/patches/patch-ag13
-rw-r--r--benchmarks/libmicro/patches/patch-ah13
-rw-r--r--benchmarks/libmicro/patches/patch-ai32
-rw-r--r--benchmarks/libmicro/patches/patch-aj12
-rw-r--r--benchmarks/libmicro/patches/patch-ak22
17 files changed, 585 insertions, 0 deletions
diff --git a/benchmarks/libmicro/DESCR b/benchmarks/libmicro/DESCR
new file mode 100644
index 00000000000..cc03ae28e1a
--- /dev/null
+++ b/benchmarks/libmicro/DESCR
@@ -0,0 +1,5 @@
+LibMicro is a portable set of microbenchmarks that many Solaris engineers
+used during Solaris 10 development to measure the performance of various
+system and library calls. LibMicro was developed by Bart Smaalders and
+Phil Harman as part of their "If Linux is faster it's a Solaris bug
+performance" campaign.
diff --git a/benchmarks/libmicro/MESSAGE b/benchmarks/libmicro/MESSAGE
new file mode 100644
index 00000000000..cd455ac32b8
--- /dev/null
+++ b/benchmarks/libmicro/MESSAGE
@@ -0,0 +1,24 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+Execute "run-libmicro" to run the benchmark.
+
+You can pipe the output of "run-libmicro" to a file, and process it later
+via "multiview" when you need to generate an HTML report.
+
+For example, suppose you want to compare two runs. You can do:
+
+$ run-libmicro > output.1
+$ run-libmicro > output.2
+$ multiview output.1 output.2 > comparison.html
+
+Then read 'comparison.html' in your favorite web browser.
+
+WARNING: libMicro's results are strongly dependant of compile time options
+and compiler's optimizations. You must ensure that the compiler does
+not arbitrarily chose optimizations that do not fit the benchmark, or
+which may return irrelevant results. For example: over-simplification of
+the call-graph, load/store variables from register instead of memory,
+function vs builtin macro expansion, ...
+
+===========================================================================
diff --git a/benchmarks/libmicro/Makefile b/benchmarks/libmicro/Makefile
new file mode 100644
index 00000000000..7e47b5cd969
--- /dev/null
+++ b/benchmarks/libmicro/Makefile
@@ -0,0 +1,72 @@
+# $NetBSD: Makefile,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+#
+
+DISTNAME= libmicro-${LIBMICRO_VERSION}
+CATEGORIES= benchmarks
+MASTER_SITES= http://hub.opensolaris.org/bin/download/Project+libmicro/files/
+
+LIBMICRO_VERSION= 0.4.0
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://hub.opensolaris.org/bin/view/Project+libmicro/
+COMMENT= Set of utilities to benchmark productivity of system calls
+
+LICENSE= cddl-1.0
+
+WRKSRC= ${WRKDIR}/libMicro-${LIBMICRO_VERSION}
+
+USE_TOOLS= gmake tee
+BUILD_TARGET= default
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+INSTALLATION_DIRS= bin
+INSTALLATION_DIRS+= libexec/${PKGBASE}
+INSTALLATION_DIRS+= libexec/${PKGBASE}/bin
+INSTALLATION_DIRS+= libexec/${PKGBASE}/bin-${MACHINE_ARCH}
+
+LIBMICRO_BASE= ${PREFIX}/libexec/${PKGBASE}
+
+SUBST_CLASSES+= fix-arch
+SUBST_MESSAGE.fix-arch= Fix machine architecture path
+SUBST_STAGE.fix-arch= pre-configure
+SUBST_FILES.fix-arch= Makefile bench.sh wrapper.sh
+SUBST_SED.fix-arch= -e 's|@@MACHINE_ARCH@@|${MACHINE_ARCH:Q}|'
+
+post-build:
+ ${SED} -e 's|@@DESTDIR@@|${DESTDIR:Q}|' \
+ -e 's|@@PREFIX@@|${PREFIX:Q}|' \
+ -e 's|@@PKGBASE@@|${PKGBASE:Q}|' \
+ ${FILESDIR}/run-libmicro > ${WRKDIR}/run-libmicro
+
+do-install:
+ cd ${WRKSRC}/bin; \
+ for f in *; do \
+ ${INSTALL_PROGRAM} ${WRKSRC}/bin-${MACHINE_ARCH}/$$f \
+ ${DESTDIR}${LIBMICRO_BASE}/bin-${MACHINE_ARCH}; \
+ done
+ cd ${DESTDIR}${LIBMICRO_BASE}/bin-${MACHINE_ARCH}; \
+ for f in *; do \
+ ${LN} -s ../wrapper ../bin/$$f; \
+ done
+ ${INSTALL_PROGRAM} ${WRKSRC}/bin-${MACHINE_ARCH}/exec_bin \
+ ${DESTDIR}${LIBMICRO_BASE}/bin-${MACHINE_ARCH}
+ ${INSTALL_SCRIPT} ${WRKSRC}/bench \
+ ${DESTDIR}${LIBMICRO_BASE}
+ ${INSTALL_SCRIPT} ${WRKSRC}/wrapper \
+ ${DESTDIR}${LIBMICRO_BASE}
+ ${INSTALL_SCRIPT} ${WRKSRC}/multiview \
+ ${DESTDIR}${PREFIX}/bin
+ ${INSTALL_SCRIPT} ${WRKDIR}/run-libmicro \
+ ${DESTDIR}${PREFIX}/bin
+
+benchmark:
+ cd ${WRKSRC}; ./bench | ${TEE} libmicro.output
+
+results:
+ ${MKDIR} /tmp/benches/`domainname`
+ cd ${WRKSRC}; \
+ ./multiview libmicro.output > /tmp/benches/`domainname`/libmicro.`uname`-`uname -m`-`uname -r`.`hostname`.html
+
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/benchmarks/libmicro/PLIST b/benchmarks/libmicro/PLIST
new file mode 100644
index 00000000000..d77c31096ea
--- /dev/null
+++ b/benchmarks/libmicro/PLIST
@@ -0,0 +1,164 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+bin/multiview
+bin/run-libmicro
+libexec/libmicro/bench
+libexec/libmicro/bin-${MACHINE_ARCH}/atomic
+libexec/libmicro/bin-${MACHINE_ARCH}/bind
+libexec/libmicro/bin-${MACHINE_ARCH}/cachetocache
+libexec/libmicro/bin-${MACHINE_ARCH}/cascade_cond
+libexec/libmicro/bin-${MACHINE_ARCH}/cascade_fcntl
+libexec/libmicro/bin-${MACHINE_ARCH}/cascade_flock
+libexec/libmicro/bin-${MACHINE_ARCH}/cascade_lockf
+libexec/libmicro/bin-${MACHINE_ARCH}/cascade_mutex
+libexec/libmicro/bin-${MACHINE_ARCH}/chdir
+libexec/libmicro/bin-${MACHINE_ARCH}/close
+libexec/libmicro/bin-${MACHINE_ARCH}/close_tcp
+libexec/libmicro/bin-${MACHINE_ARCH}/connection
+libexec/libmicro/bin-${MACHINE_ARCH}/dup
+libexec/libmicro/bin-${MACHINE_ARCH}/exec
+libexec/libmicro/bin-${MACHINE_ARCH}/exec_bin
+libexec/libmicro/bin-${MACHINE_ARCH}/exit
+libexec/libmicro/bin-${MACHINE_ARCH}/exp
+libexec/libmicro/bin-${MACHINE_ARCH}/fcntl
+libexec/libmicro/bin-${MACHINE_ARCH}/fcntl_ndelay
+libexec/libmicro/bin-${MACHINE_ARCH}/file_lock
+libexec/libmicro/bin-${MACHINE_ARCH}/fork
+libexec/libmicro/bin-${MACHINE_ARCH}/getcontext
+libexec/libmicro/bin-${MACHINE_ARCH}/getenv
+libexec/libmicro/bin-${MACHINE_ARCH}/getpeername
+libexec/libmicro/bin-${MACHINE_ARCH}/getpid
+libexec/libmicro/bin-${MACHINE_ARCH}/getrusage
+libexec/libmicro/bin-${MACHINE_ARCH}/getsockname
+libexec/libmicro/bin-${MACHINE_ARCH}/gettimeofday
+libexec/libmicro/bin-${MACHINE_ARCH}/isatty
+libexec/libmicro/bin-${MACHINE_ARCH}/listen
+libexec/libmicro/bin-${MACHINE_ARCH}/localtime_r
+libexec/libmicro/bin-${MACHINE_ARCH}/log
+libexec/libmicro/bin-${MACHINE_ARCH}/longjmp
+libexec/libmicro/bin-${MACHINE_ARCH}/lrand48
+libexec/libmicro/bin-${MACHINE_ARCH}/lseek
+libexec/libmicro/bin-${MACHINE_ARCH}/malloc
+libexec/libmicro/bin-${MACHINE_ARCH}/memcpy
+libexec/libmicro/bin-${MACHINE_ARCH}/memmove
+libexec/libmicro/bin-${MACHINE_ARCH}/memrand
+libexec/libmicro/bin-${MACHINE_ARCH}/memset
+libexec/libmicro/bin-${MACHINE_ARCH}/mktime
+libexec/libmicro/bin-${MACHINE_ARCH}/mmap
+libexec/libmicro/bin-${MACHINE_ARCH}/mprotect
+libexec/libmicro/bin-${MACHINE_ARCH}/msync
+libexec/libmicro/bin-${MACHINE_ARCH}/munmap
+libexec/libmicro/bin-${MACHINE_ARCH}/mutex
+libexec/libmicro/bin-${MACHINE_ARCH}/nop
+libexec/libmicro/bin-${MACHINE_ARCH}/open
+libexec/libmicro/bin-${MACHINE_ARCH}/pipe
+libexec/libmicro/bin-${MACHINE_ARCH}/poll
+libexec/libmicro/bin-${MACHINE_ARCH}/pread
+libexec/libmicro/bin-${MACHINE_ARCH}/pthread_create
+libexec/libmicro/bin-${MACHINE_ARCH}/pwrite
+libexec/libmicro/bin-${MACHINE_ARCH}/read
+libexec/libmicro/bin-${MACHINE_ARCH}/realpath
+libexec/libmicro/bin-${MACHINE_ARCH}/recurse
+libexec/libmicro/bin-${MACHINE_ARCH}/select
+libexec/libmicro/bin-${MACHINE_ARCH}/semop
+libexec/libmicro/bin-${MACHINE_ARCH}/setcontext
+libexec/libmicro/bin-${MACHINE_ARCH}/setsockopt
+libexec/libmicro/bin-${MACHINE_ARCH}/sigaction
+libexec/libmicro/bin-${MACHINE_ARCH}/siglongjmp
+libexec/libmicro/bin-${MACHINE_ARCH}/signal
+libexec/libmicro/bin-${MACHINE_ARCH}/sigprocmask
+libexec/libmicro/bin-${MACHINE_ARCH}/socket
+libexec/libmicro/bin-${MACHINE_ARCH}/socketpair
+libexec/libmicro/bin-${MACHINE_ARCH}/stat
+libexec/libmicro/bin-${MACHINE_ARCH}/strcasecmp
+libexec/libmicro/bin-${MACHINE_ARCH}/strchr
+libexec/libmicro/bin-${MACHINE_ARCH}/strcmp
+libexec/libmicro/bin-${MACHINE_ARCH}/strcpy
+libexec/libmicro/bin-${MACHINE_ARCH}/strftime
+libexec/libmicro/bin-${MACHINE_ARCH}/strlen
+libexec/libmicro/bin-${MACHINE_ARCH}/strtol
+libexec/libmicro/bin-${MACHINE_ARCH}/system
+libexec/libmicro/bin-${MACHINE_ARCH}/tattle
+libexec/libmicro/bin-${MACHINE_ARCH}/time
+libexec/libmicro/bin-${MACHINE_ARCH}/times
+libexec/libmicro/bin-${MACHINE_ARCH}/write
+libexec/libmicro/bin-${MACHINE_ARCH}/writev
+libexec/libmicro/bin/atomic
+libexec/libmicro/bin/bind
+libexec/libmicro/bin/cachetocache
+libexec/libmicro/bin/cascade_cond
+libexec/libmicro/bin/cascade_fcntl
+libexec/libmicro/bin/cascade_flock
+libexec/libmicro/bin/cascade_lockf
+libexec/libmicro/bin/cascade_mutex
+libexec/libmicro/bin/chdir
+libexec/libmicro/bin/close
+libexec/libmicro/bin/close_tcp
+libexec/libmicro/bin/connection
+libexec/libmicro/bin/dup
+libexec/libmicro/bin/exec
+libexec/libmicro/bin/exit
+libexec/libmicro/bin/exp
+libexec/libmicro/bin/fcntl
+libexec/libmicro/bin/fcntl_ndelay
+libexec/libmicro/bin/file_lock
+libexec/libmicro/bin/fork
+libexec/libmicro/bin/getcontext
+libexec/libmicro/bin/getenv
+libexec/libmicro/bin/getpeername
+libexec/libmicro/bin/getpid
+libexec/libmicro/bin/getrusage
+libexec/libmicro/bin/getsockname
+libexec/libmicro/bin/gettimeofday
+libexec/libmicro/bin/isatty
+libexec/libmicro/bin/listen
+libexec/libmicro/bin/localtime_r
+libexec/libmicro/bin/log
+libexec/libmicro/bin/longjmp
+libexec/libmicro/bin/lrand48
+libexec/libmicro/bin/lseek
+libexec/libmicro/bin/malloc
+libexec/libmicro/bin/memcpy
+libexec/libmicro/bin/memmove
+libexec/libmicro/bin/memrand
+libexec/libmicro/bin/memset
+libexec/libmicro/bin/mktime
+libexec/libmicro/bin/mmap
+libexec/libmicro/bin/mprotect
+libexec/libmicro/bin/msync
+libexec/libmicro/bin/munmap
+libexec/libmicro/bin/mutex
+libexec/libmicro/bin/nop
+libexec/libmicro/bin/open
+libexec/libmicro/bin/pipe
+libexec/libmicro/bin/poll
+libexec/libmicro/bin/pread
+libexec/libmicro/bin/pthread_create
+libexec/libmicro/bin/pwrite
+libexec/libmicro/bin/read
+libexec/libmicro/bin/realpath
+libexec/libmicro/bin/recurse
+libexec/libmicro/bin/select
+libexec/libmicro/bin/semop
+libexec/libmicro/bin/setcontext
+libexec/libmicro/bin/setsockopt
+libexec/libmicro/bin/sigaction
+libexec/libmicro/bin/siglongjmp
+libexec/libmicro/bin/signal
+libexec/libmicro/bin/sigprocmask
+libexec/libmicro/bin/socket
+libexec/libmicro/bin/socketpair
+libexec/libmicro/bin/stat
+libexec/libmicro/bin/strcasecmp
+libexec/libmicro/bin/strchr
+libexec/libmicro/bin/strcmp
+libexec/libmicro/bin/strcpy
+libexec/libmicro/bin/strftime
+libexec/libmicro/bin/strlen
+libexec/libmicro/bin/strtol
+libexec/libmicro/bin/system
+libexec/libmicro/bin/tattle
+libexec/libmicro/bin/time
+libexec/libmicro/bin/times
+libexec/libmicro/bin/write
+libexec/libmicro/bin/writev
+libexec/libmicro/wrapper
diff --git a/benchmarks/libmicro/distinfo b/benchmarks/libmicro/distinfo
new file mode 100644
index 00000000000..f6e687f9efc
--- /dev/null
+++ b/benchmarks/libmicro/distinfo
@@ -0,0 +1,16 @@
+$NetBSD: distinfo,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+SHA1 (libmicro-0.4.0.tar.gz) = bf73af51610f08c9fb50025beb3ee86718a11596
+RMD160 (libmicro-0.4.0.tar.gz) = 5d844892cbe9fcc77fd3479c54d7135b196a0097
+Size (libmicro-0.4.0.tar.gz) = 48858 bytes
+SHA1 (patch-aa) = e322da8461bfcc94834593725ffd58672972eb97
+SHA1 (patch-ab) = 73d29b9b236b91debdb5300bc2e2d3ddaa118106
+SHA1 (patch-ac) = 9122460e392d57be14257ee379ce79e680c88434
+SHA1 (patch-ad) = 1fb254250a40ec35c05c3653145c8bb4d5d78d77
+SHA1 (patch-ae) = be1c805cf631912e76fbeced5b42fe0b92054b96
+SHA1 (patch-af) = 78cbd223f462ce5854539b08fd26184cf97d8282
+SHA1 (patch-ag) = fdec73e5d55ea0c594e77c920f985a5c3a3f5768
+SHA1 (patch-ah) = 7507bded72b5db04dc7c61cd3498b0cbf793f69c
+SHA1 (patch-ai) = af43c6061b1dd4b36cbe25887414580ca648b8e2
+SHA1 (patch-aj) = 6142d17c1d1a461bf114319e0ebcc5a516dab486
+SHA1 (patch-ak) = f44b5e9c8d2182873978af9396ffc3e513ce6af8
diff --git a/benchmarks/libmicro/files/run-libmicro b/benchmarks/libmicro/files/run-libmicro
new file mode 100755
index 00000000000..22a3925d977
--- /dev/null
+++ b/benchmarks/libmicro/files/run-libmicro
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+cd @@DESTDIR@@/@@PREFIX@@/libexec/@@PKGBASE@@
+./bench
diff --git a/benchmarks/libmicro/patches/patch-aa b/benchmarks/libmicro/patches/patch-aa
new file mode 100644
index 00000000000..06c330aac9c
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-aa
@@ -0,0 +1,46 @@
+$NetBSD: patch-aa,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- /dev/null 2009-11-14 23:45:08.000000000 +0100
++++ Makefile.NetBSD
+@@ -0,0 +1,41 @@
++#
++# CDDL HEADER START
++#
++# The contents of this file are subject to the terms
++# of the Common Development and Distribution License
++# (the "License"). You may not use this file except
++# in compliance with the License.
++#
++# You can obtain a copy of the license at
++# src/OPENSOLARIS.LICENSE
++# or http://www.opensolaris.org/os/licensing.
++# See the License for the specific language governing
++# permissions and limitations under the License.
++#
++# When distributing Covered Code, include this CDDL
++# HEADER in each file and include the License file at
++# usr/src/OPENSOLARIS.LICENSE. If applicable,
++# add the following below this CDDL HEADER, with the
++# fields enclosed by brackets "[]" replaced with your
++# own identifying information: Portions Copyright [yyyy]
++# [name of copyright owner]
++#
++# CDDL HEADER END
++#
++
++#
++# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
++# Use is subject to license terms.
++#
++
++
++CC= gcc
++
++CFLAGS= -O -DUSE_SEMOP
++CPPFLAGS= -DUSE_SEMOP
++MATHLIB= -lm
++
++ELIDED_BENCHMARKS= \
++ cachetocache
++
++include ../Makefile.com
diff --git a/benchmarks/libmicro/patches/patch-ab b/benchmarks/libmicro/patches/patch-ab
new file mode 100644
index 00000000000..c9a8be35586
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-ab
@@ -0,0 +1,42 @@
+$NetBSD: patch-ab,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- cascade_mutex.c.orig 2007-07-02 23:17:45.000000000 +0200
++++ cascade_mutex.c
+@@ -79,7 +79,9 @@ benchmark_init()
+ lm_defN = "cscd_mutex";
+
+ (void) sprintf(lm_usage,
++#if !defined(__NetBSD__)
+ " [-s] (force PTHREAD_PROCESS_SHARED)\n"
++#endif
+ "notes: thread cascade using pthread_mutexes\n");
+
+ return (0);
+@@ -90,9 +92,11 @@ int
+ benchmark_optswitch(int opt, char *optarg)
+ {
+ switch (opt) {
++#if !defined(__NetBSD__)
+ case 's':
+ opts = 1;
+ break;
++#endif
+ default:
+ return (-1);
+ }
+@@ -119,6 +123,7 @@ benchmark_initrun()
+ }
+
+ (void) pthread_mutexattr_init(&ma);
++#if !defined(__NetBSD__)
+ if (lm_optP > 1 || opts) {
+ (void) pthread_mutexattr_setpshared(&ma,
+ PTHREAD_PROCESS_SHARED);
+@@ -126,6 +131,7 @@ benchmark_initrun()
+ (void) pthread_mutexattr_setpshared(&ma,
+ PTHREAD_PROCESS_PRIVATE);
+ }
++#endif
+
+ for (i = 0; i < nlocks; i++) {
+ (void) pthread_mutex_init(&locks[i], &ma);
diff --git a/benchmarks/libmicro/patches/patch-ac b/benchmarks/libmicro/patches/patch-ac
new file mode 100644
index 00000000000..f803c7ce46c
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-ac
@@ -0,0 +1,42 @@
+$NetBSD: patch-ac,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- cascade_cond.c.orig 2009-11-14 23:56:51.000000000 +0100
++++ cascade_cond.c
+@@ -83,7 +83,9 @@ benchmark_init()
+
+ (void) sprintf(lm_usage,
+ " [-o] (do signal outside mutex)\n"
++#if !defined(__NetBSD__)
+ " [-s] (force PTHREAD_PROCESS_SHARED)\n"
++#endif
+ "notes: thread cascade using pthread_conds\n");
+
+ return (0);
+@@ -97,9 +99,11 @@ benchmark_optswitch(int opt, char *optar
+ case 'o':
+ opto = 1;
+ break;
++#if !defined(__NetBSD__)
+ case 's':
+ opts = 1;
+ break;
++#endif
+ default:
+ return (-1);
+ }
+@@ -148,6 +152,7 @@ benchmark_initrun()
+
+ (void) pthread_mutexattr_init(&ma);
+ (void) pthread_condattr_init(&ca);
++#if !defined(__NetBSD__)
+ if (lm_optP > 1 || opts) {
+ (void) pthread_mutexattr_setpshared(&ma,
+ PTHREAD_PROCESS_SHARED);
+@@ -159,6 +164,7 @@ benchmark_initrun()
+ (void) pthread_condattr_setpshared(&ca,
+ PTHREAD_PROCESS_PRIVATE);
+ }
++#endif
+
+ for (i = 0; i < nlocks; i++) {
+ (void) pthread_mutex_init(&mxs[i], &ma);
diff --git a/benchmarks/libmicro/patches/patch-ad b/benchmarks/libmicro/patches/patch-ad
new file mode 100644
index 00000000000..42063d2128e
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-ad
@@ -0,0 +1,38 @@
+$NetBSD: patch-ad,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- mutex.c.orig 2007-07-02 23:17:45.000000000 +0200
++++ mutex.c
+@@ -59,7 +59,9 @@ benchmark_init()
+
+ (void) sprintf(lm_usage,
+ " [-t] (create dummy thread so we are multithreaded)\n"
++#if !defined(__NetBSD__)
+ " [-p] (use inter-process mutex (not support everywhere))\n"
++#endif
+ " [-h usecs] (specify mutex hold time (default 0)\n"
+ "notes: measures uncontended pthread_mutex_[un,]lock\n");
+
+@@ -75,9 +77,11 @@ int
+ benchmark_optswitch(int opt, char *optarg)
+ {
+ switch (opt) {
++#if !defined(__NetBSD__)
+ case 'p':
+ optp = 1;
+ break;
++#endif
+
+ case 't':
+ optt = 1;
+@@ -121,9 +125,11 @@ benchmark_initrun()
+ errors++;
+ } else {
+ (void) pthread_mutexattr_init(&attr);
++#if !defined(__NetBSD__)
+ if (optp)
+ (void) pthread_mutexattr_setpshared(&attr,
+ PTHREAD_PROCESS_SHARED);
++#endif
+
+ if (pthread_mutex_init(lock, &attr) != 0)
+ errors++;
diff --git a/benchmarks/libmicro/patches/patch-ae b/benchmarks/libmicro/patches/patch-ae
new file mode 100644
index 00000000000..6325eff3ef0
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-ae
@@ -0,0 +1,13 @@
+$NetBSD: patch-ae,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- Makefile.com.orig 2009-11-15 00:05:16.000000000 +0100
++++ Makefile.com
+@@ -107,7 +107,7 @@ tattle: ../tattle.c libmicro.a
+ echo "char * compiler_version = \""`$(COMPILER_VERSION_CMD)`"\";" > tattle.h
+ echo "char * CC = \""$(CC)"\";" >> tattle.h
+ echo "char * extra_compiler_flags = \""$(extra_CFLAGS)"\";" >> tattle.h
+- $(CC) -o tattle $(CFLAGS) -I. ../tattle.c libmicro.a -lrt -lm
++ $(CC) -o tattle $(CFLAGS) -I. ../tattle.c libmicro.a -lpthread -lrt -lm
+
+ $(ELIDED_BENCHMARKS): ../elided.c
+ $(CC) -o $(@) ../elided.c
diff --git a/benchmarks/libmicro/patches/patch-af b/benchmarks/libmicro/patches/patch-af
new file mode 100644
index 00000000000..8054825573a
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-af
@@ -0,0 +1,27 @@
+$NetBSD: patch-af,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- bench.sh.orig 2007-07-02 23:17:45.000000000 +0200
++++ bench.sh
+@@ -65,7 +65,7 @@ mkdir -p $VDIR1 $VDIR2
+
+ touch $IFILE
+
+-ARCH=`arch -k`
++ARCH=@@MACHINE_ARCH@@
+
+ # produce benchmark header for easier comparisons
+
+@@ -83,6 +83,13 @@ if [ -f /proc/cpuinfo ]; then
+ p_type=`awk -F: '/model name/{print $2; exit}' /proc/cpuinfo`
+ fi
+
++if [ x"`uname -s`" = x"NetBSD" ]; then
++ p_count=`sysctl -n hw.ncpu`
++ p_mhz=`sysctl -n machdep.tsc_freq \
++ | awk '{printf("%.4fMHz\n",$1/1000000)}'`
++ p_type=`sysctl -n hw.model`
++fi
++
+ printf "!Libmicro_#: %30s\n" $libmicro_version
+ printf "!Options: %30s\n" "$OPTS"
+ printf "!Machine_name: %30s\n" $hostname
diff --git a/benchmarks/libmicro/patches/patch-ag b/benchmarks/libmicro/patches/patch-ag
new file mode 100644
index 00000000000..689559a1aea
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-ag
@@ -0,0 +1,13 @@
+$NetBSD: patch-ag,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- longjmp.c.orig 2007-07-02 23:17:45.000000000 +0200
++++ longjmp.c
+@@ -51,7 +51,7 @@ benchmark_init()
+ int
+ benchmark(void *tsd, result_t *res)
+ {
+- int i = 0;
++ volatile int i = 0;
+ jmp_buf env;
+
+ (void) setjmp(env);
diff --git a/benchmarks/libmicro/patches/patch-ah b/benchmarks/libmicro/patches/patch-ah
new file mode 100644
index 00000000000..31b038712eb
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-ah
@@ -0,0 +1,13 @@
+$NetBSD: patch-ah,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- siglongjmp.c.orig 2007-07-02 23:17:45.000000000 +0200
++++ siglongjmp.c
+@@ -56,7 +56,7 @@ benchmark(void *tsd, result_t *res)
+ {
+ tsd_t *ts = (tsd_t *)tsd;
+
+- int i = 0;
++ volatile int i = 0;
+
+ (void) sigsetjmp(ts->ts_env, 1);
+
diff --git a/benchmarks/libmicro/patches/patch-ai b/benchmarks/libmicro/patches/patch-ai
new file mode 100644
index 00000000000..365391be24e
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-ai
@@ -0,0 +1,32 @@
+$NetBSD: patch-ai,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- multiview.sh.orig 2007-07-02 23:17:45.000000000 +0200
++++ multiview.sh
+@@ -38,15 +38,15 @@
+ # the redder the color, the slower the result, the greener the
+ # faster
+
+-/bin/nawk ' BEGIN {
++awk ' BEGIN {
+ benchmark_count = 0;
+ header_count = 0;
+ }
+ /^#/ {
+- continue;
++ next;
+ }
+ /errors/ {
+- continue;
++ next;
+ }
+ /^\!/ {
+ split($0, A_header, ":");
+@@ -57,7 +57,7 @@
+ header_names[name] = ++header_count;
+ headers[header_count] = name;
+ }
+- continue;
++ next;
+ }
+
+ {
diff --git a/benchmarks/libmicro/patches/patch-aj b/benchmarks/libmicro/patches/patch-aj
new file mode 100644
index 00000000000..19798f624e2
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-aj
@@ -0,0 +1,12 @@
+$NetBSD: patch-aj,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- wrapper.sh.orig 2007-07-02 23:17:45.000000000 +0200
++++ wrapper.sh
+@@ -32,6 +32,6 @@
+
+ BASENAME=`basename $0`
+ DIRNAME=`dirname $0`
+-ARCH=`uname -m`
++ARCH=@@MACHINE_ARCH@@
+
+ exec $DIRNAME/../bin-$ARCH/$BASENAME "$@"
diff --git a/benchmarks/libmicro/patches/patch-ak b/benchmarks/libmicro/patches/patch-ak
new file mode 100644
index 00000000000..3203c8089ce
--- /dev/null
+++ b/benchmarks/libmicro/patches/patch-ak
@@ -0,0 +1,22 @@
+$NetBSD: patch-ak,v 1.1.1.1 2009/11/22 00:45:54 jym Exp $
+
+--- Makefile.orig 2007-07-02 23:17:45.000000000 +0200
++++ Makefile
+@@ -31,6 +31,8 @@
+
+ include Makefile.benchmarks
+
++ARCH=@@MACHINE_ARCH@@
++
+ BINS= $(ALL:%=bin/%) bin/tattle
+
+ TARBALL_CONTENTS = \
+@@ -73,7 +75,7 @@ default $(ALL) run cstyle lint tattle: $
+ @cp multiview.sh multiview
+ @cp wrapper.sh wrapper
+ @chmod +x bench multiview wrapper
+- @mkdir -p bin-`uname -m`; cd bin-`uname -m`; MACH=`uname -m` $(MAKE) -f ../Makefile.`uname -s` UNAME_RELEASE=`uname -r | sed 's/\./_/g'` $@
++ @mkdir -p bin-$(ARCH); cd bin-$(ARCH); MACH=$(ARCH) $(MAKE) -f ../Makefile.`uname -s` UNAME_RELEASE=`uname -r | sed 's/\./_/g'` $@
+
+ clean:
+ rm -rf bin bin-* wrapper multiview bench