20 #ifndef LIBMESH_PERFLOG_H 21 #define LIBMESH_PERFLOG_H 177 const char * header=
"");
188 void push (
const char * label,
189 const char * header=
"");
198 void push (
const std::string & label,
199 const std::string & header=
"");
208 const char * header=
"");
216 void pop (
const char * label,
217 const char * header=
"");
226 void pop (
const std::string & label,
227 const std::string & header=
"");
233 const std::string & header=
"");
239 const std::string & header=
"");
245 const std::string & header=
"");
251 const std::string & header=
"");
293 typedef std::map<std::pair<
const char *,
304 #ifdef LIBMESH_ENABLE_DEPRECATED 307 libmesh_deprecated();
361 std::vector<std::string> & output)
const;
383 gettimeofday (&(this->
tstart),
nullptr);
392 gettimeofday (&(this->
tstart),
nullptr);
410 tstart_tv_sec = this->
tstart.tv_sec,
411 tstart_tv_usec = this->
tstart.tv_usec;
413 gettimeofday (&(this->
tstart),
nullptr);
415 const double elapsed_time = (
static_cast<double>(this->
tstart.tv_sec - tstart_tv_sec) +
416 static_cast<double>(this->
tstart.tv_usec - tstart_tv_usec)*1.e-6);
422 const double elapsed_time_incl_sub = (
static_cast<double>(this->
tstart.tv_sec - this->
tstart_incl_sub.tv_sec) +
423 static_cast<double>(this->
tstart.tv_usec - this->tstart_incl_sub.tv_usec)*1.e-6);
436 gettimeofday (&(other.
tstart),
nullptr);
438 const double elapsed_time = (
static_cast<double>(other.
tstart.tv_sec - this->
tstart.tv_sec) +
439 static_cast<double>(other.
tstart.tv_usec - this->tstart.tv_usec)*1.e-6);
473 PerfData * perf_data = &(
log[std::make_pair(header,label)]);
487 const char * libmesh_dbg_var(header))
494 PerfData * perf_data = &(
log[std::make_pair(header,label)]);
497 libMesh::err <<
"PerfLog can't pop (" << header <<
',' << label <<
')' << std::endl;
498 libMesh::err <<
"From top of stack of running logs:" << std::endl;
501 libMesh::err <<
'(' << i.first.first <<
',' << i.first.second <<
')' << std::endl;
503 libmesh_assert_equal_to (perf_data,
log_stack.top());
523 gettimeofday (&tnow,
nullptr);
525 const double elapsed_time = (
static_cast<double>(tnow.tv_sec -
tstart.tv_sec) +
526 static_cast<double>(tnow.tv_usec -
tstart.tv_usec)*1.e-6);
540 #endif // LIBMESH_PERFLOG_H
void pop(const char *label, const char *header="")
const log_type & get_log_raw() const
void fast_push(const char *label, const char *header="")
Data object managed by PerfLog.
double get_elapsed_time() const
double pause_for(PerfData &other)
PerfLog(const std::string &label_name="", const bool log_events=true)
void stop_event(const std::string &label, const std::string &header="")
std::stack< PerfData * > log_stack
PerfData get_perf_data(const std::string &label, const std::string &header="")
Responsible for timing and summarizing events.
void fast_pop(const char *label, const char *header="")
std::string get_perf_info() const
const std::string label_name
double stop_or_pause(const bool do_stop)
double get_active_time() const
std::map< std::pair< const char *, const char * >, PerfData > log_type
std::string get_log() const
std::string get_info_header() const
void push(const char *label, const char *header="")
void restart_event(const std::string &label, const std::string &header="")
bool logging_enabled() const
OStreamProxy err(std::cerr)
void split_on_whitespace(const std::string &input, std::vector< std::string > &output) const
struct timeval tstart_incl_sub
void pause_event(const std::string &label, const std::string &header="")
std::map< std::string, const char * > non_temporary_strings
void start_event(const std::string &label, const std::string &header="")