Skip to content

Commit a299334

Browse files
committed
Report to include smoketest warning and colour codes
1 parent c5befb3 commit a299334

File tree

1 file changed

+78
-9
lines changed

1 file changed

+78
-9
lines changed

report.sh

Lines changed: 78 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,23 @@ CHRONICLE_VERSION=$(get_version "chronicle-map.version")
9696
# Get benchmark date (before cd)
9797
BENCH_DATE=$(stat -c %y "$WORK_DIR/out-1.json" | cut -d' ' -f1)
9898

99+
# Detect benchmark mode by checking warmup iterations in the JSON
100+
WARMUP_ITERATIONS=$(jq -r '.[0].warmupIterations' "$WORK_DIR/out-1.json")
101+
if [ "$WARMUP_ITERATIONS" = "0" ]; then
102+
BENCH_MODE="smoketest"
103+
else
104+
BENCH_MODE="benchmark"
105+
fi
106+
99107
# Change to working directory to generate all files there
100108
cd "$WORK_DIR"
101109

110+
echo "Benchmark Mode: $BENCH_MODE"
111+
if [ "$BENCH_MODE" = "smoketest" ]; then
112+
echo " WARNING: Smoketest results are for verification only, not performance comparison"
113+
fi
114+
echo ""
115+
102116
echo "System Information:"
103117
echo " CPU: $CPU_MODEL (${CPU_COUNT} cores)"
104118
echo " RAM: ${RAM_GB} GB"
@@ -129,6 +143,26 @@ available to Java applications. The benchmark tests various workload sizes with
129143
RAM-based auto-scaling (capped at 1 million entries), testing different value
130144
sizes, access patterns, and implementation-specific configurations.
131145
146+
EOF
147+
148+
# Add smoketest warning if applicable
149+
if [ "$BENCH_MODE" = "smoketest" ]; then
150+
cat >> README.md <<'EOF'
151+
> **⚠️ SMOKETEST RESULTS**
152+
>
153+
> This report was generated from a **smoketest run** and should NOT be used for
154+
> performance comparisons or production decisions. Smoketest results have:
155+
> - **No warmup iterations** (JVM not optimized)
156+
> - **Single iteration** (no statistical validity)
157+
> - **Minimal entry counts** (1K entries only)
158+
> - **Short runtime** (quick verification only)
159+
>
160+
> For valid performance results, run `./run.sh benchmark` instead.
161+
162+
EOF
163+
fi
164+
165+
cat >> README.md <<EOF
132166
## Methodology
133167
134168
The benchmark was executed on ${BENCH_DATE} using
@@ -201,7 +235,20 @@ jq -r '.[] | select(.benchmark | contains("LmdbJavaByteBuffer")) |
201235
(if .params.forceSafe == "true" then "safe" else "unsafe" end) as $label |
202236
"\($bench)-\($label) \(.primaryMetric.score)"' out-1.json | sort > 1-forceSafe-reads.dat
203237

204-
# Create gnuplot script for forceSafe
238+
# Add color codes to the forceSafe data based on benchmark type
239+
awk '{
240+
bench = $1;
241+
value = $2;
242+
if (bench ~ /^readCrc-/) color = "0xe41a1c";
243+
else if (bench ~ /^readKey-/) color = "0x984ea3";
244+
else if (bench ~ /^readRev-/) color = "0xffff33";
245+
else if (bench ~ /^readSeq-/) color = "0x377eb8";
246+
else if (bench ~ /^readXxh32-/) color = "0x4daf4a";
247+
else color = "0x000000";
248+
print bench, value, color;
249+
}' 1-forceSafe-reads.dat > 1-forceSafe-colored.dat
250+
251+
# Create gnuplot script for forceSafe with individual colors per bar
205252
cat > 1-forceSafe.gnuplot <<'GNUPLOT'
206253
set terminal svg size 800,600
207254
set output '1-forceSafe-reads.svg'
@@ -212,11 +259,11 @@ set style fill solid 0.25 border
212259
set boxwidth 0.5
213260
set xtics nomirror rotate by -270
214261
set grid y
215-
plot '1-forceSafe-reads.dat' using 2:xtic(1) with boxes notitle
262+
plot '1-forceSafe-colored.dat' using 0:2:3:xtic(1) with boxes lc rgbcolor variable notitle
216263
GNUPLOT
217264

218265
gnuplot 1-forceSafe.gnuplot
219-
rm 1-forceSafe.gnuplot
266+
rm -f 1-forceSafe.gnuplot 1-forceSafe-colored.dat
220267

