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

write CPU time with higher precision

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By lxufeishi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 16, 2014, 15:55
Default write CPU time with higher precision
  #1
New Member
 
Anonymous
Join Date: Mar 2012
Posts: 6
Rep Power: 14
CCarl is on a distinguished road
Is there a way to get a CPU time difference with more precision?

The standard for runTime.elapsedCpuTime() seems to be two digits. When printing more digits using setprecision(18), I just get extra 0's or 9's, not really a higher precision?
CCarl is offline   Reply With Quote

Old   June 3, 2017, 20:07
Default
  #2
Member
 
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11
cfdopenfoam is on a distinguished road
Quote:
Originally Posted by CCarl View Post
Is there a way to get a CPU time difference with more precision?

The standard for runTime.elapsedCpuTime() seems to be two digits. When printing more digits using setprecision(18), I just get extra 0's or 9's, not really a higher precision?
Hi, did you find a way to do this?
cfdopenfoam is offline   Reply With Quote

Old   September 1, 2023, 02:12
Default excutive time with high resolution
  #3
New Member
 
Join Date: Jul 2019
Location: MARS
Posts: 9
Rep Power: 6
lxufeishi is on a distinguished road
The "clockTime" Class would help, as its description:
"Starts timing and returns elapsed time from start. Uses std::chrono::high_resolution_clock for better resolution (2uSec instead of ~20mSec) than cpuTime. "

So the code would be like:
Code:
#include "clockTime.H"

Foam::clockTime myTime; 

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
      //<< "  ClockTime = " << runTime.elapsedClockTime() << " s"
      << "  ClockTime = " << myTime.elapsedTime() << " s"
      << endl;
ref.https://www.openfoam.com/documentati...clockTime.html
georgescovici likes this.
lxufeishi 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
How to export time series of variables for one point? mary mor OpenFOAM Post-Processing 8 July 19, 2017 10:54
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 02:20
time step directories naming issue Andrea_85 OpenFOAM 3 April 3, 2014 08:38
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 07:47
CPU time Vs Wall clock time HMR CFX 2 February 28, 2012 19:06


All times are GMT -4. The time now is 01:08.