Handle Process.clock_getres failures.

parent 1063f7c0
......@@ -10,10 +10,8 @@ module GitLab
# It takes a pid
class ProcessStats
def initialize(pid)
@pid = pid
@user_hertz = Process.clock_getres(:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz)
@pid = pid
@user_hertz = retrieve_user_hertz
@stats = populate_info
end
......@@ -47,6 +45,12 @@ module GitLab
rescue Errno::ENOENT
nil
end
def retrieve_user_hertz
Process.clock_getres(:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz)
rescue Errno::EINVAL
100.0
end
end
# Probes a process for info then writes metrics to a target
......
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