Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-14-2005, 08:22 AM   #1
Registered: Feb 2005
Location: internet
Distribution: Debian
Posts: 821

Rep: Reputation: 30
Unhappy how to find processor time.

mandrake 10.0

if i am running C coding or C++ or JAVA how to find the processor time taken for execute the
program and compilation time taken.
i mean processor time taken for any perticular process.
Old 07-14-2005, 08:46 AM   #2
Bruce Hill
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Gentoo (all servers at work are openSUSE)
Posts: 6,934

Rep: Reputation: 128Reputation: 128
If I understand you correctly, read "man time"

For instance, you can issue "time make <blah>" and at the end of make it displays the time it took. Here's some sample output
mingdao@james:~/madwifi$ time tar -xvjf madwifi-cvs-current.tar.bz2
real    0m0.994s
user    0m0.853s
sys     0m0.083s
Old 07-15-2005, 03:07 AM   #3
Registered: Feb 2005
Location: internet
Distribution: Debian
Posts: 821

Original Poster
Rep: Reputation: 30
thank a lot.

can u pls clear my doubt.

i did not understand the result at the end.

what is that ?

user time taken or CPU time taken.

actually my question is...

the CPU time taken for a perticular process.


#time du /home

the time taken for this result of output ?
how much time taken for this process for CPU?
Old 07-15-2005, 10:13 AM   #4
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165
The time values are:
  • Real time is the actual number of elapsed seconds. This includes time spent waiting as well as time spent working.
  • User time is the amount of CPU-time spent in "user mode," that is, executing the actual code of your application.
  • Sys time is the amount of time spent in "system mode," executing operating-system code directly on behalf of your application.
See: man time. There is considerably more information that can be presented. All of the figures relate to "this process" ... the one being timed.

When you are evaluating "how fast" a program runs, there are several aspects to the overall problem which must be considered. First of all, the fact that programs are completely idle much of the time... they have nothing to do. ("Press 'OK' to continue," and you haven't pressed it yet.) Then, there's the fact that programs which are "doing something" are forced to wait much of the time. They've started a disk-read, for example, and are waiting for the data to arrive. And finally, there's the fact that when a program is using the CPU, it must share the CPU with other programs that are in a similar position. The entire system, furthermore, must share other resources such as memory, and so processes may incur involuntary delays because of things like paging.

Most programs, when they are not idle, are I/O bound. In other words, the main determinant of how fast those programs can get their jobs done, is how fast they can initiate and complete I/O (input/output) operations. Very rarely do you find programs that are CPU bound. Thus the paradox that, while it is fairly easy to design a motherboard with a fast CPU or maybe two of them, "the speed of the CPU" is usually not what makes the difference. That motherboard might have a dog-slow I/O bus. Many of them do.


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
Crond Taking Almost 100% Processor Time ngwasuma Linux - Software 4 01-04-2006 09:05 AM
Installing Linux on a dual processor machine (only one processor detected) rocordial Linux - Hardware 1 11-27-2004 02:16 AM
how to find processor type on linux on zos ? gonwg Linux - Newbie 3 09-11-2004 04:47 PM
xinetd 100% utilization on one processor on a two processor system red hat 9 garnold Linux - General 0 02-02-2004 01:47 PM
syslog shows 2 different speeds for the processor and the sys loses time sp|k3 Red Hat 2 01-03-2004 11:57 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:09 PM.

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