mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-13 01:09:22 +00:00
Add log to allow serving platforms to quantify ORT usage. (#7476)
This commit is contained in:
parent
8e21329206
commit
da5c9263e9
2 changed files with 25 additions and 1 deletions
|
|
@ -13,7 +13,7 @@ enum class Severity {
|
|||
kINFO = 1,
|
||||
kWARNING = 2,
|
||||
kERROR = 3,
|
||||
kFATAL = 4
|
||||
kFATAL = 4,
|
||||
};
|
||||
|
||||
constexpr const char* SEVERITY_PREFIX = "VIWEF";
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#include "core/session/onnxruntime_session_options_config_keys.h"
|
||||
#include "core/util/protobuf_parsing_utils.h"
|
||||
#include "core/util/thread_utils.h"
|
||||
#include "onnxruntime_config.h"
|
||||
|
||||
// custom ops are not available in a minimal build unless ORT_MINIMAL_BUILD_CUSTOM_OPS is set
|
||||
#if !defined(ORT_MINIMAL_BUILD) || defined(ORT_MINIMAL_BUILD_CUSTOM_OPS)
|
||||
|
|
@ -292,6 +293,29 @@ void InferenceSession::ConstructorCommon(const SessionOptions& session_options,
|
|||
// a monotonically increasing session id for use in telemetry
|
||||
session_id_ = global_session_id_.fetch_add(1);
|
||||
allocator_manager_ = std::make_shared<onnxruntime::AllocatorManager>();
|
||||
|
||||
// Add log to allow serving platforms to quantify ORT usage.
|
||||
// To avoid flooding the test logs, this is done for non-debug mode only
|
||||
// TODO: plug-in a platform specific telemetry provider to send the telemetry to
|
||||
#ifdef NDEBUG
|
||||
#ifdef _WIN32
|
||||
std::wostringstream ostr;
|
||||
#else
|
||||
std::ostringstream ostr;
|
||||
#endif
|
||||
// Format: "ORT Telemetry: Ver = 1.7.0; Event = EventName (event_attr1: foo.onnx, event_attr2: 400us)"
|
||||
// Format: "ORT Telemetry: Ver = 1.7.0; Event = SessionCreation (model: foo.onnx, ts: 400us)"
|
||||
ostr << "ORT Telemetry: "
|
||||
<< "Ver = " << ORT_VERSION << "; Event = SessionCreation";
|
||||
if (!model_location_.empty()) {
|
||||
ostr << " (model: " << model_location_ << ")";
|
||||
}
|
||||
#ifdef _WIN32
|
||||
std::wcout << ostr.str() << "\n";
|
||||
#else
|
||||
std::cout << ostr.str() << "\n";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
InferenceSession::InferenceSession(const SessionOptions& session_options, const Environment& session_env)
|
||||
|
|
|
|||
Loading…
Reference in a new issue