Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TimeMeasurementHelper.c
Go to the documentation of this file.
1
26{
27 protected ref map<string, ref SCR_TimeMeasurementHelper_Info> m_mData;
28
29 //------------------------------------------------------------------------------------------------
32 void BeginMeasure(string name)
33 {
34 SCR_TimeMeasurementHelper_Info info = m_mData.Get(name);
35 if (!info)
36 {
38 m_mData.Insert(name, info);
39 }
40
41 info.m_fStart = System.GetTickCount();
42 }
43
44 //------------------------------------------------------------------------------------------------
48 void EndMeasure(string name)
49 {
50 SCR_TimeMeasurementHelper_Info info = m_mData.Get(name);
51 if (!info)
52 {
53 Print("No measurement named \"" + name + "\" was found", LogLevel.WARNING);
54 return;
55 }
56
57 info.m_fTotal += System.GetTickCount(info.m_fStart);
58 }
59
60 //------------------------------------------------------------------------------------------------
66 float GetMeasure(string name)
67 {
68 SCR_TimeMeasurementHelper_Info info = m_mData.Get(name);
69 if (!info)
70 {
71 Print("No measurement named \"" + name + "\" was found", LogLevel.WARNING);
72 return -1;
73 }
74
75 return info.m_fTotal;
76 }
77
78 //------------------------------------------------------------------------------------------------
81 {
82 foreach (string name, SCR_TimeMeasurementHelper_Info info : m_mData)
83 {
84 Print("Measure \"" + name + "\": " + info.m_fTotal + " ms", LogLevel.NORMAL);
85 }
86 }
87
88 //------------------------------------------------------------------------------------------------
90 void Reset()
91 {
92 m_mData.Clear();
93 }
94
95 //------------------------------------------------------------------------------------------------
96 // constructor
101}
102
103// databag
105{
106 int m_fStart;
107 int m_fTotal;
108}
void PrintAllMeasures()
Print all measurements to the console, ended or not.
void SCR_TimeMeasurementHelper()
void EndMeasure(string name)
void BeginMeasure(string name)
float GetMeasure(string name)
Definition Types.c:486
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
void Reset()