]>
git.saurik.com Git - apple/xnu.git/blob - tools/tests/libMicro/apple/geekbench_stdlib_write.c
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 "@(#)geekbench_stdlib_write.c 1.0 08/17/06 Apple Inc."
68 #include "../libmicro.h"
71 * Your state variables should live in the tsd_t struct below
77 unsigned char * arena
;
78 unsigned int arenaSize
= 1048576;
84 benchmark_initbatch(void *tsd
)
87 * initialize your state variables here second
89 //tsd_t *ts = (tsd_t *)tsd;
90 //(void) fprintf(stderr, "benchmark_initbatch: ts_once = %i\n",ts->ts_once);
97 (void) fprintf(stderr
, "benchmark_finirun\n");
104 (void) fprintf(stderr
, "benchmark_init\n");
106 * the lm_optstr must be defined here or no options for you
108 * ...and the framework will throw an error
111 (void) sprintf(lm_optstr
, "t:");
113 * working hypothesis:
115 * tsd_t is the struct that we can pass around our
118 * lm_tsdsize will allocate the space we need for this
119 * structure throughout the rest of the framework
121 lm_tsdsize
= sizeof (tsd_t
);
123 (void) sprintf(lm_usage
,
124 " [-t int (default 1)]\n"
125 "notes: measures nothing\n");
132 (void) fprintf(stderr
, "benchmark_fini\n");
137 benchmark_finibatch(void *tsd
)
139 tsd_t
*ts
= (tsd_t
*)tsd
;
141 * more proof of state passing
144 //(void) fprintf(stderr, "benchmark_finibatch: ts_once = %i\n",ts->ts_once);
151 static char result
= '\0';
152 (void) fprintf(stderr
, "benchmark_result\n");
157 benchmark_finiworker(void *tsd
)
159 //tsd_t *ts = (tsd_t *)tsd;
160 //(void) fprintf(stderr, "benchmark_finiworker: ts_once = %i\n",ts->ts_once);
165 benchmark_optswitch(int opt
, char *optarg
)
167 (void) fprintf(stderr
, "benchmark_optswitch\n");
171 optt
= sizetoint(optarg
);
180 benchmark_initworker(void *tsd
)
183 * initialize your state variables here first
185 //tsd_t *ts = (tsd_t *)tsd;
186 //ts->ts_once = optt;
187 //(void) fprintf(stderr, "benchmark_initworker: ts_once = %i\n",ts->ts_once);
188 arena
= ( unsigned char * )malloc( arenaSize
);
195 //(void) fprintf(stderr, "benchmark_initrun\n");
200 benchmark(void *tsd
, result_t
*res
)
203 * initialize your state variables here last
205 * and realize that you are paying for your initialization here
206 * and it is really a bad idea
208 //tsd_t *ts = (tsd_t *)tsd;
211 //(void) fprintf(stderr, "in to benchmark - optB = %i : ts_once = %i\n", lm_optB, ts->ts_once);
212 for (i
= 0; i
< lm_optB
; i
++) {
214 * just to show that ts really contains state
216 //(void) fprintf(stderr, "i is %i\n",i);
217 memset( arena
, 0, arenaSize
);
220 //(void) fprintf(stderr, "out of benchmark - optB = %i : ts_once = %i\n", lm_optB, ts->ts_once);