#include <timer.h>
|
| anchor (const char *aSubFunc, const char *aFunc=__builtin_FUNCTION(), int aLine=__builtin_LINE(), const char *aFile=__builtin_FILE()) |
|
const char * | getFunc () const |
|
const char * | getFile () const |
|
int | getLine () const |
|
|
static void | print (std::ostream &out, const std::string &prefix) |
|
static void | reset () |
|
Definition at line 22 of file timer.h.
◆ anchor()
timer::anchor::anchor |
( |
const char * |
aSubFunc, |
|
|
const char * |
aFunc = __builtin_FUNCTION() , |
|
|
int |
aLine = __builtin_LINE() , |
|
|
const char * |
aFile = __builtin_FILE() |
|
) |
| |
|
inline |
Definition at line 56 of file timer.h.
60 #else // no info available....
61 anchor(
const char * aSubFunc,
62 const char *aFunc =
"unknown",
64 const char *aFile =
"unknown"):
References getList(), and listMutex.
◆ getFile()
const char* timer::anchor::getFile |
( |
| ) |
const |
|
inline |
◆ getFunc()
const char* timer::anchor::getFunc |
( |
| ) |
const |
|
inline |
◆ getLine()
int timer::anchor::getLine |
( |
| ) |
const |
|
inline |
◆ getList()
◆ print()
void timer::anchor::print |
( |
std::ostream & |
out, |
|
|
const std::string & |
prefix |
|
) |
| |
|
static |
Definition at line 5 of file timer.cpp.
7 unsigned int totalCalls = 0;
9 for (
const auto item :
getList()) {
10 double t = item->timeSpent / 1e9;
12 << item->getFile() <<
":"
13 << item->getLine() <<
": "
14 << item->getFunc() <<
": "
15 << item->subfunc <<
": "
16 << item->counter <<
" avg ";
17 if (item->counter > 0) {
18 out << t / item->counter <<
"s tot ";
23 out << item->maxTimeSpent/ 1e9 <<
"s \n";
25 totalCalls += item->counter;
27 out << prefix <<
"spent " << totalTime <<
"s in " << totalCalls <<
" calls\n";
References getList(), and listMutex.
Referenced by main(), and copyRequest::base::printStats().
◆ reset()
static void timer::anchor::reset |
( |
| ) |
|
|
inlinestatic |
◆ instanceUnscoped
◆ pointerCompare
◆ counter
std::atomic<int> timer::anchor::counter |
|
private |
◆ file
const char* timer::anchor::file |
|
private |
◆ function
const char* timer::anchor::function |
|
private |
◆ line
◆ listMutex
std::mutex timer::anchor::listMutex |
|
staticprivate |
◆ maxTimeSpent
std::atomic<std::int64_t> timer::anchor::maxTimeSpent |
|
private |
◆ subfunc
const char* timer::anchor::subfunc |
|
private |
◆ timeSpent
std::atomic<std::uint64_t> timer::anchor::timeSpent |
|
private |
The documentation for this class was generated from the following files: