diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-02-12 15:17:48 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-12 15:17:48 +1100 |
commit | d6c05b09dd7cbaba0fcae65929a2c2dd55e9d994 (patch) | |
tree | 1d813f7f0acc543f6da96c429a5cc2fd19b606f1 /cli/lsp/performance.rs | |
parent | 46da7c6aff3c10af6a067f4229644d2de444a3a7 (diff) |
feat(lsp): add deno cache code actions (#9471)
Diffstat (limited to 'cli/lsp/performance.rs')
-rw-r--r-- | cli/lsp/performance.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/lsp/performance.rs b/cli/lsp/performance.rs index 8668519c8..537583141 100644 --- a/cli/lsp/performance.rs +++ b/cli/lsp/performance.rs @@ -49,7 +49,7 @@ impl From<PerformanceMark> for PerformanceMeasure { /// /// The structure will limit the size of measurements to the most recent 1000, /// and will roll off when that limit is reached. -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Performance { counts: Arc<Mutex<HashMap<String, u32>>>, max_size: usize, @@ -127,13 +127,15 @@ impl Performance { /// A function which accepts a previously created performance mark which will /// be used to finalize the duration of the span being measured, and add the /// measurement to the internal buffer. - pub fn measure(&self, mark: PerformanceMark) { + pub fn measure(&self, mark: PerformanceMark) -> Duration { let measure = PerformanceMeasure::from(mark); + let duration = measure.duration; let mut measures = self.measures.lock().unwrap(); measures.push_back(measure); while measures.len() > self.max_size { measures.pop_front(); } + duration } } |