MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / HXTAfterMark

Method HXTAfterMark

src/hx/Telemetry.cpp:253–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251 }
252
253 static void HXTAfterMark(int gByteMarkID, int ENDIAN_MARK_ID_BYTE)
254 {
255 double t0 = __hxcpp_time_stamp();
256
257 Telemetry* telemetry = 0;
258 alloc_mutex.lock();
259 std::map<void*, hx::Telemetry*>::iterator iter = alloc_map.begin();
260 while (iter != alloc_map.end()) {
261 void* obj = iter->first;
262 unsigned char mark = ((unsigned char *)obj)[ENDIAN_MARK_ID_BYTE];
263 if ( mark!=gByteMarkID ) {
264 // not marked, deallocated
265 telemetry = iter->second;
266 if (telemetry) {
267 int obj_id = __hxt_ptr_id(obj);
268 telemetry->reclaim(obj_id);
269 }
270 alloc_map.erase(iter++);
271 } else {
272 iter++;
273 }
274 }
275 alloc_mutex.unlock();
276
277 // Report overhead on one of the telemetry instances
278 // TODO: something better?
279 if (telemetry) {
280 telemetry->gcOverhead += __hxcpp_time_stamp() - t0;
281 }
282 }
283
284private:
285

Callers

nothing calls this directly

Calls 4

__hxcpp_time_stampFunction · 0.85
__hxt_ptr_idFunction · 0.85
eraseMethod · 0.80
reclaimMethod · 0.45

Tested by

no test coverage detected