Skip to content

Commit 8d54276

Browse files
committed
fix: amend string parsing & add linking advapi32 in cmake
1 parent ac3b92f commit 8d54276

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

cmake/onnxruntime_providers_openvino.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
target_include_directories(onnxruntime_providers_openvino SYSTEM PUBLIC ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${OpenVINO_INCLUDE_DIR} ${OPENVINO_INCLUDE_DIR_LIST} ${PYTHON_INCLUDE_DIRS} $ENV{OPENCL_INCS} $ENV{OPENCL_INCS}/../../cl_headers/)
5252
target_link_libraries(onnxruntime_providers_openvino ${ONNXRUNTIME_PROVIDERS_SHARED} Boost::mp11 ${OPENVINO_LIB_LIST} ${ABSEIL_LIBS} Eigen3::Eigen onnx_proto)
5353

54+
# ETW TraceLogging depends on Advapi32 on Windows
55+
if(WIN32)
56+
target_link_libraries(onnxruntime_providers_openvino advapi32)
57+
endif()
58+
5459
target_compile_definitions(onnxruntime_providers_openvino PRIVATE FILE_NAME=\"onnxruntime_providers_openvino.dll\")
5560

5661
if(MSVC)

onnxruntime/core/providers/openvino/ov_telemetry.cc

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,10 @@ namespace {
3939
case '\r': escaped += "\\r"; break;
4040
case '\t': escaped += "\\t"; break;
4141
default:
42-
if (c < 0x20) {
43-
escaped += "\\u";
44-
escaped += "0000"[0];
45-
escaped += "0000"[1];
46-
char hex[3];
47-
sprintf_s(hex, "%02x", static_cast<unsigned char>(c));
48-
escaped += hex;
42+
if (static_cast<unsigned char>(c) < 0x20) {
43+
char unicode_escape[7];
44+
sprintf_s(unicode_escape, sizeof(unicode_escape), "\\u%04x", static_cast<unsigned char>(c));
45+
escaped += unicode_escape;
4946
} else {
5047
escaped += c;
5148
}
@@ -54,6 +51,24 @@ namespace {
5451
}
5552
return escaped;
5653
}
54+
55+
template<typename T>
56+
void AddOptionalValue(std::ostringstream& json, const std::string& key, const T& value, const T& default_value, bool& first) {
57+
if (value != default_value) {
58+
if (!first) json << ",";
59+
json << "\"" << key << "\":";
60+
if constexpr (std::is_same_v<T, std::string>) {
61+
json << "\"" << EscapeJsonString(value) << "\"";
62+
} else if constexpr (std::is_same_v<T, std::filesystem::path>) {
63+
json << "\"" << EscapeJsonString(value.string()) << "\"";
64+
} else if constexpr (std::is_same_v<T, bool>) {
65+
json << (value ? "true" : "false");
66+
} else {
67+
json << value;
68+
}
69+
first = false;
70+
}
71+
}
5772
}
5873

5974

@@ -119,25 +134,6 @@ UINT64 OVTelemetry::Keyword() const {
119134
return keyword_;
120135
}
121136

122-
template<typename T>
123-
void AddOptionalValue(std::ostringstream& json, const std::string& key, const T& value, const T& default_value, bool& first) {
124-
if (value != default_value) {
125-
if (!first) json << ",";
126-
json << "\"" << key << "\":";
127-
if constexpr (std::is_same_v<T, std::string>) {
128-
json << "\"" << EscapeJsonString(value) << "\"";
129-
} else if constexpr (std::is_same_v<T, std::filesystem::path>) {
130-
json << "\"" << EscapeJsonString(value.string()) << "\"";
131-
} else if constexpr (std::is_same_v<T, bool>) {
132-
json << (value ? "true" : "false");
133-
} else {
134-
json << value;
135-
}
136-
first = false;
137-
}
138-
}
139-
140-
141137
std::string OVTelemetry::SerializeLoadConfig(const SessionContext& ctx) const {
142138
if (ctx.load_config.empty()) return "{}";
143139

onnxruntime/core/providers/openvino/ov_telemetry.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <optional>
1717
#include <algorithm>
1818
#include "core/providers/openvino/contexts.h"
19-
#include "nlohmann/json.hpp"
2019

2120
TRACELOGGING_DECLARE_PROVIDER(ov_telemetry_provider_handle);
2221

@@ -26,7 +25,7 @@ namespace openvino_ep {
2625
namespace ov_keywords {
2726
constexpr uint64_t OV_PROVIDER = 0x1;
2827
constexpr uint64_t OV_SESSION = 0x2;
29-
constexpr uint64_t OV_OPTIONS = 0x3;
28+
constexpr uint64_t OV_OPTIONS = 0x4;
3029
}
3130

3231
class OVTelemetry {

0 commit comments

Comments
 (0)