Skip to content

Commit f99b073

Browse files
author
Ludo Galabru
committed
fix: enable profiling
1 parent c371e74 commit f99b073

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

components/hord-cli/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fxhash = "0.2.1"
3838
rusqlite = { version = "0.27.0", features = ["bundled"] }
3939
anyhow = { version = "1.0.56", features = ["backtrace"] }
4040
schemars = { version = "0.8.10", git = "https://github.com/hirosystems/schemars.git", branch = "feat-chainhook-fixes" }
41-
pprof = { version = "0.12", features = ["flamegraph"], optional = true }
41+
pprof = { version = "0.12", features = ["flamegraph"] }
4242
progressing = '3'
4343

4444
[dependencies.rocksdb]
@@ -49,5 +49,5 @@ features = ["lz4", "snappy"]
4949
[features]
5050
default = ["cli"]
5151
cli = ["clap", "clap_generate", "toml", "ctrlc", "hiro-system-kit/log"]
52-
debug = ["hiro-system-kit/debug", "pprof"]
52+
debug = ["hiro-system-kit/debug"]
5353
release = ["hiro-system-kit/release"]

components/hord-cli/src/db/mod.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -1856,11 +1856,11 @@ pub async fn rebuild_rocks_db(
18561856
hord_config: &HordConfig,
18571857
ctx: &Context,
18581858
) -> Result<(), String> {
1859-
// let guard = pprof::ProfilerGuardBuilder::default()
1860-
// .frequency(20)
1861-
// .blocklist(&["libc", "libgcc", "pthread", "vdso"])
1862-
// .build()
1863-
// .unwrap();
1859+
let guard = pprof::ProfilerGuardBuilder::default()
1860+
.frequency(20)
1861+
.blocklist(&["libc", "libgcc", "pthread", "vdso"])
1862+
.build()
1863+
.unwrap();
18641864

18651865
ctx.try_log(|logger| {
18661866
slog::info!(logger, "Generating report");
@@ -1982,21 +1982,21 @@ pub async fn rebuild_rocks_db(
19821982
)
19831983
});
19841984

1985-
// match guard.report().build() {
1986-
// Ok(report) => {
1987-
// ctx.try_log(|logger| {
1988-
// slog::info!(logger, "Generating report");
1989-
// });
1990-
1991-
// let file = File::create("hord-perf.svg").unwrap();
1992-
// report.flamegraph(file).unwrap();
1993-
// }
1994-
// Err(e) => {
1995-
// ctx.try_log(|logger| {
1996-
// slog::error!(logger, "Reporting failed: {}", e.to_string());
1997-
// });
1998-
// }
1999-
// }
1985+
match guard.report().build() {
1986+
Ok(report) => {
1987+
ctx.try_log(|logger| {
1988+
slog::info!(logger, "Generating report");
1989+
});
1990+
1991+
let file = std::fs::File::create("hord-perf.svg").unwrap();
1992+
report.flamegraph(file).unwrap();
1993+
}
1994+
Err(e) => {
1995+
ctx.try_log(|logger| {
1996+
slog::error!(logger, "Reporting failed: {}", e.to_string());
1997+
});
1998+
}
1999+
}
20002000
return Ok(());
20012001
}
20022002

0 commit comments

Comments
 (0)