Skip to content

SIGTRAP With Criterion and Flamegraph Features #237

Open
@ShiromMakkad

Description

@ShiromMakkad

I found this crate from this article: https://www.jibbow.com/posts/criterion-flamegraphs/, which it seems you've implemented as the criterion feature flag. I've found a bug and tested it on both the example code from the article and the criterion feature flag and I'm getting the same issue.

Here's the error:

Benchmarking is_authorized/10: Profiling for 5.0000 serror: bench failed, to rerun pass `--bench is_authorized`

Caused by:
  process didn't exit successfully: `/Users/smakkad/local workplace/local_agent/cedar-local-agent/target/release/deps/is_authorized-0aa3e8a693af2a5a --profile-time 5 --bench` (signal: 5, SIGTRAP: trace/breakpoint trap)

And my code:

const NUM_POLICIES_ARR: [u32; 3] = [10, 100, 1000];

fn is_authorized_benchmark(c: &mut Criterion) {
    let mut bench_group = c.benchmark_group("is_authorized");
    for i in NUM_POLICIES_ARR.iter() {
        let authorizer: Authorizer<PolicySetProvider, EntityProvider> = construct_authorizer(*i);
        let request = construct_request();
        validate_request(&authorizer, &request);

        let input = (request, Entities::empty());
        bench_group.bench_with_input(BenchmarkId::from_parameter(i), &input, |b, i| {
            let (request, entities) = i;
            b.to_async(tokio::runtime::Runtime::new().unwrap())
                .iter(|| async { authorizer.is_authorized(request, entities).await.unwrap() })
        });
    }
}

criterion_group!{
    name = benches;
    config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
    targets = is_authorized_benchmark
}
criterion_main!(benches);

I am running with --profile-time 5.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions