MCPcopy Create free account
hub / github.com/Kitware/VTK / MarkEventInternal

Method MarkEventInternal

Common/System/vtkTimerLog.cxx:133–241  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Record a timing event and capture walltime and cputicks.

Source from the content-addressed store, hash-verified

131//------------------------------------------------------------------------------
132// Record a timing event and capture walltime and cputicks.
133void vtkTimerLog::MarkEventInternal(
134 const char* event, vtkTimerLogEntry::LogEntryType type, vtkTimerLogEntry* entry)
135{
136 if (!vtkTimerLog::Logging)
137 {
138 return;
139 }
140
141 double time_diff;
142 int ticks_diff;
143
144 auto& global_entries = vtkGetTimerLogEntryVector();
145
146 // If this the first event we're recording, allocate the
147 // internal timing table and initialize WallTime and CpuTicks
148 // for this first event to zero.
149 if (vtkTimerLog::NextEntry == 0 && !vtkTimerLog::WrapFlag)
150 {
151 if (global_entries.empty())
152 {
153 global_entries.resize(vtkTimerLog::MaxEntries);
154 }
155
156#ifdef _WIN32
157#ifdef _WIN32_WCE
158 SYSTEMTIME st;
159 GetLocalTime(&st);
160 SystemTimeToFileTime(&st, &(vtkTimerLog::FirstWallTime));
161#else
162 ::ftime(&(vtkTimerLog::FirstWallTime));
163#endif
164#else
165 gettimeofday(&(vtkTimerLog::FirstWallTime), nullptr);
166 times(&FirstCpuTicks);
167#endif
168
169 if (entry)
170 {
171 global_entries[0] = *entry;
172 }
173 else
174 {
175 global_entries[0].Indent = vtkTimerLog::Indent;
176 global_entries[0].WallTime = 0.0;
177 global_entries[0].CpuTicks = 0;
178 if (event)
179 {
180 global_entries[0].Event = event;
181 }
182 global_entries[0].Type = type;
183 vtkTimerLog::NextEntry = 1;
184 }
185 return;
186 }
187
188 if (entry)
189 {
190 global_entries[vtkTimerLog::NextEntry] = *entry;

Callers

nothing calls this directly

Calls 3

gettimeofdayFunction · 0.85
emptyMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected