Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31365

support core cpu time unhelpful/misleading in thread dumps

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • support-core-plugin
    • None

      The support core helpfully dumps a cpu useage along with thread info

      jenkins.util.Timer 1 id=37 (0x25) state=WAITING cpu=90%

      However this cpu usage is the time spent in cpu / time spent in user mode.
      So all this shows is the %age of time spent in user mode vs system mode .

      When reading the dump this is not obvious and can lead to confusing interpretations.
      e.g. a remote channel pinger thread will appear to be spinning by using 100% cpu.

      Ping thread for channel hudson.remoting.Channel@01234567:SomeComputer id=123 (0x25e) state=TIMED_WAITING cpu=100%
          at java.lang.Thread.sleep(Native Method)
          at hudson.remoting.PingThread.run(PingThread.java:91)
      

      whereas in reality this has just spent 100% of the time when the thread was active in user mode.

      what is more interesting is the amount of time the thread has spent running vs not running.
      e.g. the ratio of running time to blocked + waiting time (obtainable sometimes from the ThreadInfo ) This would actually allow you to see Threads that where spinning or heavily loaded - as opposed to ones spending their time in userland vs kernel land.

          [JENKINS-31365] support core cpu time unhelpful/misleading in thread dumps

          James Nord created issue -
          James Nord made changes -
          Description Original: The support core helpfully dumps a cpu useage along with thread info

          {jenkins.util.Timer [#1] id=37 (0x25) state=WAITING cpu=90%}

          However this cpu usage is the time spent in cpu / time spent in user mode.
          So all this shows is the %age of time spent in [user mode vs system mode | https://github.com/jenkinsci/support-core-plugin/blob/053a0b503fa187e24816becd73bf681de13879de/src/main/java/com/cloudbees/jenkins/support/impl/ThreadDumps.java#L268-L272].

          When reading the dump this is not obvious and can lead to confusing interpretations.
          e.g. a remote channel pinger thread will appear to be spinning by using 100% cpu.
          {{noformat}}
          Ping thread for channel hudson.remoting.Channel@01234567:SomeComputer id=123 (0x25e) state=TIMED_WAITING cpu=100%
              at java.lang.Thread.sleep(Native Method)
              at hudson.remoting.PingThread.run(PingThread.java:91)
          {{noformat}}
          whereas in reality this has just spent 100% of the time when the thread was active in user mode.

          what is more interesting is the amount of time the cpu as spent running vs not running.
          e.g. the ratio of running time to blocked + waiting time (obtainable sometimes from the [ThreadInfo | https://docs.oracle.com/javase/7/docs/api/java/lang/management/ThreadInfo.html#getBlockedTime()]) This would actually allow you to see Threads that where spinning or heavily loaded - as opposed to ones spending their time in userland vs kernel land.
          New: The support core helpfully dumps a cpu useage along with thread info

          {{jenkins.util.Timer [#1] id=37 (0x25) state=WAITING cpu=90%}}

          However this cpu usage is the time spent in cpu / time spent in user mode.
          So all this shows is the %age of time spent in [user mode vs system mode | https://github.com/jenkinsci/support-core-plugin/blob/053a0b503fa187e24816becd73bf681de13879de/src/main/java/com/cloudbees/jenkins/support/impl/ThreadDumps.java#L268-L272].

          When reading the dump this is not obvious and can lead to confusing interpretations.
          e.g. a remote channel pinger thread will appear to be spinning by using 100% cpu.
          {noformat}
          Ping thread for channel hudson.remoting.Channel@01234567:SomeComputer id=123 (0x25e) state=TIMED_WAITING cpu=100%
              at java.lang.Thread.sleep(Native Method)
              at hudson.remoting.PingThread.run(PingThread.java:91)
          {noformat}
          whereas in reality this has just spent 100% of the time when the thread was active in user mode.

          what is more interesting is the amount of time the cpu as spent running vs not running.
          e.g. the ratio of running time to blocked + waiting time (obtainable sometimes from the [ThreadInfo | https://docs.oracle.com/javase/7/docs/api/java/lang/management/ThreadInfo.html#getBlockedTime()]) This would actually allow you to see Threads that where spinning or heavily loaded - as opposed to ones spending their time in userland vs kernel land.
          James Nord made changes -
          Description Original: The support core helpfully dumps a cpu useage along with thread info

          {{jenkins.util.Timer [#1] id=37 (0x25) state=WAITING cpu=90%}}

          However this cpu usage is the time spent in cpu / time spent in user mode.
          So all this shows is the %age of time spent in [user mode vs system mode | https://github.com/jenkinsci/support-core-plugin/blob/053a0b503fa187e24816becd73bf681de13879de/src/main/java/com/cloudbees/jenkins/support/impl/ThreadDumps.java#L268-L272].

          When reading the dump this is not obvious and can lead to confusing interpretations.
          e.g. a remote channel pinger thread will appear to be spinning by using 100% cpu.
          {noformat}
          Ping thread for channel hudson.remoting.Channel@01234567:SomeComputer id=123 (0x25e) state=TIMED_WAITING cpu=100%
              at java.lang.Thread.sleep(Native Method)
              at hudson.remoting.PingThread.run(PingThread.java:91)
          {noformat}
          whereas in reality this has just spent 100% of the time when the thread was active in user mode.

          what is more interesting is the amount of time the cpu as spent running vs not running.
          e.g. the ratio of running time to blocked + waiting time (obtainable sometimes from the [ThreadInfo | https://docs.oracle.com/javase/7/docs/api/java/lang/management/ThreadInfo.html#getBlockedTime()]) This would actually allow you to see Threads that where spinning or heavily loaded - as opposed to ones spending their time in userland vs kernel land.
          New: The support core helpfully dumps a cpu useage along with thread info

          {{jenkins.util.Timer [#1] id=37 (0x25) state=WAITING cpu=90%}}

          However this cpu usage is the time spent in cpu / time spent in user mode.
          So all this shows is the %age of time spent in [user mode vs system mode | https://github.com/jenkinsci/support-core-plugin/blob/053a0b503fa187e24816becd73bf681de13879de/src/main/java/com/cloudbees/jenkins/support/impl/ThreadDumps.java#L268-L272].

          When reading the dump this is not obvious and can lead to confusing interpretations.
          e.g. a remote channel pinger thread will appear to be spinning by using 100% cpu.
          {noformat}
          Ping thread for channel hudson.remoting.Channel@01234567:SomeComputer id=123 (0x25e) state=TIMED_WAITING cpu=100%
              at java.lang.Thread.sleep(Native Method)
              at hudson.remoting.PingThread.run(PingThread.java:91)
          {noformat}
          whereas in reality this has just spent 100% of the time when the thread was active in user mode.

          what is more interesting is the amount of time the thread has spent running vs not running.
          e.g. the ratio of running time to blocked + waiting time (obtainable sometimes from the [ThreadInfo | https://docs.oracle.com/javase/7/docs/api/java/lang/management/ThreadInfo.html#getBlockedTime()]) This would actually allow you to see Threads that where spinning or heavily loaded - as opposed to ones spending their time in userland vs kernel land.
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 166658 ] New: JNJira + In-Review [ 182443 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 46 (Web Link)" [ 17292 ]

            schristou Steven Christou
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: