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.
This commit is contained in:
parent
046527beb5
commit
97f411b796
|
@ -57,17 +57,9 @@ module Gitlab
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# THREAD_CPUTIME is not supported on OS X
|
def self.cpu_time
|
||||||
if Process.const_defined?(:CLOCK_THREAD_CPUTIME_ID)
|
Process
|
||||||
def self.cpu_time
|
.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :float_second)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the current real time in a given precision.
|
# Returns the current real time in a given precision.
|
||||||
|
|
Loading…
Reference in New Issue