Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.1.5
    • Fix Version/s: JRuby 1.2
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Process.times returns invalid values which makes it look like it is taking 100% of CPU time. Here's the best documentation I could find:

      http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_struct__tms.html

      Obviously at FiveRuns we collect metrics like CPU usage so this functionality is important for customers using JRuby with our software.

      1. times.rb
        1 kB
        Wayne Meissner

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Mike: Can you confirm your use of 'times' is working more like you'd expect with this change?

        Show
        Charles Oliver Nutter added a comment - Mike: Can you confirm your use of 'times' is working more like you'd expect with this change?
        Hide
        Charles Oliver Nutter added a comment -

        I had to revert the JMX-based version of this because it appears to be introducing undue overhead into request timings on Rails. I may reinstate this code with a flag, Reinstate it but only check the current thread, or omit it entirely, but it appears we'll need to consider a native option for getting process timings.

        Show
        Charles Oliver Nutter added a comment - I had to revert the JMX-based version of this because it appears to be introducing undue overhead into request timings on Rails. I may reinstate this code with a flag, Reinstate it but only check the current thread, or omit it entirely, but it appears we'll need to consider a native option for getting process timings.
        Hide
        Charles Oliver Nutter added a comment -

        I've added Wayne's workaround with a modification to use platform-appropriate SC_CLK_TCK in r8349. We'll look at getting something more built-in for 1.1.7. For now, if you need accurate CPU timings, require 'ffi/times' somewhere before you start calling Process.times, and it should be accurate.

        Show
        Charles Oliver Nutter added a comment - I've added Wayne's workaround with a modification to use platform-appropriate SC_CLK_TCK in r8349. We'll look at getting something more built-in for 1.1.7. For now, if you need accurate CPU timings, require 'ffi/times' somewhere before you start calling Process.times, and it should be accurate.
        Hide
        Charles Oliver Nutter added a comment -

        I'm going to call this resolved. Since we don't have direct access to the normal "times" C function, if you want accurate timings on JRuby you should just require ffi/times. It will replace the Process.times method with an FFI version, and all is well.

        Show
        Charles Oliver Nutter added a comment - I'm going to call this resolved. Since we don't have direct access to the normal "times" C function, if you want accurate timings on JRuby you should just require ffi/times. It will replace the Process.times method with an FFI version, and all is well.
        Hide
        Evan Weaver added a comment -

        ffi/times.rb is gone in head. No alternative seems to have appeared.

        Show
        Evan Weaver added a comment - ffi/times.rb is gone in head. No alternative seems to have appeared.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Mike Perham
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: