diff options
author | Robert Speicher <robert@gitlab.com> | 2016-06-28 19:32:02 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-06-28 23:46:07 +0300 |
commit | a64b7cd3ba3ad619599ae7682aba89fa301b0a2b (patch) | |
tree | 7d2e6694187982ae526a2086a0f57d1238b48a4d /spec | |
parent | a87c99f7f706fee2abba78ed1b2e834a0b8f3afb (diff) |
Merge branch 'performance-clock-adjustments' into 'master'
Use clock_gettime for all performance timestamps
This MR adjusts the performance monitoring code to use `Process.clock_gettime` (thus `clock_gettime(3)`) instead of `Time.now`.
Using `Time.now` / `Time.new` adds more overhead than `Process.clock_gettime`, it also doesn't provide a way of getting timestamps in nanoseconds (which `Process.clock_gettime` does allow).
See merge request !4899
(cherry picked from commit 53ad9522c46edf8ede068145fa3d89e2b047c076)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/metrics/system_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/lib/gitlab/metrics/system_spec.rb b/spec/lib/gitlab/metrics/system_spec.rb index d6ae54e25e8..cf0e282c2fb 100644 --- a/spec/lib/gitlab/metrics/system_spec.rb +++ b/spec/lib/gitlab/metrics/system_spec.rb @@ -28,8 +28,20 @@ describe Gitlab::Metrics::System do end describe '.cpu_time' do - it 'returns a Fixnum' do - expect(described_class.cpu_time).to be_an_instance_of(Fixnum) + it 'returns a Float' do + expect(described_class.cpu_time).to be_an_instance_of(Float) + end + end + + describe '.real_time' do + it 'returns a Float' do + expect(described_class.real_time).to be_an_instance_of(Float) + end + end + + describe '.monotonic_time' do + it 'returns a Float' do + expect(described_class.monotonic_time).to be_an_instance_of(Float) end end end |