Optionally collect fuzzer statistics across runs - #9073
Open
tlively wants to merge 2 commits into
Open
Conversation
When a new BINARYEN_FUZZ_STATS environment variable is set, collect statistics about fuzzer patterns and events. Save these statistics to a file, where they can be accumulated and updated across several fuzzer runs. The API is designed to make it easy to add new patterns and events for one-off local experiments. Include sample patterns collecting frequencies of various cast instructions as an example.
tlively
force-pushed
the
fuzz-br-on-cast-more
branch
from
September 10, 2026 19:01
4816e63 to
fcdfa85
Compare
tlively
marked this pull request as ready for review
September 10, 2026 19:05
kripken
reviewed
Sep 10, 2026
| @@ -0,0 +1,323 @@ | |||
| /* | |||
| * Copyright 2024 WebAssembly Community Group participants | |||
Member
There was a problem hiding this comment.
Suggested change
| * Copyright 2024 WebAssembly Community Group participants | |
| * Copyright 2026 WebAssembly Community Group participants |
kripken
reviewed
Sep 10, 2026
| namespace { | ||
|
|
||
| struct FuzzStatsVisitor : public FuzzStats::Visitor<FuzzStatsVisitor> { | ||
| void visitBrOn(BrOn* curr) { |
Member
There was a problem hiding this comment.
Please comment as to why we collect these and not others.
| #define RECORD_EVENT(name, outcome) \ | ||
| ::wasm::FuzzStats::recordEvent((name), __FILE__, __LINE__, (outcome)) | ||
|
|
||
| #define RECORD_FUZZ_EVENT(name, outcome) RECORD_EVENT(name, outcome) |
Member
Author
There was a problem hiding this comment.
No one in the PR. I could add an example usage like we have for the patterns.
| const std::map<std::string, uint64_t>& funcMatches); | ||
|
|
||
| // CRTP base class for visitors that collect fuzzing pattern statistics. | ||
| template<typename SubType> struct Visitor : public PostWalker<SubType> { |
Member
There was a problem hiding this comment.
The name Visitor is maybe confusing. Walker is contrasted against Visitor in wasm-traversal.h (one visits one node, the other walks all the nodes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a new BINARYEN_FUZZ_STATS environment variable is set, collect statistics about fuzzer patterns and events. Save these statistics to a file, where they can be accumulated and updated across several fuzzer runs. The API is designed to make it easy to add new patterns and events for one-off local experiments. Include sample patterns collecting frequencies of various cast instructions as an example.