|
[Sponsors] |
February 22, 2000, 01:58 |
How to calculate CPU time in Linux system?
|
#1 |
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 |
|
February 22, 2000, 10:19 |
Re: How to calculate CPU time in NT system?
|
#2 |
Guest
Posts: n/a
|
I am thinking about the same question, but on NT platform. Any information would be appreciated.
|
|
February 22, 2000, 10:20 |
Re: How to calculate CPU time in Linux system?
|
#3 |
Guest
Posts: n/a
|
You can use a command called "time" for that purpose.
|
|
February 22, 2000, 10:29 |
Re: How to calculate CPU time in Linux system?
|
#4 |
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.
|
|
February 22, 2000, 11:55 |
Re: How to calculate CPU time in Linux system?
|
#5 |
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 |
|
February 22, 2000, 21:59 |
Re: How to calculate CPU time in NT system?
|
#6 |
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.
|
|
March 1, 2000, 23:38 |
Thanks very much for below help.
|
#7 |
Guest
Posts: n/a
|
Thanks very much for below help.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Transient simulation not converging | skabilan | OpenFOAM Running, Solving & CFD | 14 | December 17, 2019 00:12 |
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 18:57 |
On the reduction of cpu time | lee | Main CFD Forum | 4 | March 7, 1999 23:02 |