Sha256: c1ed2751522aeef592895b72a490545c69b2ec675a88a9634945b55f1a39dea0
Contents?: true
Size: 869 Bytes
Versions: 9
Compression:
Stored size: 869 Bytes
Contents
# Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.com/terms.html # TODO: move to Sqreen::Time module Sqreen has_mono_time = begin Process.clock_gettime Process::CLOCK_MONOTONIC true rescue StandardError false end @has_thread_cpu_time = begin Process.clock_gettime Process::CLOCK_THREAD_CPUTIME_ID true rescue StandardError false end class << self def thread_cpu_time? @has_thread_cpu_time end end if has_mono_time def self.time Process.clock_gettime Process::CLOCK_MONOTONIC end else def self.time Time.now.to_f end end if @has_thread_cpu_time def self.thread_cpu_time Process.clock_gettime Process::CLOCK_THREAD_CPUTIME_ID end else def self.thread_cpu_time 0 end end end
Version data entries
9 entries across 9 versions & 1 rubygems