CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

How to calculate CPU time in Linux system?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 22, 2000, 01:58
Default How to calculate CPU time in Linux system?
  #1
HS Dou
Guest
 
Posts: n/a
Hi,Everyone:

I am a new user of Linux system. Could anyone please tell me how to calculate excutive CPU time of a program in Linux system?

Before in Unix system, we use "mclock()."

Thanks in advance.

HS Dou
  Reply With Quote

Old   February 22, 2000, 10:19
Default Re: How to calculate CPU time in NT system?
  #2
kang
Guest
 
Posts: n/a
I am thinking about the same question, but on NT platform. Any information would be appreciated.
  Reply With Quote

Old   February 22, 2000, 10:20
Default Re: How to calculate CPU time in Linux system?
  #3
Sanjeev Kumar
Guest
 
Posts: n/a
You can use a command called "time" for that purpose.
  Reply With Quote

Old   February 22, 2000, 10:29
Default Re: How to calculate CPU time in Linux system?
  #4
clifford bradford
Guest
 
Posts: n/a
there should be some kind of 'time' command use the man pages. also most unix systems including linux have extensive profiling tools to let you see which subroutines in your code take most time and i think they can do things like calculate flops etc.
  Reply With Quote

Old   February 22, 2000, 11:55
Default Re: How to calculate CPU time in Linux system?
  #5
Bernard Parent
Guest
 
Posts: n/a
Use /usr/bin/time and then follow it by the name of your executable. I suggest not to use the shell built-in time function which you will invoke if you call 'time' instead of '/usr/bin/time'.

When your code will be done, the time will be outputted to stderr. Also note that this will only work if your code is non-threaded. For a threaded application (multi-CPU), there is sadly no way AFAIK to tell the CPU time on linux..

If you run your code in the background and want stdout and stderr redirected to files, here's what to type in at the bash prompt:

/usr/bin/time yourcode > scr.stdout 2> scr.stderr &

where 'yourcode' is the name of your executable.. The time required for execution will be outputted to scr.stderr, which should look something like:

72.13user 0.11system 1:16.13elapsed 94%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (5956major+626minor)pagefaults 0swaps

The first number preceding user is the number of CPU seconds the code required for completion.

have fun,

-bern
  Reply With Quote

Old   February 22, 2000, 21:59
Default Re: How to calculate CPU time in NT system?
  #6
Marcio Aredes Martins
Guest
 
Posts: n/a
If you are a fortran user (Dec, Absoft or Microsoft) use the function called TIMEF(). This function calculate the CPU time in double precision.
  Reply With Quote

Old   March 1, 2000, 23:38
Default Thanks very much for below help.
  #7
HS Dou
Guest
 
Posts: n/a
Thanks very much for below help.
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Full pipe 3D using icoFoam cyberbrain OpenFOAM 4 March 16, 2011 10:20
how to calculate the averaged mass flow along a line over time ? iampolaris OpenFOAM Post-Processing 0 March 10, 2011 23:03
Overflow problem in steady simulation ReeKo CFX 11 October 8, 2008 17:57
Transient simulation not converging skabilan OpenFOAM Running, Solving & CFD 12 September 17, 2007 17:48
On the reduction of cpu time lee Main CFD Forum 4 March 7, 1999 23:02


All times are GMT -4. The time now is 23:06.