public void TimerMetric_CanCount() { timer.Value.Rate.Count.Should().Be(0); using (timer.NewContext()) { } timer.Value.Rate.Count.Should().Be(1); using (timer.NewContext()) { } timer.Value.Rate.Count.Should().Be(2); timer.Time(() => { }); timer.Value.Rate.Count.Should().Be(3); timer.Time(() => 1); timer.Value.Rate.Count.Should().Be(4); }
public void TimerCanCount() { TimerMetric timer = new TimerMetric(); timer.Value.Rate.Count.Should().Be(0); using (timer.NewContext()) { } timer.Value.Rate.Count.Should().Be(1); using (timer.NewContext()) { } timer.Value.Rate.Count.Should().Be(2); timer.Time(() => { }); timer.Value.Rate.Count.Should().Be(3); timer.Time(() => 1); timer.Value.Rate.Count.Should().Be(4); }
public void TimerCanTrackTime() { TestClock clock = new TestClock(); TestScheduler scheduler = new TestScheduler(clock); TimerMetric timer = new TimerMetric(SamplingType.LongTerm, new MeterMetric(clock, scheduler), clock); using (timer.NewContext()) { clock.Advance(TimeUnit.Milliseconds, 100); } timer.Value.Histogram.Count.Should().Be(1); timer.Value.Histogram.Max.Should().Be(TimeUnit.Milliseconds.ToNanoseconds(100)); }
public void TimerContextRecordsTimeOnlyOnFirstDispose() { TestClock clock = new TestClock(); TestScheduler scheduler = new TestScheduler(clock); TimerMetric timer = new TimerMetric(SamplingType.LongTerm, new MeterMetric(clock, scheduler), clock); var context = timer.NewContext(); clock.Advance(TimeUnit.Milliseconds, 100); using (context) { } clock.Advance(TimeUnit.Milliseconds, 100); using (context) { } timer.Value.Histogram.Count.Should().Be(1); timer.Value.Histogram.Max.Should().Be(TimeUnit.Milliseconds.ToNanoseconds(100)); }
public void can_count() { _timer.Value.Rate.Count.Should().Be(0); using (_timer.NewContext()) { } _timer.Value.Rate.Count.Should().Be(1); using (_timer.NewContext()) { } _timer.Value.Rate.Count.Should().Be(2); _timer.Time(() => { }); _timer.Value.Rate.Count.Should().Be(3); _timer.Time(() => 1); _timer.Value.Rate.Count.Should().Be(4); }