Measuring CPU usage with top - dependency on delay?
up vote
0
down vote
favorite
I try to measure per process CPU utilization. There are many answers to other questions which suggest to use top for this. My top call looks like this:
top -b -n 2 -d <delay> -p <pid> | tail -1 | awk '{print $7}'
My question is now how to choose the delay. Seemingly, the %CPU values I get, are highly dependent on the delay I choose. When I choose -d 1
(1 second) I only get xx.0 %, sometimes xx.9 %. When I choose -d 2
I only get xx.0 % or xx.5 %. With d=1.5
I always get xx.0 %, xx.3% or xx.7 % (Probably, these are thrids?). When I use d=1.7
I get nearly all decimal digits.
Why is this the case?
linux top cpu-usage
New contributor
add a comment |
up vote
0
down vote
favorite
I try to measure per process CPU utilization. There are many answers to other questions which suggest to use top for this. My top call looks like this:
top -b -n 2 -d <delay> -p <pid> | tail -1 | awk '{print $7}'
My question is now how to choose the delay. Seemingly, the %CPU values I get, are highly dependent on the delay I choose. When I choose -d 1
(1 second) I only get xx.0 %, sometimes xx.9 %. When I choose -d 2
I only get xx.0 % or xx.5 %. With d=1.5
I always get xx.0 %, xx.3% or xx.7 % (Probably, these are thrids?). When I use d=1.7
I get nearly all decimal digits.
Why is this the case?
linux top cpu-usage
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I try to measure per process CPU utilization. There are many answers to other questions which suggest to use top for this. My top call looks like this:
top -b -n 2 -d <delay> -p <pid> | tail -1 | awk '{print $7}'
My question is now how to choose the delay. Seemingly, the %CPU values I get, are highly dependent on the delay I choose. When I choose -d 1
(1 second) I only get xx.0 %, sometimes xx.9 %. When I choose -d 2
I only get xx.0 % or xx.5 %. With d=1.5
I always get xx.0 %, xx.3% or xx.7 % (Probably, these are thrids?). When I use d=1.7
I get nearly all decimal digits.
Why is this the case?
linux top cpu-usage
New contributor
I try to measure per process CPU utilization. There are many answers to other questions which suggest to use top for this. My top call looks like this:
top -b -n 2 -d <delay> -p <pid> | tail -1 | awk '{print $7}'
My question is now how to choose the delay. Seemingly, the %CPU values I get, are highly dependent on the delay I choose. When I choose -d 1
(1 second) I only get xx.0 %, sometimes xx.9 %. When I choose -d 2
I only get xx.0 % or xx.5 %. With d=1.5
I always get xx.0 %, xx.3% or xx.7 % (Probably, these are thrids?). When I use d=1.7
I get nearly all decimal digits.
Why is this the case?
linux top cpu-usage
linux top cpu-usage
New contributor
New contributor
edited Nov 23 at 8:45
New contributor
asked Nov 22 at 11:18
lukasl1991
12
12
New contributor
New contributor
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
lukasl1991 is a new contributor. Be nice, and check out our Code of Conduct.
lukasl1991 is a new contributor. Be nice, and check out our Code of Conduct.
lukasl1991 is a new contributor. Be nice, and check out our Code of Conduct.
lukasl1991 is a new contributor. Be nice, and check out our Code of Conduct.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483422%2fmeasuring-cpu-usage-with-top-dependency-on-delay%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
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