Commit 2a61429a authored by Johannes Spazier's avatar Johannes Spazier

Fixed time measurement in multi-threaded version.

parent 28eaf07f
......@@ -64,7 +64,8 @@ int commandLineHelp( void );
int main( int argc, char **argv )
{
char buf[1024];
int ierr,argn,elapsed;
int ierr,argn;
long int elapsed;
int lastProgress,lastPropagation,lastDump;
int loop;
......@@ -114,7 +115,7 @@ int main( int argc, char **argv )
// Main loop
Log.print("Starting main loop...");
timespec start, end;
timespec start, inter, end;
clock_gettime(CLOCK_MONOTONIC, &start);
for( Par.time=0,loop=1,lastProgress=Par.outProgress,lastPropagation=Par.outPropagation,lastDump=0;
......@@ -128,12 +129,13 @@ int main( int argc, char **argv )
Node.run();
elapsed = ((int)clock())/CLOCKS_PER_SEC;
clock_gettime(CLOCK_MONOTONIC, &inter);
elapsed = diff(start, inter) * 1000;
if( Par.outProgress ) {
if( lastProgress >= Par.outProgress ) {
printf( "Model time = %s, elapsed: %ld msec\n", utlTimeSplitString(Par.time), clock()/(CLOCKS_PER_SEC/1000) );
Log.print( "Model time = %s, elapsed: %ld msec", utlTimeSplitString(Par.time), clock()/(CLOCKS_PER_SEC/1000) );
printf( "Model time = %s, elapsed: %ld msec\n", utlTimeSplitString(Par.time), elapsed );
Log.print( "Model time = %s, elapsed: %ld msec", utlTimeSplitString(Par.time), elapsed );
lastProgress = 0;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment