Lines Matching defs:nbperf
1 /* $NetBSD: nbperf.c,v 1.9 2024/09/22 20:34:26 christos Exp $ */
39 __RCSID("$NetBSD: nbperf.c,v 1.9 2024/09/22 20:34:26 christos Exp $");
51 #include "nbperf.h"
70 mi_vector_hash_seed_hash(struct nbperf *nbperf)
74 nbperf->seed[0] = predictable_counter++;
76 nbperf->seed[0] = arc4random();
80 mi_vector_hash_compute(struct nbperf *nbperf, const void *key, size_t keylen,
83 mi_vector_hash(key, keylen, nbperf->seed[0], hashes);
87 mi_vector_hash_print_hash(struct nbperf *nbperf, const char *indent,
90 fprintf(nbperf->output,
92 indent, key, keylen, nbperf->seed[0], hash);
96 set_hash(struct nbperf *nbperf, const char *arg)
99 nbperf->hash_size = 3;
100 nbperf->seed_hash = mi_vector_hash_seed_hash;
101 nbperf->compute_hash = mi_vector_hash_compute;
102 nbperf->print_hash = mi_vector_hash_print_hash;
105 if (nbperf->hash_size > NBPERF_MAX_HASH_SIZE)
113 struct nbperf nbperf = {
133 int (*build_hash)(struct nbperf *) = chm_compute;
135 set_hash(&nbperf, "mi_vector_hash");
153 nbperf.c = strtod(optarg, &eos);
154 if (errno || eos[0] || !nbperf.c)
158 nbperf.allow_hash_fudging = 1;
161 set_hash(&nbperf, optarg);
173 if (nbperf.map_output)
174 fclose(nbperf.map_output);
175 nbperf.map_output = fopen(optarg, "w");
176 if (nbperf.map_output == NULL)
180 nbperf.hash_name = optarg;
183 if (nbperf.output)
184 fclose(nbperf.output);
185 nbperf.output = fopen(optarg, "w");
186 if (nbperf.output == NULL)
193 nbperf.static_hash = 1;
213 if (nbperf.output == NULL)
214 nbperf.output = stdout;
244 nbperf.n = curlen;
245 nbperf.keys = keys;
246 nbperf.keylens = keylens;
251 rv = (*build_hash)(&nbperf);
254 if (nbperf.has_duplicates) {
260 nbperf.check_duplicates = 1;