FAUST compiler  0.9.9.6b8
Functions | Variables
timing.cpp File Reference
#include <iostream>
#include <cassert>
#include <sys/time.h>
#include "compatibility.hh"
#include "timing.hh"
Include dependency graph for timing.cpp:

Go to the source code of this file.

Functions

double mysecond ()
 
static void tab (int n, ostream &fout)
 
void startTiming (const char *msg)
 
void endTiming (const char *msg)
 

Variables

bool gTimingSwitch
 
int lIndex =0
 
double lStartTime [1024]
 
double lEndTime [1024]
 

Function Documentation

void endTiming ( const char *  msg)

Definition at line 43 of file timing.cpp.

References gTimingSwitch, lEndTime, lIndex, lStartTime, mysecond(), and tab().

Referenced by main(), ScalarCompiler::prepare(), and ScalarCompiler::prepare2().

44 {
45  if (gTimingSwitch) {
46  assert(lIndex>0);
47  lEndTime[--lIndex] = mysecond();
48  tab(lIndex, cerr); cerr << "end " << msg << " (duration : " << lEndTime[lIndex] - lStartTime[lIndex] << ")" << endl;
49  }
50 }
static void tab(int n, ostream &fout)
Definition: timing.cpp:28
double lEndTime[1024]
Definition: timing.cpp:26
double lStartTime[1024]
Definition: timing.cpp:25
bool gTimingSwitch
Definition: main.cpp:115
double mysecond()
Definition: timing.cpp:14
int lIndex
Definition: timing.cpp:24

Here is the call graph for this function:

Here is the caller graph for this function:

double mysecond ( )

Definition at line 14 of file timing.cpp.

Referenced by endTiming(), and startTiming().

15 {
16  struct timeval tp;
17  struct timezone tzp;
18  int i;
19 
20  i = gettimeofday(&tp,&tzp);
21  return ( (double) tp.tv_sec + (double) tp.tv_usec * 1.e-6 );
22 }

Here is the caller graph for this function:

void startTiming ( const char *  msg)

Definition at line 34 of file timing.cpp.

References gTimingSwitch, lIndex, lStartTime, mysecond(), and tab().

Referenced by main(), ScalarCompiler::prepare(), and ScalarCompiler::prepare2().

35 {
36  if (gTimingSwitch) {
37  assert(lIndex < 1023);
38  tab(lIndex, cerr); cerr << "start " << msg << endl;
39  lStartTime[lIndex++] = mysecond();
40  }
41 }
static void tab(int n, ostream &fout)
Definition: timing.cpp:28
double lStartTime[1024]
Definition: timing.cpp:25
bool gTimingSwitch
Definition: main.cpp:115
double mysecond()
Definition: timing.cpp:14
int lIndex
Definition: timing.cpp:24

Here is the call graph for this function:

Here is the caller graph for this function:

static void tab ( int  n,
ostream &  fout 
)
static

Definition at line 28 of file timing.cpp.

Referenced by endTiming(), and startTiming().

29 {
30  fout << '\n';
31  while (n--) fout << '\t';
32 }

Here is the caller graph for this function:

Variable Documentation

bool gTimingSwitch

Definition at line 115 of file main.cpp.

Referenced by endTiming(), process_cmdline(), and startTiming().

double lEndTime[1024]

Definition at line 26 of file timing.cpp.

Referenced by endTiming().

int lIndex =0

Definition at line 24 of file timing.cpp.

Referenced by endTiming(), and startTiming().

double lStartTime[1024]

Definition at line 25 of file timing.cpp.

Referenced by endTiming(), and startTiming().