mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-26 22:35:43 +00:00
Add missing guards to profiling calls (#1374)
* guard remaining profiler calls * enforce proper usage of profile class
This commit is contained in:
parent
aa041026e3
commit
ecfbb1bb99
2 changed files with 13 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ profiling::Profiler::~Profiler() {}
|
|||
#endif
|
||||
|
||||
::onnxruntime::TimePoint profiling::Profiler::StartTime() const {
|
||||
ORT_ENFORCE(enabled_);
|
||||
return std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,10 @@ common::Status InferenceSession::RegisterCustomRegistry(std::shared_ptr<CustomRe
|
|||
|
||||
common::Status InferenceSession::Load(std::function<common::Status(std::shared_ptr<Model>&)> loader, const std::string& event_name) {
|
||||
Status status = Status::OK();
|
||||
auto tp = session_profiler_.StartTime();
|
||||
TimePoint tp;
|
||||
if (session_profiler_.IsEnabled()) {
|
||||
tp = session_profiler_.StartTime();
|
||||
}
|
||||
try {
|
||||
std::lock_guard<onnxruntime::OrtMutex> l(session_mutex_);
|
||||
if (is_model_loaded_) { // already loaded
|
||||
|
|
@ -539,7 +542,10 @@ common::Status InferenceSession::InitializeSubgraphSessions(Graph& graph, Sessio
|
|||
|
||||
common::Status InferenceSession::Initialize() {
|
||||
Status status = Status::OK();
|
||||
auto tp = session_profiler_.StartTime();
|
||||
TimePoint tp;
|
||||
if (session_profiler_.IsEnabled()) {
|
||||
tp = session_profiler_.StartTime();
|
||||
}
|
||||
|
||||
try {
|
||||
LOGS(*session_logger_, INFO) << "Initializing session.";
|
||||
|
|
@ -775,7 +781,10 @@ common::Status InferenceSession::ValidateOutputs(const std::vector<std::string>&
|
|||
Status InferenceSession::Run(const RunOptions& run_options, const std::vector<std::string>& feed_names,
|
||||
const std::vector<OrtValue>& feeds, const std::vector<std::string>& output_names,
|
||||
std::vector<OrtValue>* p_fetches) {
|
||||
auto tp = session_profiler_.StartTime();
|
||||
TimePoint tp;
|
||||
if (session_profiler_.IsEnabled()) {
|
||||
tp = session_profiler_.StartTime();
|
||||
}
|
||||
Status retval = Status::OK();
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue