* @return max value
*/
static int64_t getMax() { return _MAX; }
+ /**
+ * @brief Update metrics file with new data.
+ */
+ void uploadOperationsExecTime() const { _json.uploadOperationsExecTime(); }
static const int64_t NOT_FOUND = -1;
private:
}
loadOperationsExecTime();
};
- ~JSON() { uploadOperationsExecTime(); };
+ /**
+ * @brief Update _operations_exec_time_file with new data.
+ */
+ void uploadOperationsExecTime() const;
private:
///@brief file containing measurements
* @brief Parse and load operations_exec_time from _operations_exec_time_file.
*/
void loadOperationsExecTime();
- /**
- * @brief Update _operations_exec_time_file with new data.
- */
- void uploadOperationsExecTime() const;
};
} // namespace backend
public:
virtual void handleBegin(IExecutor *, const model::Operation *, const backend::Backend *) = 0;
virtual void handleEnd(IExecutor *, const model::Operation *, const backend::Backend *) = 0;
+ virtual void uploadExecTime() = 0;
virtual ~IExecutionObserver() = default;
};
explicit ProfileObserver(std::shared_ptr<backend::ExecTime> et) : _et(std::move(et)) {}
void handleBegin(IExecutor *, const model::Operation *, const backend::Backend *) override;
void handleEnd(IExecutor *, const model::Operation *, const backend::Backend *) override;
+ void uploadExecTime() override { _et->uploadOperationsExecTime(); }
private:
std::chrono::steady_clock::time_point _prev_time;
_finished_jobs[job_index] = std::move(job);
}
assert(noWaitingJobs());
-
+ if (is_profiling)
+ {
+ for (auto &o : _observers)
+ {
+ o->uploadExecTime();
+ }
+ }
// Reset input info for the next execution
_input_info = _initial_input_info;
}
et.updateOperationExecTime(b, "op1", true, 100, 100);
et.updateOperationExecTime(b, "op1", true, 200, 200);
et.updateOperationExecTime(b, "op1", false, 100, 888);
+ et.uploadOperationsExecTime();
}
{
ExecTime et(bs);
ASSERT_EQ(time, 150);
time = et.getOperationExecTime(b, "op1", false, 100);
ASSERT_EQ(time, 888);
+ et.uploadOperationsExecTime();
}
// clean up
remove("exec_time.json");
ExecTime et(bs);
et.updateOperationExecTime(b, "op1", true, 100, 100);
et.updateOperationExecTime(b, "op1", true, 200, 200);
+ et.uploadOperationsExecTime();
}
{
ExecTime et(bs);
// Check interpolation
time = et.getOperationExecTime(b, "op1", true, 200);
ASSERT_EQ(time, 200);
+ et.uploadOperationsExecTime();
}
// clean up
remove("exec_time.json");