]>
git.saurik.com Git - apple/xnu.git/blob - tools/tests/libMicro/apple/getaddrinfo_port.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@
37 // add additional headers needed here.
39 #include "../libmicro.h"
42 # define debug(fmt, args...) (void) fprintf(stderr, fmt "\n" , ##args)
44 # define debug(fmt, args...)
48 // This exercises "ssh" port
52 // getaddrinfo_port -E -L -S -W -B 200 -C 100
54 // libMicro default benchmark run options are "-E -L -S -W -C 200"
56 // -B is batch size: loop iteration per each benchmark run. Needs to match # of
57 // real lookups. This is total number of lookups to issue.
58 // -C is min sample number: how many benchmark needs to run to get proper sample
59 // 1 is mimumum, but you get at least 3 benchmark run
60 // samples. Do not set to zero. Default is 200 for most
64 extern int gL1CacheEnabled
;
67 * Your state variables should live in the tsd_t struct below
76 debug("benchmark_init");
78 (void) sprintf(lm_optstr
, "l:");
79 lm_tsdsize
= sizeof (tsd_t
);
87 * This is where you parse your lower-case arguments.
90 benchmark_optswitch(int opt
, char *optarg
)
92 debug("benchmark_optswitch");
96 gL1CacheEnabled
= atoi(optarg
);
104 // Initialize all structures that will be used in benchmark()
109 debug("\nbenchmark_initrun");
116 benchmark(void *tsd
, result_t
*res
)
119 struct addrinfo
*addi
;
123 debug("in to benchmark - optB = %i", lm_optB
);
124 for (i
= 0; i
< lm_optB
; i
++) {
126 err
= getaddrinfo(NULL
, "ssh", NULL
, &addi
);
129 debug("error: %s", gai_strerror(err
));
140 // We need to release all the structures we allocated in benchmark_initrun()
142 benchmark_finirun(void *tsd
)
144 // tsd_t *ts = (tsd_t *)tsd;
145 debug("benchmark_finirun ");
153 static char result
= '\0';
154 debug("benchmark_result");