Getting CPU usage without any commands


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Getting CPU usage without any commands
# 1  
Old 01-09-2012
Getting CPU usage without any commands

Hello

Is there a way to get CPU usage on UNIX environments (SunOS, Linux, HP-UX, AIX) without executing any commands?

The reason I ask is because I am asked to research any potential methods to monitor performance on UNIX environments but not use any commands because they want to 'poll' this every second and if the command itself drains some usage, then the monitoring tool would do more harm than good.

Any help is appreciated. Thanks.
# 2  
Old 01-09-2012
You have to read data in kernel counters get what you want. That means you expend cpu cycles getting the information. There is no way around that.

You can minimize the issue by having a process running continually, waking up periodically, then sampling and going back to sleep. This uses a lot less resource than creating a new process (i.e., running a command, which may be what the 'others' are referring to) every time you issue a command.

However, this seems really odd to me. The impact of this kind of thing is minimal unless you get really heavy-handed with monitoring. Those tools are designed with the idea they need to have minimal system impact. Linux and Solaris have had kernel changes in the past just to accomodate the idea of minimizing resource use when monitoring.

Solaris has a tool, dtrace, which was also designed specifically with monitoring and NOT impacting the system it is monitoring.

On the other hand, some debuggers and profilers can really impact the system. So some performance monioring tools do degrade performance.

Overall, I think you are barking up the wrong tree - your worry is overblown somewhat.
# 3  
Old 01-09-2012
How do you do something without doing anything? That's a very Zen question.

I don't think there's any commandless command capable of doing anything like a command.
# 4  
Old 01-10-2012
Thanks for the replies.

I took look at gangalia and it seems that they access kernel stats exposed via /proc or kstat. i guess this is as 'light' as possible without degrading performance.
# 5  
Old 01-10-2012
Depends how they wrote it, it does. Doing it without CPU is still kind of a fallacy.
# 6  
Old 01-10-2012
Hi.
Quote:
In information technology, the observer effect is the potential impact of the act of observing a process output while the process is running. For example: if a process uses a log file to record its progress, the process could slow. -- http://en.wikipedia.org/wiki/Observe...ion_technology)
So from my point of view, if you are concerned with observing the work, then you must also be concerned about the generation of the data that you wish to analyze.

This suggests that the only measurement allowable would be completely external to the system in question. For example, using a stop watch, one could time a computational load, but could not depend on any other data from the system, because that would have an impact. Farther, one should disable the generation of data that records any data except that of computational answers -- no capture of CPU time, IO time, nothing except the results of computation.

So the answer seems to be easy: use any of the available commands that are not part of the system under consideration, the measurement needs to be wholly external. The measurement of a known computation can be recorded, then a multiple of that load, and the calculation of system characteristics can be done externally.

Good luck ... cheers, drl
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

100% CPU usage linux commands

hi guys the application guy told me that his server was executing linux commands with some delay...let's say 1-2-3 seconds.... checking the system we found that when the delay took place CPU usage for that command in top was 100%.... this happens for bash, chkconfig, w, df, du among others in... (2 Replies)
Discussion started by: karlochacon
2 Replies

2. Programming

CPU usage

Hi all, I'm using python and psutil a library to get system informations like cpu usage (percent) for a given process. My question is if I have the value in % of the cpu usage how I could get the cpu usage in cycle number I mean not in percent? Thanks a lot D. (5 Replies)
Discussion started by: Dedalus
5 Replies

3. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

4. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

5. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

6. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

7. UNIX for Dummies Questions & Answers

CPU usage

can anyone tell me How to check memory and CPU usage of a certain process (1 Reply)
Discussion started by: ccp
1 Replies

8. Programming

CPU usage and memory usage

Please tell me solaris functions/api for getting following information 1- Function that tells how much memory used by current process 2- Function that tells how much memory used by all running processes 3- Function that tells how much CPU is used by current process 4- Function that tells how... (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

9. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies

10. UNIX for Dummies Questions & Answers

CPU usage

What would I use to see the CPU usage of my process in Unix? (2 Replies)
Discussion started by: Karen
2 Replies
Login or Register to Ask a Question