[Developers] CactusUtils/2079: Patch for thorn TimerReport: Output timer reports to a file instead of to stdout

Tom Goodale goodale at cct.lsu.edu
Tue Jan 16 10:59:07 CST 2007


On Tue, 16 Jan 2007, schnetter at cct.lsu.edu wrote:

> Add a parameter to thorn CactusUtils/TimerReport to output the timer reports 
> to files instead of to stdout.  The reports are often many lines long, and 
> they use more than 80 characters per line, cluttering stdout.  Additionally, 
> having them in files allows looking at timer reports from all processors 
> without collecting all processors' stdout.

Sounds like a nice idea.

> The implementation is a bit unelegant, since the flesh function 
> CCTK_SchedulePrintTimes does not accest a FILE* argument.  Instead, 
> TimerReport redirects all stdout to file before outputting the report, and 
> unredirects afterwards.  This requires the system calls open, dup, and close, 
> which are not part of the C standard (but are already autodetected when 
> configuring Cactus).

It would probably be cleaner to introduce

CCTK_SchedulePrintTimesToFile

which takes a FILE * argument or a file descriptor (the latter would be 
good for reporting timing info to a web page, but the former is better if 
multiplexing with other things on stdout) and then have both the thorn and 
the flesh CCTK_SchedulePrintTimes use this routine.

Cheers,

Tom


More information about the Developers mailing list