1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
//! Performance profiling.

use crate::*;

impl Cx {
    pub fn profile_start(&mut self, id: u64) {
        self.profiles.insert(id, UniversalInstant::now());
    }

    pub fn profile_end(&self, id: u64) {
        if let Some(inst) = self.profiles.get(&id) {
            log!("Profile {} time {}ms", id, inst.elapsed().as_millis());
        }
    }
}