MCPcopy Create free account
hub / github.com/Compaile/ctrack / calc_stats_and_clear

Function calc_stats_and_clear

include/ctrack.hpp:1187–1214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1185 }
1186
1187 inline ctrack_result calc_stats_and_clear(ctrack_result_settings settings = {})
1188 {
1189 auto end = std::chrono::high_resolution_clock::now();
1190 ctrack_result res{settings, store::track_start_time, end};
1191
1192 // copy data
1193 {
1194 store::write_events_locked = true;
1195 std::this_thread::sleep_for(std::chrono::milliseconds(100));
1196 std::scoped_lock lock(store::event_mutex);
1197
1198 res.move_events_from_store(store::a_events);
1199 res.populate_maps();
1200
1201 for (int thread_id_ = 0; thread_id_ <= store::thread_cnt; thread_id_++)
1202 {
1203 auto &t_sub_events = store::a_sub_events[thread_id_];
1204 res.add_sub_events(t_sub_events, thread_id_);
1205 }
1206 clear_a_store();
1207 store::write_events_locked = false;
1208 }
1209
1210 res.calculate_stats();
1211 store::track_start_time = std::chrono::high_resolution_clock::now();
1212
1213 return res;
1214 }
1215
1216 inline void result_print(ctrack_result_settings settings = {})
1217 {

Callers 5

result_printFunction · 0.85
result_as_stringFunction · 0.85
result_get_tablesFunction · 0.85
result_get_summary_tableFunction · 0.85
result_get_detail_tableFunction · 0.85

Calls 5

clear_a_storeFunction · 0.85
populate_mapsMethod · 0.80
add_sub_eventsMethod · 0.80
calculate_statsMethod · 0.80

Tested by

no test coverage detected