Lines Matching refs:nbperf

1 /*	$NetBSD: nbperf-bdz.c,v 1.12 2023/07/31 21:07:50 andvar Exp $	*/
39 __RCSID("$NetBSD: nbperf-bdz.c,v 1.12 2023/07/31 21:07:50 andvar Exp $");
47 #include "nbperf.h"
138 print_hash(struct nbperf *nbperf, struct state *state)
143 fprintf(nbperf->output, "#include <stdlib.h>\n");
144 fprintf(nbperf->output, "#include <strings.h>\n\n");
146 fprintf(nbperf->output, "%suint32_t\n",
147 nbperf->static_hash ? "static " : "");
148 fprintf(nbperf->output,
150 nbperf->hash_name);
151 fprintf(nbperf->output, "{\n");
153 fprintf(nbperf->output,
160 fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s",
168 fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s",
173 fprintf(nbperf->output, "%s\t};\n", (i % 2 ? "\n" : ""));
175 fprintf(nbperf->output,
182 fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s",
190 fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s",
195 fprintf(nbperf->output, "%s\t};\n", (i % 2 ? "\n" : ""));
197 fprintf(nbperf->output,
201 fprintf(nbperf->output, "%s0x%08" PRIx32 ",%s",
205 fprintf(nbperf->output, "%s\t};\n", (i / 65536 % 4 ? "\n" : ""));
207 fprintf(nbperf->output,
211 fprintf(nbperf->output, "%s0x%04" PRIx32 ",%s",
215 fprintf(nbperf->output, "%s\t};\n", (i / 64 % 4 ? "\n" : ""));
217 fprintf(nbperf->output, "\tuint64_t m;\n");
218 fprintf(nbperf->output, "\tuint32_t idx, i, idx2;\n");
219 fprintf(nbperf->output, "\tuint32_t h[%zu];\n\n", nbperf->hash_size);
221 (*nbperf->print_hash)(nbperf, "\t", "key", "keylen", "h");
223 fprintf(nbperf->output, "\n\th[0] = h[0] %% %" PRIu32 ";\n",
225 fprintf(nbperf->output, "\th[1] = h[1] %% %" PRIu32 ";\n",
227 fprintf(nbperf->output, "\th[2] = h[2] %% %" PRIu32 ";\n",
231 fprintf(nbperf->output, "\th[1] ^= (h[0] == h[1]);\n");
234 fprintf(nbperf->output,
236 fprintf(nbperf->output,
240 fprintf(nbperf->output,
249 fprintf(nbperf->output,
251 fprintf(nbperf->output,
257 fprintf(nbperf->output, "}\n");
259 if (nbperf->map_output != NULL) {
261 fprintf(nbperf->map_output, "%" PRIu32 "\n",
267 bpz_compute(struct nbperf *nbperf)
273 if (nbperf->c == 0)
274 nbperf->c = 1.24;
275 if (nbperf->c < 1.24)
277 if (nbperf->hash_size < 3)
280 (*nbperf->seed_hash)(nbperf);
281 e = nbperf->n;
282 v = nbperf->c * nbperf->n;
283 if (1.24 * nbperf->n > v)
287 if (nbperf->allow_hash_fudging)
303 if (SIZED2(_hash)(nbperf, &state.graph))
308 print_hash(nbperf, &state);