Module libreda_db::profile

source ·
Expand description

Acquire performance metrics of single data-base functions.


use libreda_db::prelude::*;
use libreda_db::profile::{DBPerf, FnName};

let mut chip = Chip::new();
let mut chip_with_perf = DBPerf::new(&mut chip);

// Do some operations.
let _cell = chip_with_perf.create_cell("MyCell".into());

let stats = chip_with_perf.get_stats(FnName::create_cell);

/// Debug-print the statistics.

assert_eq!(stats.num_calls, 1, "there was exactly one call to the function");
assert!(stats.total_time.as_nanos() > 0);


  • Wrapper around netlist, layout and L2N structures that allows measuring time spend in function calls.
  • Atomic counters for recording statistics on calls of a single function.
  • Context manager for a performance counter. This is used to track when the measured function exits.
  • Statistics on calls of a single function.


  • Enum of API names. This is used as an index into the array of performance counters.