Remove uwp onsuspending winrt call because logruntimeperf is getting removed (#2630)

This commit is contained in:
Ryan Lai 2019-12-11 15:06:49 -08:00 committed by GitHub
parent 352c58d1b9
commit 75fbaa7255
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,15 +43,6 @@ inline onnxruntime::logging::LoggingManager& DefaultLoggingManager() {
return default_logging_manager;
}
static void OnSuspending(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::ApplicationModel::SuspendingEventArgs const& args) {
#ifdef LAYERING_DONE
if (!profiler.IsStillReset()) //If profiler is still reset, then don't log RuntimePerf
{
telemetry_helper.LogRuntimePerf(profiler, true);
}
#endif
}
class LotusEnvironment {
public:
LotusEnvironment() {
@ -74,14 +65,10 @@ class LotusEnvironment {
[](int) { return std::make_unique<onnxruntime::CPUAllocator>(); },
std::numeric_limits<size_t>::max());
}
RegisterSuspendHandler();
}
~LotusEnvironment() {
TraceLoggingUnregister(winmla::winml_trace_logging_provider);
if (suspend_token_) {
winrt::Windows::ApplicationModel::Core::CoreApplication::Suspending(suspend_token_);
}
}
const onnxruntime::logging::Logger* GetDefaultLogger() {
@ -89,15 +76,7 @@ class LotusEnvironment {
}
private:
void RegisterSuspendHandler() {
try {
suspend_token_ = winrt::Windows::ApplicationModel::Core::CoreApplication::Suspending(
winrt::Windows::Foundation::EventHandler<winrt::Windows::ApplicationModel::SuspendingEventArgs>(&OnSuspending));
} catch (...) {}//Catch in case CoreApplication cannot be found for non-UWP executions
}
std::unique_ptr<onnxruntime::Environment> lotus_environment_;
winrt::event_token suspend_token_;
onnxruntime::logging::LoggingManager* default_logging_manager_;
};