-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugReport.cpp
More file actions
48 lines (39 loc) · 838 Bytes
/
DebugReport.cpp
File metadata and controls
48 lines (39 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "stdafx.h"
#include "DebugReport.h"
#include <qdebug.h>
#include <qdatetime.h>
#include "GObjectHandler.h"
int DebugReport::ebene = 0;
void DebugReport::Start ()
{
qDebug () << GetTabs () + "START " << name.c_str ();
timer = QDateTime::currentMSecsSinceEpoch ();
++ebene;
}
void DebugReport::End ()
{
const qint64 current = QDateTime::currentMSecsSinceEpoch ();
const qint64 diff = current -timer;
--ebene;
qDebug() << GetTabs() + "END" << name.c_str() << " Executiontime: " << std::to_string (diff).c_str();
}
QString DebugReport::GetTabs ()
{
QString tabs;
for (int i = 0; i < ebene; ++i)
tabs += "---";
return tabs;
}
DebugReport::DebugReport (const std::string& _name)
: name (_name)
{
#ifdef REPORT
Start ();
#endif // REPORT
}
DebugReport::~DebugReport ()
{
#ifdef REPORT
End ();
#endif // REPORT
}