<commit_before>// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#pragma once

//
// WinMLTelemetryHelper provides a centralized location for managing all telemetry
// usage in the WinML COM runtime.  This aims to abstract all interaction with the
// TraceLogging APIs.
//
// A global instance of the helper is declared in precomp.h and defined in dll.cpp.
//

// TraceLogging includes
#include <winmeta.h>
#include <TraceLoggingProvider.h>

// Forward references
class WinMLRuntime;
typedef struct WinMLModelDescription {
  LPWSTR Author;
  LPWSTR Name;
  LPWSTR Domain;
  LPWSTR Description;
  SIZE_T Version;
} WinMLModelDescription;

template <typename T>
class Profiler;

// Schema versions.
#define WINML_TLM_PROCESS_INFO_SCHEMA_VERSION 0
#define WINML_TLM_CONTEXT_CREATION_VERSION 0
#define WINML_TLM_MODEL_CREATION_VERSION 0
#define WINML_TLM_RUNTIME_ERROR_VERSION 0
#define WINML_TLM_RUNTIME_PERF_VERSION 0

#define WinMLTraceLoggingWrite(hProvider, EventName, ...)                \
  TraceLoggingWrite(hProvider,                                           \
                    EventName,                                           \
                    TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), \
                    __VA_ARGS__)
//
// WinMLRuntime Telemetry Support
//
// {BCAD6AEE-C08D-4F66-828C-4C43461A033D}
#define WINML_PROVIDER_DESC "Windows AI Machine Learning"
#define WINML_PROVIDER_GUID (0xbcad6aee, 0xc08d, 0x4f66, 0x82, 0x8c, 0x4c, 0x43, 0x46, 0x1a, 0x3, 0x3d)
#define WINML_PROVIDER_KEYWORD_DEFAULT 0x1
#define WINML_PROVIDER_KEYWORD_LOTUS_PROFILING 0x2
#define WINML_PROVIDER_KEYWORD_START_STOP 0x4
struct MLOperatorKernelDescription;
struct MLOperatorSchemaDescription;

class WinMLTelemetryHelper {
 public:
  TraceLoggingHProvider provider_ = nullptr;
  // Flag indicating the success of registering our telemetry provider.
  bool telemetry_enabled_ = false;

  WinMLTelemetryHelper();
  ~WinMLTelemetryHelper();

  //<commit_msg>rename telemetry provider back to Microsoft.Windows.AI.MachineLearning (#4533)<commit_after>// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#pragma once

//
// WinMLTelemetryHelper provides a centralized location for managing all telemetry
// usage in the WinML COM runtime.  This aims to abstract all interaction with the
// TraceLogging APIs.
//
// A global instance of the helper is declared in precomp.h and defined in dll.cpp.
//

// TraceLogging includes
#include <winmeta.h>
#include <TraceLoggingProvider.h>

// Forward references
class WinMLRuntime;
typedef struct WinMLModelDescription {
  LPWSTR Author;
  LPWSTR Name;
  LPWSTR Domain;
  LPWSTR Description;
  SIZE_T Version;
} WinMLModelDescription;

template <typename T>
class Profiler;

// Schema versions.
#define WINML_TLM_PROCESS_INFO_SCHEMA_VERSION 0
#define WINML_TLM_CONTEXT_CREATION_VERSION 0
#define WINML_TLM_MODEL_CREATION_VERSION 0
#define WINML_TLM_RUNTIME_ERROR_VERSION 0
#define WINML_TLM_RUNTIME_PERF_VERSION 0

#define WinMLTraceLoggingWrite(hProvider, EventName, ...)                \
  TraceLoggingWrite(hProvider,                                           \
                    EventName,                                           \
                    TraceLoggingBool(true, "UTCReplace_AppSessionGuid"), \
                    __VA_ARGS__)
//
// WinMLRuntime Telemetry Support
//
// {BCAD6AEE-C08D-4F66-828C-4C43461A033D}
#define WINML_PROVIDER_DESC "Microsoft.Windows.AI.MachineLearning"
#define WINML_PROVIDER_GUID (0xbcad6aee, 0xc08d, 0x4f66, 0x82, 0x8c, 0x4c, 0x43, 0x46, 0x1a, 0x3, 0x3d)
#define WINML_PROVIDER_KEYWORD_DEFAULT 0x1
#define WINML_PROVIDER_KEYWORD_LOTUS_PROFILING 0x2
#define WINML_PROVIDER_KEYWORD_START_STOP 0x4
struct MLOperatorKernelDescription;
struct MLOperatorSchemaDescription;

class WinMLTelemetryHelper {
 public:
  TraceLoggingHProvider provider_ = nullptr;
  // Flag indicating the success of registering our telemetry provider.
  bool telemetry_enabled_ = false;

  WinMLTelemetryHelper();
  ~WinMLTelemetryHelper();

  //
{'fraction_non_alphanumeric': 0.0699317738791423, 'fraction_numerical': 0.028752436647173488, 'mean_word_length': 3.571269487750557, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6191768', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1293, 'n_words': 331}