473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to find the cpu utilisation ratio in linux

how to find the cpu utilisation ratio in linux and unix
Jun 28 '07 #1
2 2227
alcazar
10
Check out the /proc directory.This directory mostly consists of these system related info.There is one file called /proc/cpuinfo which gives physical parameters CPU info ,but thats not what you are looking for.

I am trying to find the answer to your question.

how to find the cpu utilisation ratio in linux and unix
Jun 28 '07 #2
prn
254 Expert 100+
The command "w" (/bin/w in Solaris, /usr/bin/w in Linux -- at least Fedora) will give you that information.

The first line of the output should look like:
08:58:53 up 75 days, 18:04, 3 users, load average: 0.03, 0.07, 0.02
or
8:55am up 38 day(s), 1 user, load average: 1.28, 1.37, 1.29

Depending on what you plan to do with it, you may need to parse out specific information. For example, I run the following script every half hour on one of the Solaris boxes I am responsible for:
Expand|Select|Wrap|Line Numbers
  1. #! /bin/perl
  2. use strict;
  3.  
  4. open IN, "/bin/w |" or die "could not run w to get load average: $!\n";
  5. my $line  = <IN>;
  6. close IN;
  7. chomp $line;
  8.  
  9. my ($junk,$avgs) = split /load average: /,$line;
  10. my ($min,$fivemin,$fifteenmin) = split /, /, $avgs;
  11. print scalar localtime(), "\t$min\t$fivemin\t$fifteenmin\n";
(My crontab includes a redirection to append the data to a file.)

HTH,
Paul
Jun 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: jong | last post by:
I have a problem with an C# application. The application is a 24x7 low volume message processing server. The server has a single thread of processing, running in a continuous loop, for each...
10
by: jong | last post by:
I have a problem with an C# application. The application is a 24x7 low volume message processing server. The server has a single thread of processing, running in a continuous loop, for each...
0
by: jong | last post by:
I have a problem with an C# application. The application is a 24x7 low volume message processing server. The server has a single thread of processing, running in a continuous loop, for each...
0
by: chrisguest | last post by:
I am looking into a replication strategies to improve performance and redundancy for a MySQL 4.1 database running on Linux/Apache2/mod_python. I am curious as to the standard way of obtaining a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.