mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-28 16:10:24 -05:00
Logging: Add accumulated timing for sub tasks when loading project
This commit is contained in:
1 parent
7e0a5ebd9e
commit
ff3773c85d
2 files changed
+55
-13
No files matched your search
@@ -352,10 +352,27 @@ std::chrono::time_point<std::chrono::high_resolution_clock> RiaLogging::currentT
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::logElapsedTime( const QString& message, const std::chrono::time_point<std::chrono::high_resolution_clock>& startTime )
|
||||
{
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( end - startTime );
|
||||
auto text = message + QString( " (duration : %1 milliseconds)" ).arg( duration.count() );
|
||||
|
||||
QString text;
|
||||
auto totalMs = duration.count();
|
||||
|
||||
if ( totalMs < 1000 )
|
||||
{
|
||||
text = message + QString( " (duration: %1 milliseconds)" ).arg( totalMs );
|
||||
}
|
||||
else if ( totalMs < 60000 )
|
||||
{
|
||||
double seconds = totalMs / 1000.0;
|
||||
text = message + QString( " (duration: %1 seconds)" ).arg( seconds, 0, 'f', 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto minutes = totalMs / 60000;
|
||||
auto remainingSeconds = ( totalMs % 60000 ) / 1000.0;
|
||||
text = message + QString( " (duration: %1 minutes %2 seconds)" ).arg( minutes ).arg( remainingSeconds, 0, 'f', 1 );
|
||||
}
|
||||
|
||||
RiaLogging::debug( text );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user