diff --git a/winml/lib/Api.Image/TensorToVideoFrameConverter.cpp b/winml/lib/Api.Image/TensorToVideoFrameConverter.cpp index 2812053157..95b4dbbd0b 100644 --- a/winml/lib/Api.Image/TensorToVideoFrameConverter.cpp +++ b/winml/lib/Api.Image/TensorToVideoFrameConverter.cpp @@ -25,79 +25,97 @@ using namespace _winml; class GPUTensorToDX12TextureTelemetryEvent { public: GPUTensorToDX12TextureTelemetryEvent(const ImageTensorDescription& tensorDesc) { + runtime_session_id_ = telemetry_helper.GetRuntimeSessionId(); TraceLoggingWrite( winml_trace_logging_provider, - "GPUTensorToDX12Texture", + "GPUTensorToDX12TextureStart", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_START), TraceLoggingHexInt32(tensorDesc.channelType, "Type"), TraceLoggingInt64(tensorDesc.sizes[2], "Height"), TraceLoggingInt64(tensorDesc.sizes[3], "Width"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } ~GPUTensorToDX12TextureTelemetryEvent() { TraceLoggingWrite( winml_trace_logging_provider, - "GPUTensorToDX12Texture", + "GPUTensorToDX12TextureStop", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_STOP), TraceLoggingHexInt32(S_OK, "HRESULT"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } + +private: + int runtime_session_id_; }; class ConvertGPUTensorToSoftwareBitmapTelemetryEvent { public: ConvertGPUTensorToSoftwareBitmapTelemetryEvent(const ImageTensorDescription& tensorDesc) { + runtime_session_id_ = telemetry_helper.GetRuntimeSessionId(); TraceLoggingWrite( winml_trace_logging_provider, - "ConvertGPUTensorToSoftwareBitmap", + "ConvertGPUTensorToSoftwareBitmapStart", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_START), TraceLoggingHexInt32(tensorDesc.channelType, "Type"), TraceLoggingInt64(tensorDesc.sizes[2], "Height"), TraceLoggingInt64(tensorDesc.sizes[3], "Width"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } ~ConvertGPUTensorToSoftwareBitmapTelemetryEvent() { TraceLoggingWrite( winml_trace_logging_provider, - "ConvertGPUTensorToSoftwareBitmap", + "ConvertGPUTensorToSoftwareBitmapStop", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_STOP), TraceLoggingHexInt32(S_OK, "HRESULT"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } + +private: + int runtime_session_id_; }; class ConvertCPUTensorToVideoFrameWithSoftwareBitmapTelemetryEvent { public: ConvertCPUTensorToVideoFrameWithSoftwareBitmapTelemetryEvent(const ImageTensorDescription& tensorDesc) { + runtime_session_id_ = telemetry_helper.GetRuntimeSessionId(); TraceLoggingWrite( winml_trace_logging_provider, - "ConvertCPUTensorToVideoFrameWithSoftwareBitmap", + "ConvertCPUTensorToVideoFrameWithSoftwareBitmapStart", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_START), TraceLoggingHexInt32(tensorDesc.channelType, "Type"), TraceLoggingInt64(tensorDesc.sizes[2], "Height"), TraceLoggingInt64(tensorDesc.sizes[3], "Width"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } ~ConvertCPUTensorToVideoFrameWithSoftwareBitmapTelemetryEvent() { TraceLoggingWrite( winml_trace_logging_provider, - "ConvertCPUTensorToVideoFrameWithSoftwareBitmap", + "ConvertCPUTensorToVideoFrameWithSoftwareBitmapStop", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_STOP), TraceLoggingHexInt32(S_OK, "HRESULT"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } + +private: + int runtime_session_id_; }; void TensorToVideoFrameConverter::DX12TensorToVideoFrame( diff --git a/winml/lib/Api.Image/VideoFrameToTensorConverter.cpp b/winml/lib/Api.Image/VideoFrameToTensorConverter.cpp index 1eb82d6a97..d07cb39d2f 100644 --- a/winml/lib/Api.Image/VideoFrameToTensorConverter.cpp +++ b/winml/lib/Api.Image/VideoFrameToTensorConverter.cpp @@ -24,79 +24,97 @@ using namespace _winml; class DX12TextureToGPUTensorTelemetryEvent { public: DX12TextureToGPUTensorTelemetryEvent(const ImageTensorDescription& tensorDesc) { + runtime_session_id_ = telemetry_helper.GetRuntimeSessionId(); TraceLoggingWrite( winml_trace_logging_provider, - "DX12TextureToGPUTensor", + "DX12TextureToGPUTensorStart", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_START), TraceLoggingHexInt32(tensorDesc.channelType, "Type"), TraceLoggingInt64(tensorDesc.sizes[2], "Height"), TraceLoggingInt64(tensorDesc.sizes[3], "Width"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } ~DX12TextureToGPUTensorTelemetryEvent() { TraceLoggingWrite( winml_trace_logging_provider, - "DX12TextureToGPUTensor", + "DX12TextureToGPUTensorStop", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_STOP), TraceLoggingHexInt32(S_OK, "HRESULT"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } + +private: + int runtime_session_id_; }; class SoftwareBitmapToGPUTensorTelemetryEvent { public: SoftwareBitmapToGPUTensorTelemetryEvent(const ImageTensorDescription& tensorDesc) { + runtime_session_id_ = telemetry_helper.GetRuntimeSessionId(); TraceLoggingWrite( winml_trace_logging_provider, - "SoftwareBitmapToGPUTensor", + "SoftwareBitmapToGPUTensorStart", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_START), TraceLoggingHexInt32(tensorDesc.channelType, "Type"), TraceLoggingInt64(tensorDesc.sizes[2], "Height"), TraceLoggingInt64(tensorDesc.sizes[3], "Width"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } ~SoftwareBitmapToGPUTensorTelemetryEvent() { TraceLoggingWrite( winml_trace_logging_provider, - "SoftwareBitmapToGPUTensor", + "SoftwareBitmapToGPUTensorStop", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_STOP), TraceLoggingHexInt32(S_OK, "HRESULT"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } + +private: + int runtime_session_id_; }; class ConvertVideoFrameWithSoftwareBitmapToCPUTensorTelemetryEvent { public: ConvertVideoFrameWithSoftwareBitmapToCPUTensorTelemetryEvent(const ImageTensorDescription& tensorDesc) { + runtime_session_id_ = telemetry_helper.GetRuntimeSessionId(); TraceLoggingWrite( winml_trace_logging_provider, - "ConvertVideoFrameWithSoftwareBitmapToCPUTensor", + "ConvertVideoFrameWithSoftwareBitmapToCPUTensorStart", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_START), TraceLoggingHexInt32(tensorDesc.channelType, "Type"), TraceLoggingInt64(tensorDesc.sizes[2], "Height"), TraceLoggingInt64(tensorDesc.sizes[3], "Width"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } ~ConvertVideoFrameWithSoftwareBitmapToCPUTensorTelemetryEvent() { TraceLoggingWrite( winml_trace_logging_provider, - "ConvertVideoFrameWithSoftwareBitmapToCPUTensor", + "ConvertVideoFrameWithSoftwareBitmapToCPUTensorStop", TraceLoggingKeyword(WINML_PROVIDER_KEYWORD_DEFAULT), - TraceLoggingOpcode(EVENT_TRACE_TYPE_STOP), TraceLoggingHexInt32(S_OK, "HRESULT"), + TraceLoggingInt32(runtime_session_id_, "runtimeSessionId"), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage), + TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)); } + +private: + int runtime_session_id_; }; void VideoFrameToTensorConverter::VideoFrameToSoftwareTensor( diff --git a/winml/lib/Common/inc/WinMLTelemetryHelper.h b/winml/lib/Common/inc/WinMLTelemetryHelper.h index 062a51d809..7e3d025a09 100644 --- a/winml/lib/Common/inc/WinMLTelemetryHelper.h +++ b/winml/lib/Common/inc/WinMLTelemetryHelper.h @@ -103,6 +103,7 @@ class WinMLTelemetryHelper { uint32_t value); void EndRuntimeSession() { ++runtime_session_id_; }; bool IsMeasureSampled(); + int GetRuntimeSessionId() { return runtime_session_id_; } private: void RestartTimer() {