CLOCK in FronTier

FronTier has its own clock, used for timing of routines, and somehwat useful as a debugging tool: to roughly locate the main calling routine which eventually leads to the bug.

This clock is defined in "/util/times.c" and can be accessed through two functions calls:

EXPORT void start_clock(char *s)
EXPORT void stop_clock(char *s)
Each of these functions are turned on only by debugging on the word "CLOCK".
With "CLOCK" turned on, start_clock prints:
	CLOCK string
while stop_clock prints the cpu time it took:
	CLOCK cpu_time
So, a typical code fragment would be:
EXPORT void my_function(void)
{
	start_clock("my_function");

	STUFF;

	stop_clock("my_function");
}
As a result, if a function starts, but does not stop, you know clean_up was called in there, or in the functions it calls.

The printing of CLOCK information is formatted in a nested manner, which makes spotting the absence of a stop very easy.



Back to Main Page


Comments?

Authors: Folkert Tangerman
Last revision: April 10, 1997

Copyright 1997 This article may be redistributed to other individuals for noncommercial use, provided that the entire text, all HTML codes, and this copyright notice remains intact and unaltered in any way. This article may not be resold, reprinted, or redistributed in whole or in part for compensation of any kind without prior written permission of the author.