Module profile

Module profile 

Source
Expand description

Acquire performance metrics of single data-base functions.

§Example

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.
dbg!(stats);

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

Structs§

DBPerf
Wrapper around netlist and layout data structures. Transparently measures time spent in function calls.
PerfCounter
Atomic counters for recording statistics on calls of a single function.
PerfCounterManager
Context manager for a performance counter. This is used to track when the measured function exits.
PerfCounterResult
Statistics on calls of a single function.

Enums§

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