Skip to content

Commit

Permalink
More PR fixes lintcpp and Linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
ivberg committed Dec 20, 2023
1 parent 076382a commit 533bc2a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
9 changes: 6 additions & 3 deletions onnxruntime/core/platform/windows/logging/etw_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <atomic>
#include <iostream>
#include <string>
#include <mutex>
#include <vector>

#include "core/common/logging/capture.h"
#include "core/common/logging/isink.h"
Expand Down Expand Up @@ -48,7 +48,9 @@ class EtwSink : public ISink {

class EtwRegistrationManager {
public:
using EtwInternalCallback = std::function<void(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext)>;
using EtwInternalCallback = std::function<void(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level,
ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword,
PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext)>;

// Singleton instance access
static EtwRegistrationManager& Instance();
Expand Down Expand Up @@ -80,7 +82,8 @@ class EtwRegistrationManager {
EtwRegistrationManager(EtwRegistrationManager&&) = delete;
EtwRegistrationManager& operator=(EtwRegistrationManager&&) = delete;

void InvokeCallbacks(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext);
void InvokeCallbacks(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword,
ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext);

static void NTAPI ORT_TL_EtwEnableCallback(
_In_ LPCGUID SourceId,
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/platform/windows/telemetry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <TraceLoggingProvider.h>
#include <evntrace.h>
#include "winmeta.h"
#include <winmeta.h>

// Seems this workaround can be dropped when we drop support for VS2017 toolchains
// https://developercommunity.visualstudio.com/content/problem/85934/traceloggingproviderh-is-incompatible-with-utf-8.html
Expand Down Expand Up @@ -179,7 +179,7 @@ void WindowsTelemetry::LogEvaluationStop() const {
return;

TraceLoggingWrite(telemetry_provider_handle,
"EvaluationStop", );
"EvaluationStop");
}

void WindowsTelemetry::LogEvaluationStart() const {
Expand Down
12 changes: 7 additions & 5 deletions onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ Status QnnBackendManager::ExtractBackendProfilingInfo() {
auto& provider = env.GetTelemetryProvider();
if (provider.IsEnabled()) {
auto keyword = provider.Keyword();
if ((keyword & static_cast<unsigned long long>(onnxruntime::logging::TLKeyword::Profiling)) != 0) {
if ((keyword & static_cast<uint64_t>(onnxruntime::logging::TLKeyword::Profiling)) != 0) {
tracelogging_provider_ep_enabled = true;
}
}
Expand All @@ -875,9 +875,11 @@ Status QnnBackendManager::ExtractBackendProfilingInfo() {

for (size_t event_idx = 0; event_idx < num_events; event_idx++) {
ORT_RETURN_IF_ERROR(
ExtractProfilingEvent(*(profile_events + event_idx), "ROOT", outfile, backendSupportsExtendedEventData, tracelogging_provider_ep_enabled));
ExtractProfilingEvent(*(profile_events + event_idx), "ROOT", outfile, backendSupportsExtendedEventData,
tracelogging_provider_ep_enabled));
ORT_RETURN_IF_ERROR(
ExtractProfilingSubEvents(*(profile_events + event_idx), outfile, backendSupportsExtendedEventData, tracelogging_provider_ep_enabled));
ExtractProfilingSubEvents(*(profile_events + event_idx), outfile, backendSupportsExtendedEventData,
tracelogging_provider_ep_enabled));
}

if (!tracelogging_provider_ep_enabled) {
Expand Down Expand Up @@ -996,6 +998,7 @@ Status QnnBackendManager::ExtractProfilingEventExtended(
<< (event_data_extended.v1.identifier ? event_data_extended.v1.identifier : "NULL") << "\n";
}
} else {
#ifdef _WIN32
LogQnnProfileEventAsTraceLogging(
event_data_extended.v1.timestamp,
message,
Expand All @@ -1004,6 +1007,7 @@ Status QnnBackendManager::ExtractProfilingEventExtended(
"BACKEND",
eventLevel,
(event_data_extended.v1.identifier ? event_data_extended.v1.identifier : "NULL"));
#endif
}

return Status::OK();
Expand All @@ -1017,7 +1021,6 @@ void QnnBackendManager::LogQnnProfileEventAsTraceLogging(
const std::string& timingSource,
const std::string& eventLevel,
const char* eventIdentifier) {
#ifdef _WIN32
TraceLoggingWrite(
telemetry_provider_handle,
"QNNProfilingEvent",
Expand All @@ -1030,7 +1033,6 @@ void QnnBackendManager::LogQnnProfileEventAsTraceLogging(
TraceLoggingString(timingSource.c_str(), "Timing Source"),
TraceLoggingString(eventLevel.c_str(), "Event Level"),
TraceLoggingString(eventIdentifier, "Event Identifier"));
#endif
}

const std::string& QnnBackendManager::GetUnitString(QnnProfile_EventUnit_t unitType) {
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/session/provider_registration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "core/providers/openvino/openvino_provider_factory_creator.h"

#ifdef _WIN32
#include <winmeta.h>
#include "core/platform/tracing.h"
#include "winmeta.h"
#endif

#if defined(USE_DML)
Expand Down

0 comments on commit 533bc2a

Please sign in to comment.