c910045187
*cfc72cee
(origin/dev/duhowett/ibxint, github/master) Make sure cursor blinks after opening new tab (1030) *9ad25440
Fix #936: misuse of uninitialized objects causes AppVerifier breaks on Windows Terminal startup (1015) *5f938a04
Update Terminal.cpp (1034) *4c47631b
Cleanup - termDispatch.hpp & adaptDispatch.hpp overrides (1004) *cc304759
add audit mode to ci (948) *80f10796
Fix the bell sound when Alt+key is pressed. (1006) *42e87ed3
fix build break from using `await` instead of `co_await` (1009) *40b557a4
Update manifest to correct 1903 version, unref param fix (1008) *0f62ec81
Eat all tap keypresses no matter what. (985) *ce0eaab9
inbox: Merge accumulated build fixes from RS_ONECORE_DEP_ACIOSS (1002) *1c509683
add .editorconfig file (585) *efd69990
Add support for OSC 10 and 11 to set the default colors (891) Related work items: #21610659, #21838182
119 lines
2.9 KiB
C++
119 lines
2.9 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
/*
|
|
Module Name:
|
|
- telemetry.hpp
|
|
|
|
Abstract:
|
|
- This module is used for recording all telemetry feedback from the console virtual terminal parser
|
|
*/
|
|
#pragma once
|
|
|
|
// Including TraceLogging essentials for the binary
|
|
#include <windows.h>
|
|
#include <winmeta.h>
|
|
#include <TraceLoggingProvider.h>
|
|
#include "limits.h"
|
|
|
|
TRACELOGGING_DECLARE_PROVIDER(g_hConsoleVirtTermParserEventTraceProvider);
|
|
|
|
namespace Microsoft::Console::VirtualTerminal
|
|
{
|
|
class TermTelemetry sealed
|
|
{
|
|
|
|
public:
|
|
// Implement this as a singleton class.
|
|
static TermTelemetry& Instance()
|
|
{
|
|
static TermTelemetry s_Instance;
|
|
return s_Instance;
|
|
}
|
|
|
|
// Names primarily from http://inwap.com/pdp10/ansicode.txt
|
|
enum Codes
|
|
{
|
|
CUU = 0,
|
|
CUD,
|
|
CUF,
|
|
CUB,
|
|
CNL,
|
|
CPL,
|
|
CHA,
|
|
CUP,
|
|
ED,
|
|
EL,
|
|
SGR,
|
|
DECSC,
|
|
DECRC,
|
|
DECSET,
|
|
DECRST,
|
|
DECKPAM,
|
|
DECKPNM,
|
|
DSR,
|
|
DA,
|
|
VPA,
|
|
ICH,
|
|
DCH,
|
|
SU,
|
|
SD,
|
|
ANSISYSSC,
|
|
ANSISYSRC,
|
|
IL,
|
|
DL,
|
|
DECSTBM,
|
|
RI,
|
|
OSCWT,
|
|
HTS,
|
|
CHT,
|
|
CBT,
|
|
TBC,
|
|
ECH,
|
|
DesignateG0,
|
|
DesignateG1,
|
|
DesignateG2,
|
|
DesignateG3,
|
|
HVP,
|
|
DECSTR,
|
|
RIS,
|
|
DECSCUSR,
|
|
DTTERM_WM,
|
|
OSCCT,
|
|
OSCSCC,
|
|
OSCRCC,
|
|
REP,
|
|
OSCFG,
|
|
OSCBG,
|
|
// Only use this last enum as a count of the number of codes.
|
|
NUMBER_OF_CODES
|
|
};
|
|
void Log(const Codes code);
|
|
void LogFailed(const wchar_t wch);
|
|
void SetShouldWriteFinalLog(const bool writeLog);
|
|
void SetActivityId(const GUID *activityId);
|
|
unsigned int GetAndResetTimesUsedCurrent();
|
|
unsigned int GetAndResetTimesFailedCurrent();
|
|
unsigned int GetAndResetTimesFailedOutsideRangeCurrent();
|
|
|
|
private:
|
|
// Used to prevent multiple instances
|
|
TermTelemetry();
|
|
~TermTelemetry();
|
|
TermTelemetry(TermTelemetry const&);
|
|
void operator=(TermTelemetry const&);
|
|
|
|
void WriteFinalTraceLog() const;
|
|
|
|
unsigned int _uiTimesUsedCurrent;
|
|
unsigned int _uiTimesFailedCurrent;
|
|
unsigned int _uiTimesFailedOutsideRangeCurrent;
|
|
unsigned int _uiTimesUsed[NUMBER_OF_CODES];
|
|
unsigned int _uiTimesFailed[CHAR_MAX + 1];
|
|
unsigned int _uiTimesFailedOutsideRange;
|
|
GUID _activityId;
|
|
|
|
bool _fShouldWriteFinalLog;
|
|
};
|
|
}
|