Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
avm_tx_corpus_analyzer.cpp File Reference

Analyzes the AVM fuzzer corpus to produce statistics on opcodes and enqueued calls. More...

#include "barretenberg/avm_fuzzer/fuzz_lib/control_flow.hpp"
#include "barretenberg/avm_fuzzer/fuzzer_lib.hpp"
#include "barretenberg/serialize/msgpack_impl.hpp"
#include "barretenberg/vm2/common/opcodes.hpp"
#include "barretenberg/vm2/simulation/lib/serialization.hpp"
#include <algorithm>
#include <cmath>
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <vector>

Go to the source code of this file.

Classes

struct  Stats
 
struct  MultiPhaseStats
 

Functions

Stats compute_stats (const std::vector< size_t > &values)
 
void count_opcodes (const std::vector< uint8_t > &bytecode, std::map< WireOpCode, size_t > &opcode_counts)
 
std::string opcode_name (WireOpCode opcode)
 
std::string histogram_bar (size_t count, size_t max_count, size_t max_width=40)
 
void print_opcode_histogram (const std::map< WireOpCode, size_t > &opcode_counts)
 
void print_enqueued_calls_stats (const Stats &setup, const Stats &app_logic, const Stats &teardown, const MultiPhaseStats &multi_phase)
 
int main (int argc, char **argv)
 

Detailed Description

Analyzes the AVM fuzzer corpus to produce statistics on opcodes and enqueued calls.

Usage: ./avm_tx_corpus_analyzer [corpus_path] corpus_path: Path to the corpus directory (default: corpus/tx relative to current dir)

Definition in file avm_tx_corpus_analyzer.cpp.

Function Documentation

◆ compute_stats()

Stats compute_stats ( const std::vector< size_t > &  values)

Definition at line 38 of file avm_tx_corpus_analyzer.cpp.

◆ count_opcodes()

void count_opcodes ( const std::vector< uint8_t > &  bytecode,
std::map< WireOpCode, size_t > &  opcode_counts 
)

Definition at line 78 of file avm_tx_corpus_analyzer.cpp.

◆ histogram_bar()

std::string histogram_bar ( size_t  count,
size_t  max_count,
size_t  max_width = 40 
)

Definition at line 102 of file avm_tx_corpus_analyzer.cpp.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 221 of file avm_tx_corpus_analyzer.cpp.

◆ opcode_name()

std::string opcode_name ( WireOpCode  opcode)

Definition at line 94 of file avm_tx_corpus_analyzer.cpp.

◆ print_enqueued_calls_stats()

void print_enqueued_calls_stats ( const Stats setup,
const Stats app_logic,
const Stats teardown,
const MultiPhaseStats multi_phase 
)

Definition at line 191 of file avm_tx_corpus_analyzer.cpp.

◆ print_opcode_histogram()

void print_opcode_histogram ( const std::map< WireOpCode, size_t > &  opcode_counts)

Definition at line 113 of file avm_tx_corpus_analyzer.cpp.