diff options
author | Aleksei Lipniagov <alipniagov@gitlab.com> | 2019-06-28 14:47:35 +0300 |
---|---|---|
committer | Aleksei Lipniagov <alipniagov@gitlab.com> | 2019-06-28 14:47:35 +0300 |
commit | 97f411b7963ee239823f58ad171fa6794bc37b79 (patch) | |
tree | ed0f7b09c0c7145502653ed1a74884fede8e3ffa /lib | |
parent | 046527beb585b8086e8b280dee78f43417b9a753 (diff) | |
download | gitlab-ce-97f411b7963ee239823f58ad171fa6794bc37b79.tar.gz |
Use PROCESS_CPUTIME_ID for cpu time metrics
To measure ruby cpu time, we should use PROCESS_CPUTIME_ID instead of
THREAD_CPUTIME_ID in our environments.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/metrics/system.rb | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/gitlab/metrics/system.rb b/lib/gitlab/metrics/system.rb index 33c0de91c11..34de40ca72f 100644 --- a/lib/gitlab/metrics/system.rb +++ b/lib/gitlab/metrics/system.rb @@ -57,17 +57,9 @@ module Gitlab end end - # THREAD_CPUTIME is not supported on OS X - if Process.const_defined?(:CLOCK_THREAD_CPUTIME_ID) - def self.cpu_time - Process - .clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :float_second) - end - else - def self.cpu_time - Process - .clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :float_second) - end + def self.cpu_time + Process + .clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :float_second) end # Returns the current real time in a given precision. |