Why is the number of ticks inaccurate?
Clash 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?
cpu proc time stat clock
add a comment |Â
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?
cpu proc time stat clock
add a comment |Â
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?
cpu proc time stat clock
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?
cpu proc time stat clock
edited Nov 10 '17 at 13:08
Satà  Katsura
10.7k11533
10.7k11533
asked Nov 10 '17 at 8:06
yukashima huksay
429217
429217
add a comment |Â
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
answered Nov 10 '17 at 8:37
Stephen Kitt
143k22312377
143k22312377
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password