Skip to content

Commit

Permalink
Make distribution diagrams stop splitting report lines
Browse files Browse the repository at this point in the history
  • Loading branch information
fwojcik committed Dec 9, 2023
1 parent addcede commit 7ba2801
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 1 addition & 2 deletions util/Analyze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,7 @@ static bool TestDistribution( std::vector<hashtype> & hashes, std::vector<hidx_t
}

if (!REPORT(QUIET, reportFlags)) {
printf("Testing distribution (any %2i..%2i bits)%s", minwidth, maxwidth,
REPORT(DIAGRAMS, reportFlags) ? "\n[" : " - ");
printf("Testing distribution (any %2i..%2i bits) - ", minwidth, maxwidth);
}

std::vector<double> scores(hashbits * (maxwidth - minwidth + 1));
Expand Down
15 changes: 11 additions & 4 deletions util/Reporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,16 +716,12 @@ bool ReportDistribution( const std::vector<double> & scores, int tests, int hash
for (int width = maxwidth; width >= minwidth; width--) {
double n = *worstptr++;

if (REPORT(DIAGRAMS, flags)) { plot(GetStdNormalPValue(n), tests); }

if (worstN <= n) {
worstN = n;
worstWidth = width;
worstStart = startbit;
}
}

if (REPORT(DIAGRAMS, flags)) { printf("]\n%s", ((startbit + 1) == hashbits) ? "" : "["); }
}

addVCodeResult((uint32_t)worstN);
Expand Down Expand Up @@ -782,5 +778,16 @@ bool ReportDistribution( const std::vector<double> & scores, int tests, int hash
}
}

if (REPORT(DIAGRAMS, flags)) {
printf("[");
for (int startbit = 0; startbit < hashbits; startbit++) {
const double * worstptr = &scores[startbit * (maxwidth - minwidth + 1)];
for (int width = maxwidth; width >= minwidth; width--) {
plot(GetStdNormalPValue(*worstptr++), tests);
}
printf("]\n%s", ((startbit + 1) == hashbits) ? "" : "[");
}
}

return !failure;
}

0 comments on commit 7ba2801

Please sign in to comment.