Skip to content

Commit

Permalink
Merge branch 'main' into breaking-enha-rocksdb
Browse files Browse the repository at this point in the history
  • Loading branch information
carneiro-cw authored Dec 17, 2024
2 parents 4fc58a0 + 17aacb7 commit bb81337
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ metrics = ["dep:metrics-exporter-prometheus"]
# Enable runtime tracing/spans collection.
tracing = []

# Changes to help us generate our flamegraphs
flamegraph = []

# Use Jemalloc as the global allocator
jemalloc = ["dep:tikv-jemallocator"]

Expand Down
12 changes: 10 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,20 @@ impl CommonConfig {
// identify async threads
let async_id = ASYNC_ID.fetch_add(1, Ordering::SeqCst);
if async_id <= num_async_threads {
return format!("tokio-async-{}", async_id);
if cfg!(feature = "flamegraph") {
return "tokio-async".to_string();
} else {
return format!("tokio-async-{}", async_id);
}
}

// identify blocking threads
let blocking_id = BLOCKING_ID.fetch_add(1, Ordering::SeqCst);
format!("tokio-blocking-{}", blocking_id)
if cfg!(feature = "flamegraph") {
"tokio-blocking".to_string()
} else {
format!("tokio-blocking-{}", blocking_id)
}
})
.build();

Expand Down

0 comments on commit bb81337

Please sign in to comment.