MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / forward_and_record

Method forward_and_record

source/MaaRecordControlUnit/RecordController.cpp:244–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242
243template <typename ParamT>
244bool RecordController::forward_and_record(RecordType type, const ParamT& param, std::function<bool()> action_fn)
245{
246 auto start = std::chrono::steady_clock::now();
247 bool success = action_fn();
248 auto end = std::chrono::steady_clock::now();
249
250 auto timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(start - recording_start_).count();
251 auto cost = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
252
253 write_record(make_record_json(make_line(type, success, timestamp, static_cast<int>(cost)), param));
254 return success;
255}
256
257RecordLine RecordController::make_line(RecordType type, bool success, int64_t timestamp, int cost)
258{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected