mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-01-12 16:52:57 +08:00
fix: enable profiling
This commit is contained in:
@@ -38,7 +38,7 @@ fxhash = "0.2.1"
|
||||
rusqlite = { version = "0.27.0", features = ["bundled"] }
|
||||
anyhow = { version = "1.0.56", features = ["backtrace"] }
|
||||
schemars = { version = "0.8.10", git = "https://github.com/hirosystems/schemars.git", branch = "feat-chainhook-fixes" }
|
||||
pprof = { version = "0.12", features = ["flamegraph"], optional = true }
|
||||
pprof = { version = "0.12", features = ["flamegraph"] }
|
||||
progressing = '3'
|
||||
|
||||
[dependencies.rocksdb]
|
||||
@@ -49,5 +49,5 @@ features = ["lz4", "snappy"]
|
||||
[features]
|
||||
default = ["cli"]
|
||||
cli = ["clap", "clap_generate", "toml", "ctrlc", "hiro-system-kit/log"]
|
||||
debug = ["hiro-system-kit/debug", "pprof"]
|
||||
debug = ["hiro-system-kit/debug"]
|
||||
release = ["hiro-system-kit/release"]
|
||||
|
||||
@@ -1856,11 +1856,11 @@ pub async fn rebuild_rocks_db(
|
||||
hord_config: &HordConfig,
|
||||
ctx: &Context,
|
||||
) -> Result<(), String> {
|
||||
// let guard = pprof::ProfilerGuardBuilder::default()
|
||||
// .frequency(20)
|
||||
// .blocklist(&["libc", "libgcc", "pthread", "vdso"])
|
||||
// .build()
|
||||
// .unwrap();
|
||||
let guard = pprof::ProfilerGuardBuilder::default()
|
||||
.frequency(20)
|
||||
.blocklist(&["libc", "libgcc", "pthread", "vdso"])
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
ctx.try_log(|logger| {
|
||||
slog::info!(logger, "Generating report");
|
||||
@@ -1982,21 +1982,21 @@ pub async fn rebuild_rocks_db(
|
||||
)
|
||||
});
|
||||
|
||||
// match guard.report().build() {
|
||||
// Ok(report) => {
|
||||
// ctx.try_log(|logger| {
|
||||
// slog::info!(logger, "Generating report");
|
||||
// });
|
||||
match guard.report().build() {
|
||||
Ok(report) => {
|
||||
ctx.try_log(|logger| {
|
||||
slog::info!(logger, "Generating report");
|
||||
});
|
||||
|
||||
// let file = File::create("hord-perf.svg").unwrap();
|
||||
// report.flamegraph(file).unwrap();
|
||||
// }
|
||||
// Err(e) => {
|
||||
// ctx.try_log(|logger| {
|
||||
// slog::error!(logger, "Reporting failed: {}", e.to_string());
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
let file = std::fs::File::create("hord-perf.svg").unwrap();
|
||||
report.flamegraph(file).unwrap();
|
||||
}
|
||||
Err(e) => {
|
||||
ctx.try_log(|logger| {
|
||||
slog::error!(logger, "Reporting failed: {}", e.to_string());
|
||||
});
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user