Sponsored Content
Full Discussion: _/proc/stat vs /proc/uptime
Top Forums UNIX for Dummies Questions & Answers _/proc/stat vs /proc/uptime Post 302314527 by coderd on Friday 8th of May 2009 02:37:41 PM
Old 05-08-2009
_/proc/stat vs /proc/uptime

Hi,

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 ?

Thanks
 

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 4.3.3.0 .But when we run it on AIX 4.2.1.0 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

/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

proc

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
Sys::Statistics::Linux::CpuStats(3pm)			User Contributed Perl Documentation		     Sys::Statistics::Linux::CpuStats(3pm)

NAME
Sys::Statistics::Linux::CpuStats - Collect linux cpu statistics. SYNOPSIS
use Sys::Statistics::Linux::CpuStats; my $lxs = Sys::Statistics::Linux::CpuStats->new; $lxs->init; sleep 1; my $stats = $lxs->get; Or my $lxs = Sys::Statistics::Linux::CpuStats->new(initfile => $file); $lxs->init; my $stats = $lxs->get; DESCRIPTION
Sys::Statistics::Linux::CpuStats gathers cpu statistics from the virtual /proc filesystem (procfs). For more information read the documentation of the front-end module Sys::Statistics::Linux. CPU STATISTICS
Generated by /proc/stat for each cpu (cpu0, cpu1 ...). cpu without a number is the summary. user - Percentage of CPU utilization at the user level. nice - Percentage of CPU utilization at the user level with nice priority. system - Percentage of CPU utilization at the system level. idle - Percentage of time the CPU is in idle state. total - Total percentage of CPU utilization. Statistics with kernels >= 2.6. iowait - Percentage of time the CPU is in idle state because an I/O operation is waiting to complete. irq - Percentage of time the CPU is servicing interrupts. softirq - Percentage of time the CPU is servicing softirqs. steal - Percentage of stolen CPU time, which is the time spent in other operating systems when running in a virtualized environment (>=2.6.11). METHODS
new() Call "new()" to create a new object. my $lxs = Sys::Statistics::Linux::CpuStats->new; Maybe you want to store/load the initial statistics to/from a file: my $lxs = Sys::Statistics::Linux::CpuStats->new(initfile => '/tmp/cpustats.yml'); If you set "initfile" it's not necessary to call sleep before "get()". It's also possible to set the path to the proc filesystem. Sys::Statistics::Linux::CpuStats->new( files => { # This is the default path => '/proc' stat => 'stat', } ); init() Call "init()" to initialize the statistics. $lxs->init; get() Call "get()" to get the statistics. "get()" returns the statistics as a hash reference. my $stats = $lxs->get; raw() Get raw values. EXPORTS
No exports. SEE ALSO
proc(5) REPORTING BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>. AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>. COPYRIGHT
Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-03-09 Sys::Statistics::Linux::CpuStats(3pm)
All times are GMT -4. The time now is 04:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy