Commit 97f411b7 authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

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.
parent 046527be
...@@ -57,18 +57,10 @@ module Gitlab ...@@ -57,18 +57,10 @@ module Gitlab
end end
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 def self.cpu_time
Process Process
.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :float_second) .clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :float_second)
end end
end
# Returns the current real time in a given precision. # Returns the current real time in a given precision.
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment