[petsc-users] Logging the same pieces of code several times using PetscLogEventBegin/PetscLogEventEnd

Filippo Spiga filippo.spiga at disco.unimib.it
Thu Nov 11 13:49:07 CST 2010


Dear all,
     I would like to timing the same pieces of code several times using 
PetscLogEventBegin/PetscLogEventEnd. My code does, more or less, 
something like that

PetscLogEvent  logA, logB;

PetscLogEventRegister( "Log A", 0, &logA);
PetscLogEventRegister( "Log B", 0, &logB);

for (i=0...10) {

     PetscLogEventBegin(logA, 0, 0, 0, 0);
     ...
     PetscLogEventEnd(logA, 0, 0, 0, 0);

     PetscLogEventBegin(logB 0, 0, 0, 0);
     ..
     PetscLogEventEnd(logB, 0, 0, 0, 0);

}

At the end, when I print the summary of all the evens using 
-log_summary, "Log A" and "Log B" appear many times... as many times as 
I performed the loop. How can change this behaviour?

Thank you very much in advance!

Cheers

-- 
Filippo SPIGA, MSc Computer Science


More information about the petsc-users mailing list