| 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 | { |
no test coverage detected