Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Distributions
User Name
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.


  Search this Thread
Old 03-30-2011, 04:53 PM   #1
Registered: Mar 2011
Posts: 36

Rep: Reputation: 0
top calculations


does anyony know how top calculates the %idle and % cpu usage?

I am curious about what files it uses.
Old 03-30-2011, 04:54 PM   #2
LQ Guru
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
It uses the /proc/stat file.
See here:
Old 04-01-2011, 09:54 PM   #3
Registered: Mar 2011
Posts: 36

Original Poster
Rep: Reputation: 0

Thank you for your help. I am just getting started with shell scripting so what you gave you really helped.

Where did you get the formulas to calculate the usage and difference? I am just curious.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date calculations on Sun sparc ukursat Linux - Newbie 1 12-05-2008 11:01 PM
threads for mathematical calculations? skywalker27182 Programming 3 02-13-2005 11:25 AM
need help with pi calculations! daven1 Programming 2 01-06-2005 08:21 PM
Date calculations in BASH script Crashman Programming 4 07-03-2004 11:15 AM
EIGRP and IGRP metric calculations dai Linux - Networking 1 12-16-2002 03:59 PM > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 01:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration