CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

measuring the performance of some fragments of codes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 23, 2014, 05:32
Default measuring the performance of some fragments of codes
  #1
ooo
Member
 
Join Date: Feb 2012
Posts: 49
Rep Power: 14
ooo is on a distinguished road
Hi FOAMers,
I added some lines of code to a solver and would like to measure the performance of each part, e.g pressure solver, momentum solver and so on, Would it be the EXACT way of measuring?

double a = clock::getTime();
THE CODE;
double b = clock::getTime();
elapsed cpu time for that part of code EXACTLY is : (b-a) ?

(
I expected to get nearly same value, but using the above method,sometimes provides strange results.
e.g for a particular fragment of code, it gives performance of 9%, and sometimes 15% (the simulation is converged)
actually when i print out the value of the scalar/double a or b, it seems that it can be 9 precision number ,so subtraction may lead to some errors due to that range of accuracy
)

Thanks in advance.

UPDATE : using 'elapsedCpuTime' gave accurate time and solved the problem.

Last edited by ooo; April 23, 2014 at 09:18.
ooo is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Delete the UDM codes in the UDF Messi Fluent UDF and Scheme Programming 2 January 28, 2014 09:01
parallel performance on BX900 uzawa OpenFOAM Installation 3 September 5, 2011 15:52
Is it worth it? Jason Bardis Main CFD Forum 47 July 27, 2011 04:52
Comparison of CFD Codes Kerem Main CFD Forum 9 May 9, 2003 04:29
Anyone used Ansys/Flotran - cf. with other codes? S. Langsford Main CFD Forum 3 October 19, 1998 20:51


All times are GMT -4. The time now is 20:49.