12#if defined(QDP_USE_PROFILING)
22#ifdef QDP_USE_PROFILING
23static bool prof_init =
false;
32 gettimeofday(&tp,NULL);
33 return((
unsigned long)tp.tv_sec * 1000000 + (
unsigned long)tp.tv_usec);
45#if ! defined(QDP_USE_PROFILING)
51void initProfile(
const std::string& file,
const std::string& caller,
int line) {}
57void pushProfileInfo(
int level,
const std::string& file,
const std::string& caller,
int line) {}
67std::stack<QDPProfileInfo_t> infostack;
70std::queue<QDPProfileHead_t> profqueue;
89 <<
"\t[" << time <<
"]" << std::endl;
94initProfile(
const std::string& file,
const std::string& caller,
int line)
115 if (profqueue.size() == 0)
118 while(! profqueue.empty())
120 QDPProfileHead_t& head = profqueue.front();
124 QDPProfile_t *qp = head.start;
127 <<
"func = " << head.info.caller
128 <<
" line = " << head.info.line
129 <<
" file = " << head.info.file
144 sprintf(lin,
" %7d [%8d] ", qp->count, qp->time);
172void pushProfileInfo(
int level,
const std::string& file,
const std::string& caller,
int line)
174 QDPProfileInfo_t info(level, file, caller, line);
175 infostack.push(info);
179 QDPProfileHead_t head(infostack.top());
180 profqueue.push(head);
185 <<
"func = " << head.info.caller
186 <<
" line = " << head.info.line
187 <<
" file = " << head.info.file
194 if (infostack.empty())
196 QDPIO::cerr <<
"popProfileInfo: invalid pop" << std::endl;
200 QDPProfileInfo_t& info = infostack.top();
207registerProfile(QDPProfile_t* qp)
209 if (profqueue.empty())
211 QDPIO::cerr <<
"registerProfile: profile queue empty" << std::endl;
215 QDPProfileHead_t& head = profqueue.back();
218 head.start = head.end = qp;
StandardOutputStream cout
StandardOutputStream cerr
Yet another random number generator.
int getProgramProfileLevel()
QDPTime_t getClockTime()
Get the wallclock time.
int setProfileLevel(int n)
void pushProfileInfo(int level, const std::string &file, const std::string &caller, int line)
int setProgramProfileLevel(int n)
static int prog_prof_level
void QDP_abort(int status)
Panic button.
void initProfile(const std::string &file, const std::string &caller, int line)
Primary include file for QDP.