How to obtain the current number of jiffies since reboot in Linux?












6















Linux's /proc/PID/stat lists several metrics that are measured in jiffies. Is there a way to get the current # of jiffies since reboot? Jiffies I also assume to be seconds times the USER_HZ value.



Can I get this by summing the first 4 arguments on the cpu line in /proc/stat?





UPDATE:



$ date +"%s.%N" && grep '^jiffies' timer_list
1262103103.162169230
jiffies: 1007865965
jiffies: 1007865965
jiffies: 1007865965
jiffies: 1007865965
$ date +"%s.%N" && grep '^jiffies' timer_list
1262103108.706475051
jiffies: 1007867351
jiffies: 1007867351
jiffies: 1007867351
jiffies: 1007867351


The delta between these is almost exactly 250 jiffies / second. Appears as though all the jiffies lines per CPU are equivalent (though I guess they might not be if a hot | ondemand CPU was provisioned/replaced). I think this gives me the best place to pull a consistent jiffies counter.










share|improve this question





























    6















    Linux's /proc/PID/stat lists several metrics that are measured in jiffies. Is there a way to get the current # of jiffies since reboot? Jiffies I also assume to be seconds times the USER_HZ value.



    Can I get this by summing the first 4 arguments on the cpu line in /proc/stat?





    UPDATE:



    $ date +"%s.%N" && grep '^jiffies' timer_list
    1262103103.162169230
    jiffies: 1007865965
    jiffies: 1007865965
    jiffies: 1007865965
    jiffies: 1007865965
    $ date +"%s.%N" && grep '^jiffies' timer_list
    1262103108.706475051
    jiffies: 1007867351
    jiffies: 1007867351
    jiffies: 1007867351
    jiffies: 1007867351


    The delta between these is almost exactly 250 jiffies / second. Appears as though all the jiffies lines per CPU are equivalent (though I guess they might not be if a hot | ondemand CPU was provisioned/replaced). I think this gives me the best place to pull a consistent jiffies counter.










    share|improve this question



























      6












      6








      6


      3






      Linux's /proc/PID/stat lists several metrics that are measured in jiffies. Is there a way to get the current # of jiffies since reboot? Jiffies I also assume to be seconds times the USER_HZ value.



      Can I get this by summing the first 4 arguments on the cpu line in /proc/stat?





      UPDATE:



      $ date +"%s.%N" && grep '^jiffies' timer_list
      1262103103.162169230
      jiffies: 1007865965
      jiffies: 1007865965
      jiffies: 1007865965
      jiffies: 1007865965
      $ date +"%s.%N" && grep '^jiffies' timer_list
      1262103108.706475051
      jiffies: 1007867351
      jiffies: 1007867351
      jiffies: 1007867351
      jiffies: 1007867351


      The delta between these is almost exactly 250 jiffies / second. Appears as though all the jiffies lines per CPU are equivalent (though I guess they might not be if a hot | ondemand CPU was provisioned/replaced). I think this gives me the best place to pull a consistent jiffies counter.










      share|improve this question
















      Linux's /proc/PID/stat lists several metrics that are measured in jiffies. Is there a way to get the current # of jiffies since reboot? Jiffies I also assume to be seconds times the USER_HZ value.



      Can I get this by summing the first 4 arguments on the cpu line in /proc/stat?





      UPDATE:



      $ date +"%s.%N" && grep '^jiffies' timer_list
      1262103103.162169230
      jiffies: 1007865965
      jiffies: 1007865965
      jiffies: 1007865965
      jiffies: 1007865965
      $ date +"%s.%N" && grep '^jiffies' timer_list
      1262103108.706475051
      jiffies: 1007867351
      jiffies: 1007867351
      jiffies: 1007867351
      jiffies: 1007867351


      The delta between these is almost exactly 250 jiffies / second. Appears as though all the jiffies lines per CPU are equivalent (though I guess they might not be if a hot | ondemand CPU was provisioned/replaced). I think this gives me the best place to pull a consistent jiffies counter.







      linux kernel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 24 '17 at 8:32









      Ciro Santilli 新疆改造中心 六四事件 法轮功

      3,91622734




      3,91622734










      asked Dec 29 '09 at 4:08









      Jé QueueJé Queue

      3512619




      3512619






















          4 Answers
          4






          active

          oldest

          votes


















          4














          Technically jiffy in computer parlance is the duration of 1 tick of the system timer interrupt. It's not absolute though. For Linux 2.6.13+ on Intel x86 jiffy is 4ms, but can range from 1ms to 10ms depending upon architecture and kernel version.



          From the Kernel Timer Systems page:




          Historically, the kernel used 100 as the value for HZ, yielding a jiffy interval of 10 ms. With 2.4, the HZ value for i386 was changed to 1000, yeilding a jiffy interval of 1 ms. Recently (2.6.13) the kernel changed HZ for i386 to 250. (1000 was deemed too high).




          It lists /proc/timer_list and /proc/timer_stats.



          You can activate the timer_stats at boot time, then cat this file to print stats.






          share|improve this answer
























          • How does one activate the timer_stats? Correct, the 'jiffies' is an arbitrary increment in this case as long as the various /proc/PID/stat files report a metric that is equivalent to some total I can use to calculate relative %s. OK, so there is a "jiffies" line in /proc/timer_list, I'll update original post.

            – Jé Queue
            Dec 29 '09 at 16:16






          • 1





            To start collection of stats "echo 1 > /proc/timer_stats", which you can put at the start of your init cycle.

            – Darren Hall
            Dec 29 '09 at 18:41



















          2














          No, you only need the first line. The first line aggregates everything else in the other cpu lines.



          Example output:



          [john@awesome]$cat /proc/stat
          cpu 35024984 1771325 94153391 1810948613 2648063 352387 557232
          cpu0 13955475 927654 59431476 895791946 1910028 318618 438048
          cpu1 21069509 843671 34721915 915156667 738035 33769 119184
          intr 1403502159 1138402452 597 0 3 3 0 5 0 1 0 0 0 12315 0 92119425 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57676632 0 0 0 0 0 0 0 115290726 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
          ctxt 21043582666
          btime 1252332786
          processes 25663823
          procs_running 1
          procs_blocked 0


          What each column means (left to right):




          • user: normal processes executing in user mode

          • nice: niced processes executing in user mode

          • system: processes executing in kernel mode

          • idle: idle time

          • iowait: waiting for I/O to complete

          • irq: servicing interrupts

          • softirq: servicing softirqs


          as you can see, the first column after cpu (user mode processes) is equal to the 2 numbers beneath it added together.






          share|improve this answer
























          • Is this not only for user time for which the cpu was scheduled? The others being nice, system & idle?

            – Jé Queue
            Dec 29 '09 at 4:21











          • added the meaning of each column.

            – John T
            Dec 29 '09 at 4:25











          • Right, but to find the total # of jiffies since start, would one not do something like awk '/^cpu/{print $2+$3+$4+$5}' /proc/stat?

            – Jé Queue
            Dec 29 '09 at 5:17











          • You only want user,nice,system and idle? You can do awk '/^cpu>/{print $2+$3+$4+$5}' /proc/stat

            – John T
            Dec 29 '09 at 5:32













          • Appears as though any given time delta is not consistent with a sum across the /proc/stat!

            – Jé Queue
            Dec 29 '09 at 16:26



















          1














          jiffies per second:



          awk 'BEGIN {"cat /proc/timer_list | grep '''^jiffies''' | awk '''{print $2}'''" | getline a; "cat /proc/uptime | awk '''{print $1}'''" | getline b ;printf "%.4fn", a/b}'


          Explanation: It divides jiffies since boot found in /proc/timer_list by the seconds since boot found in /proc/uptime






          share|improve this answer
























          • I get 75409.1301 so that does not seem stable in general case. uname -a reports Linux semyol-329-b 3.19.0-33-lowlatency #38~14.04.1-Ubuntu SMP PREEMPT Fri Nov 6 19:30:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux.

            – Mikko Rantalainen
            Nov 20 '15 at 8:02



















          1














          In later Linux Kernels you can query /proc/timer_list and find out the number of jiffies since reboot from each CPU that's present within the system. They should always match.



          $ grep -E "^cpu|^jiff" /proc/timer_list
          cpu: 0
          jiffies: 4299690231
          cpu: 1
          jiffies: 4299690231


          If you take a look at the code behind timer_list.c the bit that prints the above:



          ...
          ...
          P_ns(iowait_sleeptime);
          P(last_jiffies);
          P(next_timer);
          P_ns(idle_expires);
          SEQ_printf(m, "jiffies: %Lun",
          (unsigned long long)jiffies);


          Notice that it's unsigned long long.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f88820%2fhow-to-obtain-the-current-number-of-jiffies-since-reboot-in-linux%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            Technically jiffy in computer parlance is the duration of 1 tick of the system timer interrupt. It's not absolute though. For Linux 2.6.13+ on Intel x86 jiffy is 4ms, but can range from 1ms to 10ms depending upon architecture and kernel version.



            From the Kernel Timer Systems page:




            Historically, the kernel used 100 as the value for HZ, yielding a jiffy interval of 10 ms. With 2.4, the HZ value for i386 was changed to 1000, yeilding a jiffy interval of 1 ms. Recently (2.6.13) the kernel changed HZ for i386 to 250. (1000 was deemed too high).




            It lists /proc/timer_list and /proc/timer_stats.



            You can activate the timer_stats at boot time, then cat this file to print stats.






            share|improve this answer
























            • How does one activate the timer_stats? Correct, the 'jiffies' is an arbitrary increment in this case as long as the various /proc/PID/stat files report a metric that is equivalent to some total I can use to calculate relative %s. OK, so there is a "jiffies" line in /proc/timer_list, I'll update original post.

              – Jé Queue
              Dec 29 '09 at 16:16






            • 1





              To start collection of stats "echo 1 > /proc/timer_stats", which you can put at the start of your init cycle.

              – Darren Hall
              Dec 29 '09 at 18:41
















            4














            Technically jiffy in computer parlance is the duration of 1 tick of the system timer interrupt. It's not absolute though. For Linux 2.6.13+ on Intel x86 jiffy is 4ms, but can range from 1ms to 10ms depending upon architecture and kernel version.



            From the Kernel Timer Systems page:




            Historically, the kernel used 100 as the value for HZ, yielding a jiffy interval of 10 ms. With 2.4, the HZ value for i386 was changed to 1000, yeilding a jiffy interval of 1 ms. Recently (2.6.13) the kernel changed HZ for i386 to 250. (1000 was deemed too high).




            It lists /proc/timer_list and /proc/timer_stats.



            You can activate the timer_stats at boot time, then cat this file to print stats.






            share|improve this answer
























            • How does one activate the timer_stats? Correct, the 'jiffies' is an arbitrary increment in this case as long as the various /proc/PID/stat files report a metric that is equivalent to some total I can use to calculate relative %s. OK, so there is a "jiffies" line in /proc/timer_list, I'll update original post.

              – Jé Queue
              Dec 29 '09 at 16:16






            • 1





              To start collection of stats "echo 1 > /proc/timer_stats", which you can put at the start of your init cycle.

              – Darren Hall
              Dec 29 '09 at 18:41














            4












            4








            4







            Technically jiffy in computer parlance is the duration of 1 tick of the system timer interrupt. It's not absolute though. For Linux 2.6.13+ on Intel x86 jiffy is 4ms, but can range from 1ms to 10ms depending upon architecture and kernel version.



            From the Kernel Timer Systems page:




            Historically, the kernel used 100 as the value for HZ, yielding a jiffy interval of 10 ms. With 2.4, the HZ value for i386 was changed to 1000, yeilding a jiffy interval of 1 ms. Recently (2.6.13) the kernel changed HZ for i386 to 250. (1000 was deemed too high).




            It lists /proc/timer_list and /proc/timer_stats.



            You can activate the timer_stats at boot time, then cat this file to print stats.






            share|improve this answer













            Technically jiffy in computer parlance is the duration of 1 tick of the system timer interrupt. It's not absolute though. For Linux 2.6.13+ on Intel x86 jiffy is 4ms, but can range from 1ms to 10ms depending upon architecture and kernel version.



            From the Kernel Timer Systems page:




            Historically, the kernel used 100 as the value for HZ, yielding a jiffy interval of 10 ms. With 2.4, the HZ value for i386 was changed to 1000, yeilding a jiffy interval of 1 ms. Recently (2.6.13) the kernel changed HZ for i386 to 250. (1000 was deemed too high).




            It lists /proc/timer_list and /proc/timer_stats.



            You can activate the timer_stats at boot time, then cat this file to print stats.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 29 '09 at 9:20









            Darren HallDarren Hall

            5,97412123




            5,97412123













            • How does one activate the timer_stats? Correct, the 'jiffies' is an arbitrary increment in this case as long as the various /proc/PID/stat files report a metric that is equivalent to some total I can use to calculate relative %s. OK, so there is a "jiffies" line in /proc/timer_list, I'll update original post.

              – Jé Queue
              Dec 29 '09 at 16:16






            • 1





              To start collection of stats "echo 1 > /proc/timer_stats", which you can put at the start of your init cycle.

              – Darren Hall
              Dec 29 '09 at 18:41



















            • How does one activate the timer_stats? Correct, the 'jiffies' is an arbitrary increment in this case as long as the various /proc/PID/stat files report a metric that is equivalent to some total I can use to calculate relative %s. OK, so there is a "jiffies" line in /proc/timer_list, I'll update original post.

              – Jé Queue
              Dec 29 '09 at 16:16






            • 1





              To start collection of stats "echo 1 > /proc/timer_stats", which you can put at the start of your init cycle.

              – Darren Hall
              Dec 29 '09 at 18:41

















            How does one activate the timer_stats? Correct, the 'jiffies' is an arbitrary increment in this case as long as the various /proc/PID/stat files report a metric that is equivalent to some total I can use to calculate relative %s. OK, so there is a "jiffies" line in /proc/timer_list, I'll update original post.

            – Jé Queue
            Dec 29 '09 at 16:16





            How does one activate the timer_stats? Correct, the 'jiffies' is an arbitrary increment in this case as long as the various /proc/PID/stat files report a metric that is equivalent to some total I can use to calculate relative %s. OK, so there is a "jiffies" line in /proc/timer_list, I'll update original post.

            – Jé Queue
            Dec 29 '09 at 16:16




            1




            1





            To start collection of stats "echo 1 > /proc/timer_stats", which you can put at the start of your init cycle.

            – Darren Hall
            Dec 29 '09 at 18:41





            To start collection of stats "echo 1 > /proc/timer_stats", which you can put at the start of your init cycle.

            – Darren Hall
            Dec 29 '09 at 18:41













            2














            No, you only need the first line. The first line aggregates everything else in the other cpu lines.



            Example output:



            [john@awesome]$cat /proc/stat
            cpu 35024984 1771325 94153391 1810948613 2648063 352387 557232
            cpu0 13955475 927654 59431476 895791946 1910028 318618 438048
            cpu1 21069509 843671 34721915 915156667 738035 33769 119184
            intr 1403502159 1138402452 597 0 3 3 0 5 0 1 0 0 0 12315 0 92119425 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57676632 0 0 0 0 0 0 0 115290726 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            ctxt 21043582666
            btime 1252332786
            processes 25663823
            procs_running 1
            procs_blocked 0


            What each column means (left to right):




            • user: normal processes executing in user mode

            • nice: niced processes executing in user mode

            • system: processes executing in kernel mode

            • idle: idle time

            • iowait: waiting for I/O to complete

            • irq: servicing interrupts

            • softirq: servicing softirqs


            as you can see, the first column after cpu (user mode processes) is equal to the 2 numbers beneath it added together.






            share|improve this answer
























            • Is this not only for user time for which the cpu was scheduled? The others being nice, system & idle?

              – Jé Queue
              Dec 29 '09 at 4:21











            • added the meaning of each column.

              – John T
              Dec 29 '09 at 4:25











            • Right, but to find the total # of jiffies since start, would one not do something like awk '/^cpu/{print $2+$3+$4+$5}' /proc/stat?

              – Jé Queue
              Dec 29 '09 at 5:17











            • You only want user,nice,system and idle? You can do awk '/^cpu>/{print $2+$3+$4+$5}' /proc/stat

              – John T
              Dec 29 '09 at 5:32













            • Appears as though any given time delta is not consistent with a sum across the /proc/stat!

              – Jé Queue
              Dec 29 '09 at 16:26
















            2














            No, you only need the first line. The first line aggregates everything else in the other cpu lines.



            Example output:



            [john@awesome]$cat /proc/stat
            cpu 35024984 1771325 94153391 1810948613 2648063 352387 557232
            cpu0 13955475 927654 59431476 895791946 1910028 318618 438048
            cpu1 21069509 843671 34721915 915156667 738035 33769 119184
            intr 1403502159 1138402452 597 0 3 3 0 5 0 1 0 0 0 12315 0 92119425 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57676632 0 0 0 0 0 0 0 115290726 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            ctxt 21043582666
            btime 1252332786
            processes 25663823
            procs_running 1
            procs_blocked 0


            What each column means (left to right):




            • user: normal processes executing in user mode

            • nice: niced processes executing in user mode

            • system: processes executing in kernel mode

            • idle: idle time

            • iowait: waiting for I/O to complete

            • irq: servicing interrupts

            • softirq: servicing softirqs


            as you can see, the first column after cpu (user mode processes) is equal to the 2 numbers beneath it added together.






            share|improve this answer
























            • Is this not only for user time for which the cpu was scheduled? The others being nice, system & idle?

              – Jé Queue
              Dec 29 '09 at 4:21











            • added the meaning of each column.

              – John T
              Dec 29 '09 at 4:25











            • Right, but to find the total # of jiffies since start, would one not do something like awk '/^cpu/{print $2+$3+$4+$5}' /proc/stat?

              – Jé Queue
              Dec 29 '09 at 5:17











            • You only want user,nice,system and idle? You can do awk '/^cpu>/{print $2+$3+$4+$5}' /proc/stat

              – John T
              Dec 29 '09 at 5:32













            • Appears as though any given time delta is not consistent with a sum across the /proc/stat!

              – Jé Queue
              Dec 29 '09 at 16:26














            2












            2








            2







            No, you only need the first line. The first line aggregates everything else in the other cpu lines.



            Example output:



            [john@awesome]$cat /proc/stat
            cpu 35024984 1771325 94153391 1810948613 2648063 352387 557232
            cpu0 13955475 927654 59431476 895791946 1910028 318618 438048
            cpu1 21069509 843671 34721915 915156667 738035 33769 119184
            intr 1403502159 1138402452 597 0 3 3 0 5 0 1 0 0 0 12315 0 92119425 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57676632 0 0 0 0 0 0 0 115290726 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            ctxt 21043582666
            btime 1252332786
            processes 25663823
            procs_running 1
            procs_blocked 0


            What each column means (left to right):




            • user: normal processes executing in user mode

            • nice: niced processes executing in user mode

            • system: processes executing in kernel mode

            • idle: idle time

            • iowait: waiting for I/O to complete

            • irq: servicing interrupts

            • softirq: servicing softirqs


            as you can see, the first column after cpu (user mode processes) is equal to the 2 numbers beneath it added together.






            share|improve this answer













            No, you only need the first line. The first line aggregates everything else in the other cpu lines.



            Example output:



            [john@awesome]$cat /proc/stat
            cpu 35024984 1771325 94153391 1810948613 2648063 352387 557232
            cpu0 13955475 927654 59431476 895791946 1910028 318618 438048
            cpu1 21069509 843671 34721915 915156667 738035 33769 119184
            intr 1403502159 1138402452 597 0 3 3 0 5 0 1 0 0 0 12315 0 92119425 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57676632 0 0 0 0 0 0 0 115290726 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            ctxt 21043582666
            btime 1252332786
            processes 25663823
            procs_running 1
            procs_blocked 0


            What each column means (left to right):




            • user: normal processes executing in user mode

            • nice: niced processes executing in user mode

            • system: processes executing in kernel mode

            • idle: idle time

            • iowait: waiting for I/O to complete

            • irq: servicing interrupts

            • softirq: servicing softirqs


            as you can see, the first column after cpu (user mode processes) is equal to the 2 numbers beneath it added together.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 29 '09 at 4:20









            John TJohn T

            142k20293328




            142k20293328













            • Is this not only for user time for which the cpu was scheduled? The others being nice, system & idle?

              – Jé Queue
              Dec 29 '09 at 4:21











            • added the meaning of each column.

              – John T
              Dec 29 '09 at 4:25











            • Right, but to find the total # of jiffies since start, would one not do something like awk '/^cpu/{print $2+$3+$4+$5}' /proc/stat?

              – Jé Queue
              Dec 29 '09 at 5:17











            • You only want user,nice,system and idle? You can do awk '/^cpu>/{print $2+$3+$4+$5}' /proc/stat

              – John T
              Dec 29 '09 at 5:32













            • Appears as though any given time delta is not consistent with a sum across the /proc/stat!

              – Jé Queue
              Dec 29 '09 at 16:26



















            • Is this not only for user time for which the cpu was scheduled? The others being nice, system & idle?

              – Jé Queue
              Dec 29 '09 at 4:21











            • added the meaning of each column.

              – John T
              Dec 29 '09 at 4:25











            • Right, but to find the total # of jiffies since start, would one not do something like awk '/^cpu/{print $2+$3+$4+$5}' /proc/stat?

              – Jé Queue
              Dec 29 '09 at 5:17











            • You only want user,nice,system and idle? You can do awk '/^cpu>/{print $2+$3+$4+$5}' /proc/stat

              – John T
              Dec 29 '09 at 5:32













            • Appears as though any given time delta is not consistent with a sum across the /proc/stat!

              – Jé Queue
              Dec 29 '09 at 16:26

















            Is this not only for user time for which the cpu was scheduled? The others being nice, system & idle?

            – Jé Queue
            Dec 29 '09 at 4:21





            Is this not only for user time for which the cpu was scheduled? The others being nice, system & idle?

            – Jé Queue
            Dec 29 '09 at 4:21













            added the meaning of each column.

            – John T
            Dec 29 '09 at 4:25





            added the meaning of each column.

            – John T
            Dec 29 '09 at 4:25













            Right, but to find the total # of jiffies since start, would one not do something like awk '/^cpu/{print $2+$3+$4+$5}' /proc/stat?

            – Jé Queue
            Dec 29 '09 at 5:17





            Right, but to find the total # of jiffies since start, would one not do something like awk '/^cpu/{print $2+$3+$4+$5}' /proc/stat?

            – Jé Queue
            Dec 29 '09 at 5:17













            You only want user,nice,system and idle? You can do awk '/^cpu>/{print $2+$3+$4+$5}' /proc/stat

            – John T
            Dec 29 '09 at 5:32







            You only want user,nice,system and idle? You can do awk '/^cpu>/{print $2+$3+$4+$5}' /proc/stat

            – John T
            Dec 29 '09 at 5:32















            Appears as though any given time delta is not consistent with a sum across the /proc/stat!

            – Jé Queue
            Dec 29 '09 at 16:26





            Appears as though any given time delta is not consistent with a sum across the /proc/stat!

            – Jé Queue
            Dec 29 '09 at 16:26











            1














            jiffies per second:



            awk 'BEGIN {"cat /proc/timer_list | grep '''^jiffies''' | awk '''{print $2}'''" | getline a; "cat /proc/uptime | awk '''{print $1}'''" | getline b ;printf "%.4fn", a/b}'


            Explanation: It divides jiffies since boot found in /proc/timer_list by the seconds since boot found in /proc/uptime






            share|improve this answer
























            • I get 75409.1301 so that does not seem stable in general case. uname -a reports Linux semyol-329-b 3.19.0-33-lowlatency #38~14.04.1-Ubuntu SMP PREEMPT Fri Nov 6 19:30:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux.

              – Mikko Rantalainen
              Nov 20 '15 at 8:02
















            1














            jiffies per second:



            awk 'BEGIN {"cat /proc/timer_list | grep '''^jiffies''' | awk '''{print $2}'''" | getline a; "cat /proc/uptime | awk '''{print $1}'''" | getline b ;printf "%.4fn", a/b}'


            Explanation: It divides jiffies since boot found in /proc/timer_list by the seconds since boot found in /proc/uptime






            share|improve this answer
























            • I get 75409.1301 so that does not seem stable in general case. uname -a reports Linux semyol-329-b 3.19.0-33-lowlatency #38~14.04.1-Ubuntu SMP PREEMPT Fri Nov 6 19:30:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux.

              – Mikko Rantalainen
              Nov 20 '15 at 8:02














            1












            1








            1







            jiffies per second:



            awk 'BEGIN {"cat /proc/timer_list | grep '''^jiffies''' | awk '''{print $2}'''" | getline a; "cat /proc/uptime | awk '''{print $1}'''" | getline b ;printf "%.4fn", a/b}'


            Explanation: It divides jiffies since boot found in /proc/timer_list by the seconds since boot found in /proc/uptime






            share|improve this answer













            jiffies per second:



            awk 'BEGIN {"cat /proc/timer_list | grep '''^jiffies''' | awk '''{print $2}'''" | getline a; "cat /proc/uptime | awk '''{print $1}'''" | getline b ;printf "%.4fn", a/b}'


            Explanation: It divides jiffies since boot found in /proc/timer_list by the seconds since boot found in /proc/uptime







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 27 '10 at 13:47









            TamaditeTamadite

            111




            111













            • I get 75409.1301 so that does not seem stable in general case. uname -a reports Linux semyol-329-b 3.19.0-33-lowlatency #38~14.04.1-Ubuntu SMP PREEMPT Fri Nov 6 19:30:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux.

              – Mikko Rantalainen
              Nov 20 '15 at 8:02



















            • I get 75409.1301 so that does not seem stable in general case. uname -a reports Linux semyol-329-b 3.19.0-33-lowlatency #38~14.04.1-Ubuntu SMP PREEMPT Fri Nov 6 19:30:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux.

              – Mikko Rantalainen
              Nov 20 '15 at 8:02

















            I get 75409.1301 so that does not seem stable in general case. uname -a reports Linux semyol-329-b 3.19.0-33-lowlatency #38~14.04.1-Ubuntu SMP PREEMPT Fri Nov 6 19:30:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux.

            – Mikko Rantalainen
            Nov 20 '15 at 8:02





            I get 75409.1301 so that does not seem stable in general case. uname -a reports Linux semyol-329-b 3.19.0-33-lowlatency #38~14.04.1-Ubuntu SMP PREEMPT Fri Nov 6 19:30:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux.

            – Mikko Rantalainen
            Nov 20 '15 at 8:02











            1














            In later Linux Kernels you can query /proc/timer_list and find out the number of jiffies since reboot from each CPU that's present within the system. They should always match.



            $ grep -E "^cpu|^jiff" /proc/timer_list
            cpu: 0
            jiffies: 4299690231
            cpu: 1
            jiffies: 4299690231


            If you take a look at the code behind timer_list.c the bit that prints the above:



            ...
            ...
            P_ns(iowait_sleeptime);
            P(last_jiffies);
            P(next_timer);
            P_ns(idle_expires);
            SEQ_printf(m, "jiffies: %Lun",
            (unsigned long long)jiffies);


            Notice that it's unsigned long long.






            share|improve this answer




























              1














              In later Linux Kernels you can query /proc/timer_list and find out the number of jiffies since reboot from each CPU that's present within the system. They should always match.



              $ grep -E "^cpu|^jiff" /proc/timer_list
              cpu: 0
              jiffies: 4299690231
              cpu: 1
              jiffies: 4299690231


              If you take a look at the code behind timer_list.c the bit that prints the above:



              ...
              ...
              P_ns(iowait_sleeptime);
              P(last_jiffies);
              P(next_timer);
              P_ns(idle_expires);
              SEQ_printf(m, "jiffies: %Lun",
              (unsigned long long)jiffies);


              Notice that it's unsigned long long.






              share|improve this answer


























                1












                1








                1







                In later Linux Kernels you can query /proc/timer_list and find out the number of jiffies since reboot from each CPU that's present within the system. They should always match.



                $ grep -E "^cpu|^jiff" /proc/timer_list
                cpu: 0
                jiffies: 4299690231
                cpu: 1
                jiffies: 4299690231


                If you take a look at the code behind timer_list.c the bit that prints the above:



                ...
                ...
                P_ns(iowait_sleeptime);
                P(last_jiffies);
                P(next_timer);
                P_ns(idle_expires);
                SEQ_printf(m, "jiffies: %Lun",
                (unsigned long long)jiffies);


                Notice that it's unsigned long long.






                share|improve this answer













                In later Linux Kernels you can query /proc/timer_list and find out the number of jiffies since reboot from each CPU that's present within the system. They should always match.



                $ grep -E "^cpu|^jiff" /proc/timer_list
                cpu: 0
                jiffies: 4299690231
                cpu: 1
                jiffies: 4299690231


                If you take a look at the code behind timer_list.c the bit that prints the above:



                ...
                ...
                P_ns(iowait_sleeptime);
                P(last_jiffies);
                P(next_timer);
                P_ns(idle_expires);
                SEQ_printf(m, "jiffies: %Lun",
                (unsigned long long)jiffies);


                Notice that it's unsigned long long.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 2 at 6:19









                slmslm

                6,26563846




                6,26563846






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f88820%2fhow-to-obtain-the-current-number-of-jiffies-since-reboot-in-linux%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How do I know what Microsoft account the skydrive app is syncing to?

                    Grease: Live!

                    When does type information flow backwards in C++?