221268
echo " Generated 1-forceSafe-reads.svg"
222269

@@ -245,7 +292,7 @@ set style fill solid 0.25 border
245292
set boxwidth 0.5
246293
set xtics nomirror rotate by -270
247294
set grid y
248-
plot '1-sync-writes.dat' using 4:xticlabels(sprintf("%s %s %s", stringcolumn(1), stringcolumn(2), stringcolumn(3))) with boxes notitle
295+
plot '1-sync-writes.dat' using 4:xticlabels(sprintf("%s %s %s", stringcolumn(1), stringcolumn(2), stringcolumn(3))) with boxes lc rgb "#ff7f00" notitle
249296
GNUPLOT
250297

251298
gnuplot 1-sync.gnuplot
@@ -278,7 +325,7 @@ set style fill solid 0.25 border
278325
set boxwidth 0.5
279326
set xtics nomirror rotate by -270
280327
set grid y
281-
plot '1-writeMap-writes.dat' using 4:xticlabels(sprintf("%s %s %s", stringcolumn(1), stringcolumn(2), stringcolumn(3))) with boxes notitle
328+
plot '1-writeMap-writes.dat' using 4:xticlabels(sprintf("%s %s %s", stringcolumn(1), stringcolumn(2), stringcolumn(3))) with boxes lc rgb "#ff7f00" notitle
282329
GNUPLOT
283330

284331
gnuplot 1-writeMap.gnuplot
@@ -408,7 +455,7 @@ set style fill solid 0.25 border
408455
set boxwidth 0.5
409456
set xtics nomirror rotate by -270
410457
set grid y
411-
plot '3-batchSize-writes.dat' using 3:xticlabels(sprintf("%s %s", stringcolumn(1), stringcolumn(2))) with boxes notitle
458+
plot '3-batchSize-writes.dat' using 3:xticlabels(sprintf("%s %s", stringcolumn(1), stringcolumn(2))) with boxes lc rgb "#ff7f00" notitle
412459
GNUPLOT
413460

414461
gnuplot 3-batchSize.gnuplot
@@ -1517,12 +1564,29 @@ cat > index.html <<'HTML'
15171564
</style>
15181565
</head>
15191566
<body>
1520-
<div id="content"></div>
1567+
<div id="content">Loading report...</div>
15211568
<script>
15221569
fetch('README.md')
1523-
.then(response => response.text())
1570+
.then(response => {
1571+
if (!response.ok) throw new Error('Failed to load README.md');
1572+
return response.text();
1573+
})
15241574
.then(text => {
15251575
document.getElementById('content').innerHTML = marked.parse(text);
1576+
})
1577+
.catch(error => {
1578+
document.getElementById('content').innerHTML =
1579+
'<div style="padding: 40px; background: #fff3cd; border: 2px solid #856404; border-radius: 8px;">' +
1580+
'<h2 style="color: #856404; margin-top: 0;">⚠️ Cannot Load Report</h2>' +
1581+
'<p>The report cannot be loaded when opening <code>index.html</code> directly as a file.</p>' +
1582+
'<p><strong>To view this report, run a local web server:</strong></p>' +
1583+
'<pre style="background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto;">' +
1584+
'cd target/benchmark\n' +
1585+
'python3 -m http.server 8000\n' +
1586+
'</pre>' +
1587+
'<p>Then open <a href="http://localhost:8000">http://localhost:8000</a> in your browser</p>' +
1588+
'<p style="margin-top: 30px;"><strong>Alternatively:</strong> View <code>README.md</code> directly in any markdown viewer or on GitHub</p>' +
1589+
'</div>';
15261590
});
15271591
</script>
15281592
</body>
@@ -1558,7 +1622,12 @@ echo " - 6-size-16368.svg and 6-size-16368.md"
15581622
echo " - 6-intKey-rnd-16368.svg"
15591623
echo " - summary.svg"
15601624
echo ""
1561-
echo "To view the report, open $WORK_DIR/index.html in your web browser"
1625+
echo "To view the HTML report:"
1626+
echo " cd $WORK_DIR"
1627+
echo " python3 -m http.server 8000"
1628+
echo " Then open http://localhost:8000 in your browser"
1629+
echo ""
1630+
echo "Alternatively, view README.md directly in your markdown viewer"
15621631
echo ""
15631632
echo "IMPORTANT: The generated README.md is a template based on the benchmark data."
15641633
echo "Please review it carefully for correctness and adjust the commentary as needed"

0 commit comments

Comments
 (0)