xref: /minix3/usr.bin/nbperf/nbperf.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /*	$NetBSD: nbperf.h,v 1.4 2013/01/31 16:32:02 joerg Exp $	*/
2c75851fcSLionel Sambuc /*-
3c75851fcSLionel Sambuc  * Copyright (c) 2009 The NetBSD Foundation, Inc.
4c75851fcSLionel Sambuc  * All rights reserved.
5c75851fcSLionel Sambuc  *
6c75851fcSLionel Sambuc  * This code is derived from software contributed to The NetBSD Foundation
7c75851fcSLionel Sambuc  * by Joerg Sonnenberger.
8c75851fcSLionel Sambuc  *
9c75851fcSLionel Sambuc  * Redistribution and use in source and binary forms, with or without
10c75851fcSLionel Sambuc  * modification, are permitted provided that the following conditions
11c75851fcSLionel Sambuc  * are met:
12c75851fcSLionel Sambuc  *
13c75851fcSLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
14c75851fcSLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
15c75851fcSLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16c75851fcSLionel Sambuc  *    notice, this list of conditions and the following disclaimer in
17c75851fcSLionel Sambuc  *    the documentation and/or other materials provided with the
18c75851fcSLionel Sambuc  *    distribution.
19c75851fcSLionel Sambuc  *
20c75851fcSLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21c75851fcSLionel Sambuc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22c75851fcSLionel Sambuc  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23c75851fcSLionel Sambuc  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
24c75851fcSLionel Sambuc  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25c75851fcSLionel Sambuc  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26c75851fcSLionel Sambuc  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27c75851fcSLionel Sambuc  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28c75851fcSLionel Sambuc  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29c75851fcSLionel Sambuc  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30c75851fcSLionel Sambuc  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31c75851fcSLionel Sambuc  * SUCH DAMAGE.
32c75851fcSLionel Sambuc  */
33c75851fcSLionel Sambuc 
34c75851fcSLionel Sambuc #define	NBPERF_MAX_HASH_SIZE	3
35c75851fcSLionel Sambuc 
36c75851fcSLionel Sambuc struct nbperf {
37c75851fcSLionel Sambuc 	FILE *output;
38c75851fcSLionel Sambuc 	FILE *map_output;
39c75851fcSLionel Sambuc 	const char *hash_name;
40c75851fcSLionel Sambuc 	int static_hash;
41c75851fcSLionel Sambuc 	size_t n;
42c75851fcSLionel Sambuc 	const void * __restrict * keys;
43c75851fcSLionel Sambuc 	const size_t *keylens;
44c75851fcSLionel Sambuc 	int first_round, has_duplicates;
45c75851fcSLionel Sambuc 
46c75851fcSLionel Sambuc 	double c;
47c75851fcSLionel Sambuc 
48c75851fcSLionel Sambuc 	size_t hash_size;
49c75851fcSLionel Sambuc 	void (*seed_hash)(struct nbperf *);
50c75851fcSLionel Sambuc 	void (*print_hash)(struct nbperf *, const char *, const char *, const char *,
51c75851fcSLionel Sambuc 	    const char *);
52c75851fcSLionel Sambuc 	void (*compute_hash)(struct nbperf *, const void *, size_t,
53c75851fcSLionel Sambuc 	    uint32_t *);
54c75851fcSLionel Sambuc 	uint32_t seed[1];
55c75851fcSLionel Sambuc };
56c75851fcSLionel Sambuc 
57c75851fcSLionel Sambuc int	chm_compute(struct nbperf *);
58c75851fcSLionel Sambuc int	chm3_compute(struct nbperf *);
59*84d9c625SLionel Sambuc int	bpz_compute(struct nbperf *);
60