usr.bin/nbperf/graph2.c
105
SIZED2(_check_duplicates)(struct nbperf *nbperf, struct SIZED(graph) *graph)
usr.bin/nbperf/graph2.c
115
sorting_nbperf = nbperf;
usr.bin/nbperf/graph2.c
130
nbperf->has_duplicates = 1;
usr.bin/nbperf/graph2.c
176
SIZED2(_hash)(struct nbperf *nbperf, struct SIZED(graph) *graph)
usr.bin/nbperf/graph2.c
183
if (nbperf->allow_hash_fudging && (graph->v & 1) != 0)
usr.bin/nbperf/graph2.c
186
if (nbperf->allow_hash_fudging && (graph->v & 3) != 0)
usr.bin/nbperf/graph2.c
195
(*nbperf->compute_hash)(nbperf,
usr.bin/nbperf/graph2.c
196
nbperf->keys[i], nbperf->keylens[i], hashes);
usr.bin/nbperf/graph2.c
201
if (!nbperf->allow_hash_fudging)
usr.bin/nbperf/graph2.c
209
if (!nbperf->allow_hash_fudging)
usr.bin/nbperf/graph2.c
223
if (nbperf->check_duplicates) {
usr.bin/nbperf/graph2.c
224
nbperf->check_duplicates = 0;
usr.bin/nbperf/graph2.c
225
return SIZED2(_check_duplicates)(nbperf, graph);
usr.bin/nbperf/graph2.c
77
static struct nbperf *sorting_nbperf;
usr.bin/nbperf/graph2.h
87
int SIZED2(_hash)(struct nbperf *, struct SIZED(graph) *);
usr.bin/nbperf/nbperf-bdz.c
138
print_hash(struct nbperf *nbperf, struct state *state)
usr.bin/nbperf/nbperf-bdz.c
143
fprintf(nbperf->output, "#include <stdlib.h>\n");
usr.bin/nbperf/nbperf-bdz.c
144
fprintf(nbperf->output, "#include <strings.h>\n\n");
usr.bin/nbperf/nbperf-bdz.c
146
fprintf(nbperf->output, "%suint32_t\n",
usr.bin/nbperf/nbperf-bdz.c
147
nbperf->static_hash ? "static " : "");
usr.bin/nbperf/nbperf-bdz.c
148
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
150
nbperf->hash_name);
usr.bin/nbperf/nbperf-bdz.c
151
fprintf(nbperf->output, "{\n");
usr.bin/nbperf/nbperf-bdz.c
153
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
160
fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s",
usr.bin/nbperf/nbperf-bdz.c
168
fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s",
usr.bin/nbperf/nbperf-bdz.c
173
fprintf(nbperf->output, "%s\t};\n", (i % 2 ? "\n" : ""));
usr.bin/nbperf/nbperf-bdz.c
175
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
182
fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s",
usr.bin/nbperf/nbperf-bdz.c
190
fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s",
usr.bin/nbperf/nbperf-bdz.c
195
fprintf(nbperf->output, "%s\t};\n", (i % 2 ? "\n" : ""));
usr.bin/nbperf/nbperf-bdz.c
197
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
201
fprintf(nbperf->output, "%s0x%08" PRIx32 ",%s",
usr.bin/nbperf/nbperf-bdz.c
205
fprintf(nbperf->output, "%s\t};\n", (i / 65536 % 4 ? "\n" : ""));
usr.bin/nbperf/nbperf-bdz.c
207
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
211
fprintf(nbperf->output, "%s0x%04" PRIx32 ",%s",
usr.bin/nbperf/nbperf-bdz.c
215
fprintf(nbperf->output, "%s\t};\n", (i / 64 % 4 ? "\n" : ""));
usr.bin/nbperf/nbperf-bdz.c
217
fprintf(nbperf->output, "\tuint64_t m;\n");
usr.bin/nbperf/nbperf-bdz.c
218
fprintf(nbperf->output, "\tuint32_t idx, i, idx2;\n");
usr.bin/nbperf/nbperf-bdz.c
219
fprintf(nbperf->output, "\tuint32_t h[%zu];\n\n", nbperf->hash_size);
usr.bin/nbperf/nbperf-bdz.c
221
(*nbperf->print_hash)(nbperf, "\t", "key", "keylen", "h");
usr.bin/nbperf/nbperf-bdz.c
223
fprintf(nbperf->output, "\n\th[0] = h[0] %% %" PRIu32 ";\n",
usr.bin/nbperf/nbperf-bdz.c
225
fprintf(nbperf->output, "\th[1] = h[1] %% %" PRIu32 ";\n",
usr.bin/nbperf/nbperf-bdz.c
227
fprintf(nbperf->output, "\th[2] = h[2] %% %" PRIu32 ";\n",
usr.bin/nbperf/nbperf-bdz.c
231
fprintf(nbperf->output, "\th[1] ^= (h[0] == h[1]);\n");
usr.bin/nbperf/nbperf-bdz.c
234
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
236
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
240
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
249
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
251
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-bdz.c
257
fprintf(nbperf->output, "}\n");
usr.bin/nbperf/nbperf-bdz.c
259
if (nbperf->map_output != NULL) {
usr.bin/nbperf/nbperf-bdz.c
261
fprintf(nbperf->map_output, "%" PRIu32 "\n",
usr.bin/nbperf/nbperf-bdz.c
267
bpz_compute(struct nbperf *nbperf)
usr.bin/nbperf/nbperf-bdz.c
273
if (nbperf->c == 0)
usr.bin/nbperf/nbperf-bdz.c
274
nbperf->c = 1.24;
usr.bin/nbperf/nbperf-bdz.c
275
if (nbperf->c < 1.24)
usr.bin/nbperf/nbperf-bdz.c
277
if (nbperf->hash_size < 3)
usr.bin/nbperf/nbperf-bdz.c
280
(*nbperf->seed_hash)(nbperf);
usr.bin/nbperf/nbperf-bdz.c
281
e = nbperf->n;
usr.bin/nbperf/nbperf-bdz.c
282
v = nbperf->c * nbperf->n;
usr.bin/nbperf/nbperf-bdz.c
283
if (1.24 * nbperf->n > v)
usr.bin/nbperf/nbperf-bdz.c
287
if (nbperf->allow_hash_fudging)
usr.bin/nbperf/nbperf-bdz.c
303
if (SIZED2(_hash)(nbperf, &state.graph))
usr.bin/nbperf/nbperf-bdz.c
308
print_hash(nbperf, &state);
usr.bin/nbperf/nbperf-chm.c
147
print_hash(struct nbperf *nbperf, struct state *state)
usr.bin/nbperf/nbperf-chm.c
153
fprintf(nbperf->output, "#include <stdlib.h>\n\n");
usr.bin/nbperf/nbperf-chm.c
155
fprintf(nbperf->output, "%suint32_t\n",
usr.bin/nbperf/nbperf-chm.c
156
nbperf->static_hash ? "static " : "");
usr.bin/nbperf/nbperf-chm.c
157
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-chm.c
159
nbperf->hash_name);
usr.bin/nbperf/nbperf-chm.c
160
fprintf(nbperf->output, "{\n");
usr.bin/nbperf/nbperf-chm.c
174
fprintf(nbperf->output, "\tstatic const %s g[%" PRId32 "] = {\n",
usr.bin/nbperf/nbperf-chm.c
177
fprintf(nbperf->output, "%s0x%0*" PRIx32 ",%s",
usr.bin/nbperf/nbperf-chm.c
183
fprintf(nbperf->output, "\n\t};\n");
usr.bin/nbperf/nbperf-chm.c
185
fprintf(nbperf->output, "\t};\n");
usr.bin/nbperf/nbperf-chm.c
186
fprintf(nbperf->output, "\tuint32_t h[%zu];\n\n", nbperf->hash_size);
usr.bin/nbperf/nbperf-chm.c
187
(*nbperf->print_hash)(nbperf, "\t", "key", "keylen", "h");
usr.bin/nbperf/nbperf-chm.c
189
fprintf(nbperf->output, "\n\th[0] = h[0] %% %" PRIu32 ";\n",
usr.bin/nbperf/nbperf-chm.c
191
fprintf(nbperf->output, "\th[1] = h[1] %% %" PRIu32 ";\n",
usr.bin/nbperf/nbperf-chm.c
194
fprintf(nbperf->output, "\th[2] = h[2] %% %" PRIu32 ";\n",
usr.bin/nbperf/nbperf-chm.c
199
fprintf(nbperf->output, "\th[1] ^= (h[0] == h[1]);\n");
usr.bin/nbperf/nbperf-chm.c
203
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-chm.c
205
fprintf(nbperf->output,
usr.bin/nbperf/nbperf-chm.c
211
fprintf(nbperf->output, "\treturn (g[h[0]] + g[h[1]] + g[h[2]]) %% "
usr.bin/nbperf/nbperf-chm.c
214
fprintf(nbperf->output, "\treturn (g[h[0]] + g[h[1]]) %% "
usr.bin/nbperf/nbperf-chm.c
217
fprintf(nbperf->output, "}\n");
usr.bin/nbperf/nbperf-chm.c
219
if (nbperf->map_output != NULL) {
usr.bin/nbperf/nbperf-chm.c
221
fprintf(nbperf->map_output, "%" PRIu32 "\n", i);
usr.bin/nbperf/nbperf-chm.c
227
chm3_compute(struct nbperf *nbperf)
usr.bin/nbperf/nbperf-chm.c
229
chm_compute(struct nbperf *nbperf)
usr.bin/nbperf/nbperf-chm.c
237
if (nbperf->c == 0)
usr.bin/nbperf/nbperf-chm.c
238
nbperf-> c = 1.24;
usr.bin/nbperf/nbperf-chm.c
240
if (nbperf->c < 1.24)
usr.bin/nbperf/nbperf-chm.c
243
if (nbperf->hash_size < 3)
usr.bin/nbperf/nbperf-chm.c
246
if (nbperf->c == 0)
usr.bin/nbperf/nbperf-chm.c
247
nbperf-> c = 2;
usr.bin/nbperf/nbperf-chm.c
249
if (nbperf->c < 2)
usr.bin/nbperf/nbperf-chm.c
252
if (nbperf->hash_size < 2)
usr.bin/nbperf/nbperf-chm.c
256
(*nbperf->seed_hash)(nbperf);
usr.bin/nbperf/nbperf-chm.c
257
e = nbperf->n;
usr.bin/nbperf/nbperf-chm.c
258
v = nbperf->c * nbperf->n;
usr.bin/nbperf/nbperf-chm.c
260
if (v == 1.24 * nbperf->n)
usr.bin/nbperf/nbperf-chm.c
264
if (nbperf->allow_hash_fudging)
usr.bin/nbperf/nbperf-chm.c
267
if (v == 2 * nbperf->n)
usr.bin/nbperf/nbperf-chm.c
269
if (nbperf->allow_hash_fudging)
usr.bin/nbperf/nbperf-chm.c
279
if (SIZED2(_hash)(nbperf, &state.graph))
usr.bin/nbperf/nbperf-chm.c
284
print_hash(nbperf, &state);
usr.bin/nbperf/nbperf.c
100
nbperf->seed_hash = mi_vector_hash_seed_hash;
usr.bin/nbperf/nbperf.c
101
nbperf->compute_hash = mi_vector_hash_compute;
usr.bin/nbperf/nbperf.c
102
nbperf->print_hash = mi_vector_hash_print_hash;
usr.bin/nbperf/nbperf.c
105
if (nbperf->hash_size > NBPERF_MAX_HASH_SIZE)
usr.bin/nbperf/nbperf.c
113
struct nbperf nbperf = {
usr.bin/nbperf/nbperf.c
133
int (*build_hash)(struct nbperf *) = chm_compute;
usr.bin/nbperf/nbperf.c
135
set_hash(&nbperf, "mi_vector_hash");
usr.bin/nbperf/nbperf.c
153
nbperf.c = strtod(optarg, &eos);
usr.bin/nbperf/nbperf.c
154
if (errno || eos[0] || !nbperf.c)
usr.bin/nbperf/nbperf.c
158
nbperf.allow_hash_fudging = 1;
usr.bin/nbperf/nbperf.c
161
set_hash(&nbperf, optarg);
usr.bin/nbperf/nbperf.c
173
if (nbperf.map_output)
usr.bin/nbperf/nbperf.c
174
fclose(nbperf.map_output);
usr.bin/nbperf/nbperf.c
175
nbperf.map_output = fopen(optarg, "w");
usr.bin/nbperf/nbperf.c
176
if (nbperf.map_output == NULL)
usr.bin/nbperf/nbperf.c
180
nbperf.hash_name = optarg;
usr.bin/nbperf/nbperf.c
183
if (nbperf.output)
usr.bin/nbperf/nbperf.c
184
fclose(nbperf.output);
usr.bin/nbperf/nbperf.c
185
nbperf.output = fopen(optarg, "w");
usr.bin/nbperf/nbperf.c
186
if (nbperf.output == NULL)
usr.bin/nbperf/nbperf.c
193
nbperf.static_hash = 1;
usr.bin/nbperf/nbperf.c
213
if (nbperf.output == NULL)
usr.bin/nbperf/nbperf.c
214
nbperf.output = stdout;
usr.bin/nbperf/nbperf.c
244
nbperf.n = curlen;
usr.bin/nbperf/nbperf.c
245
nbperf.keys = keys;
usr.bin/nbperf/nbperf.c
246
nbperf.keylens = keylens;
usr.bin/nbperf/nbperf.c
251
rv = (*build_hash)(&nbperf);
usr.bin/nbperf/nbperf.c
254
if (nbperf.has_duplicates) {
usr.bin/nbperf/nbperf.c
260
nbperf.check_duplicates = 1;
usr.bin/nbperf/nbperf.c
70
mi_vector_hash_seed_hash(struct nbperf *nbperf)
usr.bin/nbperf/nbperf.c
74
nbperf->seed[0] = predictable_counter++;
usr.bin/nbperf/nbperf.c
76
nbperf->seed[0] = arc4random();
usr.bin/nbperf/nbperf.c
80
mi_vector_hash_compute(struct nbperf *nbperf, const void *key, size_t keylen,
usr.bin/nbperf/nbperf.c
83
mi_vector_hash(key, keylen, nbperf->seed[0], hashes);
usr.bin/nbperf/nbperf.c
87
mi_vector_hash_print_hash(struct nbperf *nbperf, const char *indent,
usr.bin/nbperf/nbperf.c
90
fprintf(nbperf->output,
usr.bin/nbperf/nbperf.c
92
indent, key, keylen, nbperf->seed[0], hash);
usr.bin/nbperf/nbperf.c
96
set_hash(struct nbperf *nbperf, const char *arg)
usr.bin/nbperf/nbperf.c
99
nbperf->hash_size = 3;
usr.bin/nbperf/nbperf.h
50
void (*seed_hash)(struct nbperf *);
usr.bin/nbperf/nbperf.h
51
void (*print_hash)(struct nbperf *, const char *, const char *, const char *,
usr.bin/nbperf/nbperf.h
53
void (*compute_hash)(struct nbperf *, const void *, size_t,
usr.bin/nbperf/nbperf.h
58
int chm_compute(struct nbperf *);
usr.bin/nbperf/nbperf.h
59
int chm3_compute(struct nbperf *);
usr.bin/nbperf/nbperf.h
60
int bpz_compute(struct nbperf *);