Add cooked data read tracing (#10166)

Added trace to conhost to instrument buffers that are cooked prior to being passed to the console.
* [x] I've discussed this with core contributors already (internal)

VALIDATION
- Ensured trace is correctly logged in ETL (via TraceLog)
This commit is contained in:
David Kaplan 2021-05-24 22:24:01 +01:00 committed by GitHub
parent 52560ff818
commit 31e58809cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 2 deletions

View File

@ -1030,6 +1030,8 @@ void COOKED_READ_DATA::SavePendingInput(const size_t index, const bool multiline
WI_IsFlagSet(gci.Flags, CONSOLE_HISTORY_NODUP)));
}
Tracing::s_TraceCookedRead(_backupLimit);
// check for alias
ProcessAliases(LineCount);
}

View File

@ -20,7 +20,8 @@ enum TraceKeywords
Input = 0x200,
API = 0x400,
UIA = 0x800,
All = 0xFFF
CookedRead = 0x1000,
All = 0x1FFF
};
DEFINE_ENUM_FLAG_OPERATORS(TraceKeywords);
@ -404,6 +405,16 @@ void Tracing::s_TraceInputRecord(const INPUT_RECORD& inputRecord)
}
}
void Tracing::s_TraceCookedRead(_In_z_ const wchar_t* pwszCookedBuffer)
{
TraceLoggingWrite(
g_hConhostV2EventTraceProvider,
"CookedRead",
TraceLoggingWideString(pwszCookedBuffer, "ReadBuffer"),
TraceLoggingKeyword(TIL_KEYWORD_TRACE),
TraceLoggingKeyword(TraceKeywords::CookedRead));
}
void __stdcall Tracing::TraceFailure(const wil::FailureInfo& failure) noexcept
{
TraceLoggingWrite(

View File

@ -62,6 +62,8 @@ public:
static void s_TraceWindowMessage(const MSG& msg);
static void s_TraceInputRecord(const INPUT_RECORD& inputRecord);
static void s_TraceCookedRead(_In_z_ const wchar_t* pwszCookedBuffer);
static void __stdcall TraceFailure(const wil::FailureInfo& failure) noexcept;
private:

View File

@ -44,7 +44,7 @@
// See also https://osgwiki.com/wiki/TraceLogging#Semantics
//
// Note that Conhost had already defined some keywords
// between bits 0..11 so be sure to not overlap those.
// between bits 0..12 so be sure to not overlap those.
// See `TraceKeywords`.
// We will therefore try to reserve 32..42 for TIL
// as common flags for the entire Terminal team projects.