#performance #events #durations #functional-reactive-programming #mark #marking #period

performance-mark

A utility library for marking events and durations for performance-tracking purposes

3 releases (breaking)

0.3.0 Oct 18, 2023
0.2.0 Sep 14, 2023
0.1.0 Apr 18, 2023

#1485 in WebAssembly

Download history 2/week @ 2024-08-26 3/week @ 2024-09-02 10/week @ 2024-09-09 16/week @ 2024-09-16 27/week @ 2024-09-23 10/week @ 2024-09-30 8/week @ 2024-10-14 9/week @ 2024-10-21 4/week @ 2024-10-28 8/week @ 2024-11-04 14/week @ 2024-11-18 12/week @ 2024-11-25 23/week @ 2024-12-02 28/week @ 2024-12-09

77 downloads per month
Used in 9 crates (via flow-graph-interpreter)

Apache-2.0

12KB
295 lines

performance-mark

This library is for marking periods of time and events in those periods.

Usage

use performance_mark::Performance;
use std::thread::sleep;
use std::time::Duration;

fn main() {
  let wait = Duration::from_millis(100);

  let mut perf = Performance::new();

  perf.mark("start");

  sleep(wait);

  perf.start("middle");
  sleep(wait);
  perf.end("middle");

  sleep(wait);

  perf.mark("end");

  println!("{:?}", perf.events());

  assert_eq!(perf.events().len(), 2);
  assert!(perf.events()[0] < perf.events()[1]);
  assert_eq!(perf.periods().len(), 1);
  assert!(perf.periods().get("middle").unwrap().duration() >= wait);
}

Dependencies

~160KB