Skip to content

tracing: Add an output stream overload for InstructionCounter - #1769

Open
yx-ren wants to merge 1 commit into
ipsilon:masterfrom
yx-ren:tracing/instruction-counter-stream
Open

yx-ren wants to merge 1 commit into
ipsilon:masterfrom
yx-ren:tracing/instruction-counter-stream

Conversation

@yx-ren

@yx-ren yx-ren commented Oct 20, 2026 •

Copy link
Copy Markdown

InstructionCounter currently requires a file path, so callers need a temporary file to capture its JSON report. Add an std::ostream& overload, matching the other built-in tracer factories, while retaining the existing path overload and destructor-time output.

Both destinations share the same serialization. Counts remain decimal JSON numbers even when the supplied stream uses hexadecimal formatting, without changing the caller's formatting flags. The supplied stream must outlive the tracer.

Tests cover deferred output, empty reports, aggregation across executions, hexadecimal stream flags, and VM destruction. The tracing fixture removes tracers before its output stream is destroyed.

Validation:

  • Debug build: cmake --build build/debug --target evmone-unittests evmone-cli --parallel 6.
  • ctest --test-dir build/debug --output-on-failure -R '/tracing\.|t8n/cancun_create_tx': all 28 tests passed, including the existing file-output integration test.
  • clang-format --dry-run --Werror on the three changed files.

CircleCI's clang-latest-sanitizers, fuzzing, and clang-tidy runner jobs were blocked before execution with oss-fork-on-runner ("Forked prs not allowed to run on OSS projects").

Allow callers to capture opcode counts without a temporary file. Keep the path overload and report on destruction, preserving decimal JSON output without modifying the supplied stream formatting.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant