User/brianma/telemetry (#5084)

* add runtime session id to (de)tensorization events

* append start or stop to the event names and remove opcodes

* add appsessionguid to telemetry events
This commit is contained in:
Brian Martin 2020-09-08 19:02:46 -07:00 committed by GitHub
parent 1b46573bb7
commit f41614a875
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 24 deletions

View file

@ -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(

View file

@ -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(

View file

@ -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() {