[#97536] [Ruby master Bug#16694] JIT vs hardened GCC with PCH — v.ondruch@...
Issue #16694 has been reported by vo.x (Vit Ondruch).
11 messages
2020/03/18
[ruby-core:97610] [Ruby master Feature#8809] Process.clock_getres
From:
eregontp@...
Date:
2020-03-28 11:47:22 UTC
List:
ruby-core #97610
Issue #8809 has been updated by Eregon (Benoit Daloze). In #16740 I propose to remove this API because it almost always returns incorrect and useless values. ---------------------------------------- Feature #8809: Process.clock_getres https://bugs.ruby-lang.org/issues/8809#change-84801 * Author: akr (Akira Tanaka) * Status: Closed * Priority: Normal ---------------------------------------- How about Process.clock_getres method? POSIX defines clock_getres function to provide resolution information of clocks. I made a pacth to invoke clock_getres function. Process.clock_getres(Process::CLOCK_MONOTONIC) #=> 1.0e-09 Process.clock_getres(Process::CLOCK_MONOTONIC_COARSE) #=> 0.00400025 The result means that the resolution of CLOCK_MONOTONIC is 1ns and the resolution of CLOCK_MONOTONIC_COARSE is 4.00025ms. Process.clock_getres has optional unit argument as Process.clock_gettime. Process.clock_getres(Process::CLOCK_MONOTONIC, :nanosecond) #=> 1 Process.clock_getres(Process::CLOCK_MONOTONIC_COARSE, :nanosecond) #=> 4000250 It supports emulated clocks as well. Process.clock_getres(:SUS_GETTIMEOFDAY_BASED_CLOCK_REALTIME) #=> 1.0000000000000002e-06 Process.clock_getres(:SUS_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID) #=> 1.0000000000000002e-06 The unit argument can be :hertz, which means the reciprocal of the second. Process.clock_getres(:SUS_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz) #=> 1000000.0 Note that Process.clock_getres(:POSIX_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz) is the clock ticks per second (CLK_TCK) and Process.clock_getres(:ISO_C_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz) is CLOCK_PER_SEC. I wanted to access them easily to investigate emulated clock behaviors on various OSes. Any comments? ---Files-------------------------------- clock_getres.patch (4.39 KB) clock_getres-2.patch (6.06 KB) clock_getres-3.patch (6 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>