Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'nice is nice' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
nice is nice
Authored by: ylee on Feb 22, '04 12:47:29AM
Why not just do this the true Unix way, and use
? Like so:
$ nice -n 19 top -s 5 -c cpu
The above runs top at nice level 19 (the lowest priority), updates the screen every 5 seconds, and sorts by cpu usage (the default of sorting by pid is, like, bizarre.)

[ Reply to This | # ]
nice is nice
Authored by: Graff on Feb 23, '04 02:02:23AM

I think you meant something like this:

sudo nice -n 19 top -s 5 -o cpu

The -c option is not the sorting option, -o is.

The thing is that the nice level has very little to do with the improved performance of top. It's actually using less cpu because it is sampling less often (the "-s 5" option means sample every 5 seconds). If you remove the nice command you still use about the same amount of cpu:

top -s 5 -o cpu

On my machine both the nice version and the non-nice version used about 1.7% cpu, no matter what nice level I used when I tried it.

When I remove the "-s 5" option then top takes about 9%, no matter what nice level I use.

[ Reply to This | # ]