starcoinorg / starcoin

Starcoin - A Move smart contract blockchain network that scales by layering
Apache License 2.0
1.37k stars 288 forks source link

bench_storage.rs use crate pprof-rs error #2986

Closed nkysg closed 2 years ago

nkysg commented 2 years ago

I use crate pprof-rs to bench_storage.rs in branch pprof-rs with commit 57a713 。 produce this is the error

warning: `benchmarks` (bench "bench_storage") generated 1 warning
    Finished bench [optimized] target(s) in 0.74s
     Running unittests (/Users/yesonggao/starcoin.comment/target/release/deps/bench_storage-0f5fb700537357ac)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
Benchmarking accumulator_append: Profiling for 10.000 s2021-10-26T15:40:18.400545+08:00 INFO pprof::profiler::/Users/yesonggao/.cargo/registry/src/github.com-1ecc6299db9ec823/pprof-0.4.4/src/profiler.rs::164 - starting cpu profiler
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: write batch db error: IO error: No such file or directory: While open a file for appending: /var/folders/yw/g0zm8vb56ls0j8nk2vzjw1br0000gn/T/f8e93e0bf20b2812536cddb355f52c4f/starcoindb/000038.log: No such file or directory, prefix_name acc_node_transaction', benchmarks/benches/bench_storage.rs:62:31
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

2021-10-26T15:40:24.892888+08:00 INFO pprof::profiler::/Users/yesonggao/.cargo/registry/src/github.com-1ecc6299db9ec823/pprof-0.4.4/src/profiler.rs::184 - stopping cpu profiler
error: bench failed

if use storage_transaction https://github.com/starcoinorg/starcoin/blob/pprof-rs/benchmarks/benches/bench_storage.rs#L78 can correct work this is the log

yesonggao@MacBook-Pro benchmarks % cargo bench --bench bench_storage -- --profile-time=10
   Compiling benchmarks v1.8.0-alpha (/Users/yesonggao/starcoin.comment/benchmarks)
warning: function is never used: `accumulator_append`
  --> benchmarks/benches/bench_storage.rs:37:4
   |
37 | fn accumulator_append(c: &mut Criterion) {
   |    ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: function is never used: `create_leaves`
  --> benchmarks/benches/bench_storage.rs:69:4
   |
69 | fn create_leaves(nums: std::ops::Range<usize>) -> Vec<HashValue> {
   |    ^^^^^^^^^^^^^

warning: `benchmarks` (bench "bench_storage") generated 2 warnings
    Finished bench [optimized] target(s) in 5.09s
     Running unittests (/Users/yesonggao/starcoin.comment/target/release/deps/bench_storage-0f5fb700537357ac)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
Benchmarking storage_transaction: Profiling for 10.000 s2021-10-26T16:02:24.446710+08:00 INFO pprof::profiler::/Users/yesonggao/.cargo/registry/src/github.com-1ecc6299db9ec823/pprof-0.4.4/src/profiler.rs::164 - starting cpu profiler
2021-10-26T16:02:36.038639+08:00 INFO pprof::profiler::/Users/yesonggao/.cargo/registry/src/github.com-1ecc6299db9ec823/pprof-0.4.4/src/profiler.rs::184 - stopping cpu profiler
Benchmarking storage_transaction: Complete (Analysis Disabled)
nkysg commented 2 years ago

@jolestar 帮忙看下

nkysg commented 2 years ago

jolestar思路"难道是并发问题?schema 还没建好就开始写了?",我看下criterion文档有没有相关信息

jolestar commented 2 years ago

the temp path lifetime problem, see this commit https://github.com/starcoinorg/starcoin/commit/7d03efaa0e5710c65b464855132a008bdbbcd93d