Why is the number of ticks inaccurate?

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I checked the numbers in proc/stat to the the number of clock ticks the CPU has had and I saw that the sum of the numbers in CPU1-4 is not equal to the numbers written in front of CPU as a whole. Why is that?







share|improve this question


























    up vote
    1
    down vote

    favorite












    I checked the numbers in proc/stat to the the number of clock ticks the CPU has had and I saw that the sum of the numbers in CPU1-4 is not equal to the numbers written in front of CPU as a whole. Why is that?







    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I checked the numbers in proc/stat to the the number of clock ticks the CPU has had and I saw that the sum of the numbers in CPU1-4 is not equal to the numbers written in front of CPU as a whole. Why is that?







      share|improve this question














      I checked the numbers in proc/stat to the the number of clock ticks the CPU has had and I saw that the sum of the numbers in CPU1-4 is not equal to the numbers written in front of CPU as a whole. Why is that?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 '17 at 13:08









      Satō Katsura

      10.7k11533




      10.7k11533










      asked Nov 10 '17 at 8:06









      yukashima huksay

      429217




      429217




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          The difference results from truncating the values after calculating the sums. /proc/stat calculates the sums of elapsed times in nanoseconds, and then converts the resulting values to USER_HZ using integer division which truncates.



          Thus if all four CPUs have individual values of 1.3, you’ll get a sum of 5.2, truncated to 5 for the first line, and 1 for each CPU line.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403695%2fwhy-is-the-number-of-ticks-inaccurate%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            The difference results from truncating the values after calculating the sums. /proc/stat calculates the sums of elapsed times in nanoseconds, and then converts the resulting values to USER_HZ using integer division which truncates.



            Thus if all four CPUs have individual values of 1.3, you’ll get a sum of 5.2, truncated to 5 for the first line, and 1 for each CPU line.






            share|improve this answer
























              up vote
              3
              down vote



              accepted










              The difference results from truncating the values after calculating the sums. /proc/stat calculates the sums of elapsed times in nanoseconds, and then converts the resulting values to USER_HZ using integer division which truncates.



              Thus if all four CPUs have individual values of 1.3, you’ll get a sum of 5.2, truncated to 5 for the first line, and 1 for each CPU line.






              share|improve this answer






















                up vote
                3
                down vote



                accepted







                up vote
                3
                down vote



                accepted






                The difference results from truncating the values after calculating the sums. /proc/stat calculates the sums of elapsed times in nanoseconds, and then converts the resulting values to USER_HZ using integer division which truncates.



                Thus if all four CPUs have individual values of 1.3, you’ll get a sum of 5.2, truncated to 5 for the first line, and 1 for each CPU line.






                share|improve this answer












                The difference results from truncating the values after calculating the sums. /proc/stat calculates the sums of elapsed times in nanoseconds, and then converts the resulting values to USER_HZ using integer division which truncates.



                Thus if all four CPUs have individual values of 1.3, you’ll get a sum of 5.2, truncated to 5 for the first line, and 1 for each CPU line.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 10 '17 at 8:37









                Stephen Kitt

                143k22312377




                143k22312377



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403695%2fwhy-is-the-number-of-ticks-inaccurate%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    ZYTWvCv54Wf6 Is774 eWrPevSZQVI,hGnjo1nHFJG2piXpP,5jAsvwIjMIPk7
                    XHh4 giloUgd,RYnVftfs70bSJwMfK3 qjlnX2O,jK,Yr1psWRS,TLGI,ur,0Y g4GTXDDuO wULh8MD

                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    How many registers does an x86_64 CPU actually have?

                    Displaying single band from multi-band raster using QGIS