| author | |
| committer | |
| log | 6e6164f8a6c74c8ea5a87ac9961b491b9f89b780 |
| tree | 475ac823f86b7d22d8a93205eea4d24c15d972a2 |
| parent | f56d11350313d5e45be0679bd8fab2a96892c40c |
3 files changed, 16 insertions(+), 0 deletions(-)
lib/fuzzer/index.html+1| ... | ... | @@ -129,6 +129,7 @@ |
| 129 | 129 | <ul> |
| 130 | 130 | <li>Total Runs: <span id="statTotalRuns"></span></li> |
| 131 | 131 | <li>Unique Runs: <span id="statUniqueRuns"></span></li> |
| 132 | <li>Coverage: <span id="statCoverage"></span></li> | |
| 132 | 133 | <li>Lowest Stack: <span id="statLowestStack"></span></li> |
| 133 | 134 | </ul> |
| 134 | 135 | </div> |
lib/fuzzer/main.js+4| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | const domSourceText = document.getElementById("sourceText"); |
| 6 | 6 | const domStatTotalRuns = document.getElementById("statTotalRuns"); |
| 7 | 7 | const domStatUniqueRuns = document.getElementById("statUniqueRuns"); |
| 8 | const domStatCoverage = document.getElementById("statCoverage"); | |
| 8 | 9 | const domStatLowestStack = document.getElementById("statLowestStack"); |
| 9 | 10 | |
| 10 | 11 | let wasm_promise = fetch("main.wasm"); |
| ... | ... | @@ -112,8 +113,11 @@ |
| 112 | 113 | function renderStats() { |
| 113 | 114 | const totalRuns = wasm_exports.totalRuns(); |
| 114 | 115 | const uniqueRuns = wasm_exports.uniqueRuns(); |
| 116 | const totalSourceLocations = wasm_exports.totalSourceLocations(); | |
| 117 | const coveredSourceLocations = wasm_exports.coveredSourceLocations(); | |
| 115 | 118 | domStatTotalRuns.innerText = totalRuns; |
| 116 | 119 | domStatUniqueRuns.innerText = uniqueRuns + " (" + percent(uniqueRuns, totalRuns) + "%)"; |
| 120 | domStatCoverage.innerText = coveredSourceLocations + " / " + totalSourceLocations + " (" + percent(coveredSourceLocations, totalSourceLocations) + "%)"; | |
| 117 | 121 | domStatLowestStack.innerText = unwrapString(wasm_exports.lowestStack()); |
| 118 | 122 | |
| 119 | 123 | domSectStats.classList.remove("hidden"); |
lib/fuzzer/wasm/main.zig+11| ... | ... | @@ -110,6 +110,17 @@ export fn lowestStack() String { |
| 110 | 110 | return String.init(string_result.items); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | export fn totalSourceLocations() usize { | |
| 114 | return coverage_source_locations.items.len; | |
| 115 | } | |
| 116 | ||
| 117 | export fn coveredSourceLocations() usize { | |
| 118 | const covered_bits = recent_coverage_update.items[@sizeOf(abi.CoverageUpdateHeader)..]; | |
| 119 | var count: usize = 0; | |
| 120 | for (covered_bits) |byte| count += @popCount(byte); | |
| 121 | return count; | |
| 122 | } | |
| 123 | ||
| 113 | 124 | export fn totalRuns() u64 { |
| 114 | 125 | const header: *abi.CoverageUpdateHeader = @ptrCast(recent_coverage_update.items[0..@sizeOf(abi.CoverageUpdateHeader)]); |
| 115 | 126 | return header.n_runs; |