"_/proc/stat vs /proc/uptime"

Post #302314527 by coderd on Friday 8th of May 2009 02:37:41 PM

Full Discussion: _/proc/stat vs /proc/uptime
_/proc/stat vs /proc/uptime


I am trying to calculate the CPU Usage by getting the difference between the idle time reported by /proc/stat at 2 different intervals. Now the 4th entry in the first line of /proc/stat will give me the 'idle time'. But I also came across /proc/uptime that gives me 2 entries : 1st one as the time in seconds since the system has been 'up' and the other entry being the number of seconds the system has been idle.

Dummy question : Should the 4th entry the /proc/stat and the 2nd entry /proc/uptime match each other ? If not, why ?

Test Your Knowledge in Computers #20
Difficulty: Medium
India's first Super Computer, the PARAM 8000, was installed in 1991.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

/proc 100%

The df/bdf command shows /proc 100% full all the time. What does /proc contain? and why 100% all the time even on a new setup. (1 Reply)
Discussion started by: asutoshch
1 Replies

2. UNIX for Dummies Questions & Answers

about /proc

hi, we all know /proc is about the information of active process, I have just read an artical which said you can use /proc/cpuinfo, /proc/net./proc/meminfo etc. to know about some hardware information .But I want to know how to use with command line? (1 Reply)
Discussion started by: fuqiang1976
1 Replies

3. UNIX for Advanced & Expert Users

The /proc Filesystems

Anyone know what the difference between the /proc filesystems under Linux and SunOS? Thanx In Advance! -Lola (1 Reply)
Discussion started by: Sparticus007
1 Replies

4. Programming

Proc problem

Hello all , We have a c program , it is running well on AIX .But when we run it on AIX version the program exit when it begin to do this command : Exec sql connect . N.B: The version of C compiler is :4.2 Database :Oracle8 thanks in advance . Elie . (2 Replies)
Discussion started by: eyounes
2 Replies

5. UNIX for Advanced & Expert Users


/proc is filing up my root filesystem. Can you delete any of the4 ID numbers out of /proc. Please help me. (3 Replies)
Discussion started by: aojmoj
3 Replies

6. UNIX for Dummies Questions & Answers

proc directory

I did a search on this, but didn't find exactly the answer I'm looking for. What exactly is the proc directory for? Showing processes spawned by users? I ask because I have some very large files in that directory by multiple users and its affecting my disk usage. Can you limit how many... (2 Replies)
Discussion started by: kymberm
2 Replies

7. UNIX for Dummies Questions & Answers


Hi, What are the various way's to fix /proc folder in redhat linux 7.2 and how to verify /proc folder is proper or croupted? Thank in advance Bache Gowda (7 Replies)
Discussion started by: bache_gowda
7 Replies

8. Programming

Need Of Proc*c/c++ Compiler

1. Software Requirments For Pro*c/c++ , 2. Need Pro* C/c++ Compiler, 3. Documents For Installing Proc* C Compiler (3 Replies)
Discussion started by: contactmadhuin
3 Replies

9. Programming

Need help ! SQL and Proc *C

:) hi all ! Please help me When I select data from oracle with proc * C prog. I count the number of rows For example the total rows is 1000000 but the number of result return is a limit number 5000 for ex So How can I know this limit (5 Replies)
Discussion started by: iwbasts
5 Replies

10. UNIX for Dummies Questions & Answers

Regarding /proc

If you are adding the kernel module without any module parameter passing, it should print out following information to info1 file so that user can make read access to info1 file (via, for example, cat /proc/info1): Processor type Kernel version Total number of the processes currently... (1 Reply)
Discussion started by: shekhar.huded
1 Replies
Tcl_DoWhenIdle(3)					      Tcl Library Procedures						 Tcl_DoWhenIdle(3)


Tcl_DoWhenIdle, Tcl_CancelIdleCall - invoke a procedure when there are no pending events SYNOPSIS
#include <tcl.h> Tcl_DoWhenIdle(proc, clientData) Tcl_CancelIdleCall(proc, clientData) ARGUMENTS
Tcl_IdleProc *proc (in) Procedure to invoke. ClientData clientData (in) Arbitrary one-word value to pass to proc. _________________________________________________________________ DESCRIPTION
Tcl_DoWhenIdle arranges for proc to be invoked when the application becomes idle. The application is considered to be idle when Tcl_DoOneEvent has been called, could not find any events to handle, and is about to go to sleep waiting for an event to occur. At this point all pending Tcl_DoWhenIdle handlers are invoked. For each call to Tcl_DoWhenIdle there will be a single call to proc; after proc is invoked the handler is automatically removed. Tcl_DoWhenIdle is only usable in programs that use Tcl_DoOneEvent to dispatch events. Proc should have arguments and result that match the type Tcl_IdleProc: typedef void Tcl_IdleProc(ClientData clientData); The clientData parameter to proc is a copy of the clientData argument given to Tcl_DoWhenIdle. Typically, clientData points to a data structure containing application-specific information about what proc should do. Tcl_CancelIdleCall may be used to cancel one or more previous calls to Tcl_DoWhenIdle: if there is a Tcl_DoWhenIdle handler registered for proc and clientData, then it is removed without invoking it. If there is more than one handler on the idle list that refers to proc and clientData, all of the handlers are removed. If no existing handlers match proc and clientData then nothing happens. Tcl_DoWhenIdle is most useful in situations where (a) a piece of work will have to be done but (b) it is possible that something will hap- pen in the near future that will change what has to be done or require something different to be done. Tcl_DoWhenIdle allows the actual work to be deferred until all pending events have been processed. At this point the exact work to be done will presumably be known and it can be done exactly once. For example, Tcl_DoWhenIdle might be used by an editor to defer display updates until all pending commands have been processed. Without this feature, redundant redisplays might occur in some situations, such as the processing of a command file. BUGS
At present it is not safe for an idle callback to reschedule itself continuously. This will interact badly with certain features of Tk that attempt to wait for all idle callbacks to complete. If you would like for an idle callback to reschedule itself continuously, it is better to use a timer handler with a zero timeout period. KEYWORDS
callback, defer, idle callback Tcl 7.5 Tcl_DoWhenIdle(3)

Featured Tech Videos

All times are GMT -4. The time now is 06:45 PM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy