Adding clock zero and using to avoid uninit errors

This commit is contained in:
Jay McCarthy 2010-05-18 08:48:07 -05:00
parent 010e3d5381
commit 43d1494aef
3 changed files with 11 additions and 5 deletions

View File

@ -334,7 +334,8 @@ GC_collect_end_callback_Proc GC_set_collect_end_callback(GC_collect_end_callback
*/
GC_bool GC_try_to_collect_inner(GC_stop_func stop_func)
{
CLOCK_TYPE start_time, current_time;
CLOCK_TYPE start_time = CLOCK_ZERO;
CLOCK_TYPE current_time;
if (GC_dont_gc) return FALSE;
/* PLTSCHEME */
if (GC_collect_start_callback)
@ -481,7 +482,8 @@ GC_bool GC_stopped_mark(GC_stop_func stop_func)
{
unsigned i;
int dummy;
CLOCK_TYPE start_time, current_time;
CLOCK_TYPE start_time = CLOCK_ZERO;
CLOCK_TYPE current_time;
if (GC_print_stats)
GET_TIME(start_time);
@ -634,8 +636,8 @@ extern void GC_check_tls(void);
/* but the world is otherwise running. */
void GC_finish_collection()
{
CLOCK_TYPE start_time;
CLOCK_TYPE finalize_time;
CLOCK_TYPE start_time = CLOCK_ZERO;
CLOCK_TYPE finalize_time = CLOCK_ZERO;
CLOCK_TYPE done_time;
# if defined(GC_ASSERTIONS) && defined(THREADS) \

View File

@ -230,9 +230,11 @@ void GC_print_callers(struct callinfo info[NFRAMES]);
#ifdef BSD_TIME
# undef CLOCK_TYPE
# undef CLOCK_ZERO
# undef GET_TIME
# undef MS_TIME_DIFF
# define CLOCK_TYPE struct timeval
# define CLOCK_ZERO {0, 0}
# define GET_TIME(x) { struct rusage rusage; \
getrusage (RUSAGE_SELF, &rusage); \
x = rusage.ru_utime; }
@ -243,6 +245,7 @@ void GC_print_callers(struct callinfo info[NFRAMES]);
# include <windows.h>
# include <winbase.h>
# define CLOCK_TYPE DWORD
# define CLOCK_ZERO 0
# define GET_TIME(x) x = GetTickCount()
# define MS_TIME_DIFF(a,b) ((long)((a)-(b)))
# else /* !MSWIN32, !MSWINCE, !BSD_TIME */
@ -268,6 +271,7 @@ void GC_print_callers(struct callinfo info[NFRAMES]);
*/
# endif
# define CLOCK_TYPE clock_t
# define CLOCK_ZERO 0
# define GET_TIME(x) x = clock()
# define MS_TIME_DIFF(a,b) ((unsigned long) \
(1000.0*(double)((a)-(b))/(double)CLOCKS_PER_SEC))

View File

@ -574,7 +574,7 @@ GC_bool GC_reclaim_all(GC_stop_func stop_func, GC_bool ignore_old)
struct obj_kind * ok;
struct hblk ** rlp;
struct hblk ** rlh;
CLOCK_TYPE start_time;
CLOCK_TYPE start_time = CLOCK_ZERO;
CLOCK_TYPE done_time;
if (GC_print_stats == VERBOSE)