1 /*
2  * Copyright 1997, Regents of the University of Minnesota
3  *
4  * timing.c
5  *
6  * This file contains routines that deal with timing Metis
7  *
8  * Started 7/24/97
9  * George
10  *
11  * $Id: timing.c,v 1.1 1998/11/27 17:59:32 karypis Exp $
12  *
13  */
14 
15 #include <metis.h>
16 
17 
18 /*************************************************************************
19 * This function clears the timers
20 **************************************************************************/
InitTimers(CtrlType * ctrl)21 void InitTimers(CtrlType *ctrl)
22 {
23   cleartimer(ctrl->TotalTmr);
24   cleartimer(ctrl->InitPartTmr);
25   cleartimer(ctrl->MatchTmr);
26   cleartimer(ctrl->ContractTmr);
27   cleartimer(ctrl->CoarsenTmr);
28   cleartimer(ctrl->UncoarsenTmr);
29   cleartimer(ctrl->RefTmr);
30   cleartimer(ctrl->ProjectTmr);
31   cleartimer(ctrl->SplitTmr);
32   cleartimer(ctrl->SepTmr);
33   cleartimer(ctrl->AuxTmr1);
34   cleartimer(ctrl->AuxTmr2);
35   cleartimer(ctrl->AuxTmr3);
36   cleartimer(ctrl->AuxTmr4);
37   cleartimer(ctrl->AuxTmr5);
38   cleartimer(ctrl->AuxTmr6);
39 }
40 
41 
42 
43 /*************************************************************************
44 * This function prints the various timers
45 **************************************************************************/
PrintTimers(CtrlType * ctrl)46 void PrintTimers(CtrlType *ctrl)
47 {
48   printf("\nTiming Information -------------------------------------------------");
49   printf("\n Multilevel: \t\t %7.3f", gettimer(ctrl->TotalTmr));
50   printf("\n     Coarsening: \t\t %7.3f", gettimer(ctrl->CoarsenTmr));
51   printf("\n            Matching: \t\t\t %7.3f", gettimer(ctrl->MatchTmr));
52   printf("\n            Contract: \t\t\t %7.3f", gettimer(ctrl->ContractTmr));
53   printf("\n     Initial Partition: \t %7.3f", gettimer(ctrl->InitPartTmr));
54   printf("\n   Construct Separator: \t %7.3f", gettimer(ctrl->SepTmr));
55   printf("\n     Uncoarsening: \t\t %7.3f", gettimer(ctrl->UncoarsenTmr));
56   printf("\n          Refinement: \t\t\t %7.3f", gettimer(ctrl->RefTmr));
57   printf("\n          Projection: \t\t\t %7.3f", gettimer(ctrl->ProjectTmr));
58   printf("\n     Splitting: \t\t %7.3f", gettimer(ctrl->SplitTmr));
59   printf("\n          AUX1: \t\t %7.3f", gettimer(ctrl->AuxTmr1));
60   printf("\n          AUX2: \t\t %7.3f", gettimer(ctrl->AuxTmr2));
61   printf("\n          AUX3: \t\t %7.3f", gettimer(ctrl->AuxTmr3));
62   printf("\n********************************************************************\n");
63 }
64 
65 
66 /*************************************************************************
67 * This function returns the seconds
68 **************************************************************************/
seconds(void)69 double seconds(void)
70 {
71   return((double) clock()/CLOCKS_PER_SEC);
72 }
73 
74 
75