]>
git.saurik.com Git - apple/xnu.git/blob - tools/tests/libMicro/apple/lmbench_lat_sig_install.c
ee1acd697523ce13c0aec681ee3e6788a875700b
2 * Copyright (c) 2006 Apple Inc. All Rights Reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
39 * benchmark_initworker
45 * benchmark_finibatch, etc.
46 * benchmark_finiworker
58 #pragma ident "@(#)lmbench_lat_sig_install.c 1.0 08/16/06 Apple Inc."
69 #include "../libmicro.h"
72 * Your state variables should live in the tsd_t struct below
81 void handler(int s
) { }
90 benchmark_initbatch(void *tsd
)
93 * initialize your state variables here second
108 * the lm_optstr must be defined here or no options for you
110 * ...and the framework will throw an error
113 (void) sprintf(lm_optstr
, "t:");
115 * working hypothesis:
117 * tsd_t is the struct that we can pass around our
120 * lm_tsdsize will allocate the space we need for this
121 * structure throughout the rest of the framework
123 lm_tsdsize
= sizeof (tsd_t
);
125 (void) sprintf(lm_usage
,
126 " [-p <parallelism>]\n"
128 " [-n <repetitions>]\n"
129 "notes: measures lmbench lat_sig install\n");
141 benchmark_finibatch(void *tsd
)
144 * more proof of state passing
152 static char result
= '\0';
153 (void) fprintf(stderr
, "benchmark_result\n");
158 benchmark_finiworker(void *tsd
)
164 benchmark_optswitch(int opt
, char *optarg
)
169 optw
= sizetoint(optarg
);
172 optn
= sizetoint(optarg
);
175 optp
= sizetoint(optarg
);
184 benchmark_initworker(void *tsd
)
187 * initialize your state variables here first
201 benchmark(void *tsd
, result_t
*res
)
204 * initialize your state variables here last
206 * and realize that you are paying for your initialization here
207 * and it is really a bad idea
209 struct sigaction sa
, old
;
212 for (i
= 0; i
< lm_optB
; i
++) {
213 sa
.sa_handler
= handler
;
214 sigemptyset(&sa
.sa_mask
);
216 sigaction(SIGUSR1
, &sa
, &old
);