Skip to content

Conversation

edg-l
Copy link
Contributor

@edg-l edg-l commented Aug 12, 2025

Motivation

Logs are processed in another thread, add_log returns instantly (using a lock free queue)

// API

pub enum Value {
    Duration(Duration),
    Float(f64),
    Int(usize),
}

// add a log to be processed
pub fn add_log(label: impl Into<Cow<'static, str>>, value: Value);

// times until the guard is dropped, useful in multiple branch returning functions
let guard = perf_logger::add_time_till_drop("label"); 

guard.wrap_return(return expr)

Logs format:

"seconds_since_start | label | value | Value type description"

log saved to cwd at ethrex-perf-logs.log

Copy link

github-actions bot commented Aug 12, 2025

Lines of code report

Total lines added: 183
Total lines removed: 0
Total lines changed: 183

Detailed view
+--------------------------------------------------------+-------+------+
| File                                                   | Lines | Diff |
+--------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/ethrex.rs                            | 51    | +3   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/blockchain.rs                 | 814   | +21  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/payload.rs                    | 581   | +1   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/common/types/block.rs                    | 779   | +3   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/peer_handler.rs           | 735   | +1   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/connection/server.rs | 847   | +1   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/eth/transactions.rs  | 310   | +1   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync.rs                   | 680   | +1   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/engine/fork_choice.rs     | 358   | +2   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/engine/payload.rs         | 674   | +6   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/block.rs              | 458   | +15  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/transaction.rs        | 595   | +22  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/mempool.rs                | 42    | +1   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/rpc.rs                    | 550   | +2   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/perf-logger/src/lib.rs                   | 101   | +101 |
+--------------------------------------------------------+-------+------+
| ethrex/crates/storage/store.rs                         | 1474  | +2   |
+--------------------------------------------------------+-------+------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants