1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

what units are used in kern.cp_times?

Discussion in 'Userland Programming and Scripting' started by hsn, Apr 13, 2012.

  1. hsn

    hsn New Member

    Messages:
    34
    Thanks Received:
    0
    I need to get CPU miliseconds used since boot. Total user + system + interrupt time. My idea is to get it from the cp_times counter, but I could not figure out what time units are used.

    Code:
    kern.cp_times: 99980046 216471 24984081 1176383 1487354560 71668989 126252 23494859 10703 1518410383
     131623419 250473 23864059 96 1457972935 118043958 142876 19560244 58 1475964202 122076248 131112 18928452
     113 1472575112 112635562 103018 16450420 111 1484522108 92257836 132166 24627838 306285 1496387411
     49457466 59102 14902169 989885 1548302924


    Source code is in sys/kern/kern_clock.c
     
  2. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,628
    Thanks Received:
    2,385
    I'm not sure but it's probably a jiffy.
     
  3. hsn

    hsn New Member

    Messages:
    34
    Thanks Received:
    0
    Units seems to be closest to stathz, but in reality they are slightly faster then 133 Hz.

    Code:
    ponto:(admin)main/swg>sysctl kern.clockrate
    kern.clockrate: { hz = 1000, tick = 1000, profhz = 2000, stathz = 133 }