Skip to content

Commit

Permalink
Add an option to use an alternate kernel logger
Browse files Browse the repository at this point in the history
Normally ETW tracing is done by using "NT Kernel Logger", however on at
least one machine this fails because this logger is in use and cannot be
halted. To support those machines UIforETW will now alternately use
"Circular Kernel Context Logger", if that option is checked in the
settings dialog.

Note that metrace.bat always uses "Circular Kernel Context Logger" in
order to allow tracing the recording of traces. This will not work if
the alternate kernel logger is selected - etwrecord.bat will need to be
used instead.

Most users should never need this check box.
  • Loading branch information
Bruce Dawson committed Nov 20, 2016
1 parent b8c1e1d commit 6368343
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 4 deletions.
4 changes: 3 additions & 1 deletion UIforETW/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
#define IDC_CHECKFORNEWVERSIONS 1035
#define IDC_TRACESIZE 1036
#define IDC_SELECT_PERF_COUNTERS 1037
#define IDC_CHECK4 1038
#define IDC_USE_OTHER_KERNEL_LOGGER 1038
#define ID_TRACES_OPENTRACEINWPA 32771
#define ID_TRACES_DELETETRACE 32772
#define ID_TRACES_COMPRESSTRACE 32773
Expand Down Expand Up @@ -106,7 +108,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 138
#define _APS_NEXT_COMMAND_VALUE 32812
#define _APS_NEXT_CONTROL_VALUE 1038
#define _APS_NEXT_CONTROL_VALUE 1039
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
12 changes: 12 additions & 0 deletions UIforETW/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ CSettings::~CSettings()

void CSettings::DoDataExchange(CDataExchange* pDX)
{
// This is needed to get tooltips working.
DDX_Control(pDX, IDC_HEAPEXE, btHeapTracingExe_);
DDX_Control(pDX, IDC_WSMONITOREDPROCESSES, btWSMonitoredProcesses_);
DDX_Control(pDX, IDC_EXPENSIVEWS, btExpensiveWSMonitoring_);
Expand All @@ -93,6 +94,7 @@ void CSettings::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, IDC_EXTRAUSERMODEPROVIDERS, btExtraUserProviders_);
DDX_Control(pDX, IDC_PERFORMANCECOUNTERS, btPerfCounters_);
DDX_Control(pDX, IDC_COPYSTARTUPPROFILE, btCopyStartupProfile_);
DDX_Control(pDX, IDC_USE_OTHER_KERNEL_LOGGER, btUseOtherKernelLogger_);
DDX_Control(pDX, IDC_CHROMEDEVELOPER, btChromeDeveloper_);
DDX_Control(pDX, IDC_AUTOVIEWTRACES, btAutoViewTraces_);
DDX_Control(pDX, IDC_HEAPSTACKS, btHeapStacks_);
Expand All @@ -113,13 +115,15 @@ BEGIN_MESSAGE_MAP(CSettings, CDialog)
ON_BN_CLICKED(IDC_EXPENSIVEWS, &CSettings::OnBnClickedExpensivews)
ON_BN_CLICKED(IDC_CHECKFORNEWVERSIONS, &CSettings::OnBnClickedCheckfornewversions)
ON_BN_CLICKED(IDC_SELECT_PERF_COUNTERS, &CSettings::OnBnClickedSelectPerfCounters)
ON_BN_CLICKED(IDC_USE_OTHER_KERNEL_LOGGER, &CSettings::OnBnClickedUseOtherKernelLogger)
END_MESSAGE_MAP()

BOOL CSettings::OnInitDialog()
{
CDialog::OnInitDialog();

SetDlgItemText(IDC_HEAPEXE, heapTracingExes_.c_str());
CheckDlgButton(IDC_USE_OTHER_KERNEL_LOGGER, bUseOtherKernelLogger_);
CheckDlgButton(IDC_CHROMEDEVELOPER, bChromeDeveloper_);
CheckDlgButton(IDC_AUTOVIEWTRACES, bAutoViewTraces_);
CheckDlgButton(IDC_HEAPSTACKS, bHeapStacks_);
Expand Down Expand Up @@ -181,6 +185,8 @@ BOOL CSettings::OnInitDialog()
toolTip_.AddTool(&btCopyStartupProfile_, L"Copies startup.wpaProfile files for WPA 8.1 and "
L"10 to the appropriate destinations so that the next time WPA starts up it will have "
L"reasonable analysis defaults.");
toolTip_.AddTool(&btUseOtherKernelLogger_, L"Check this to have UIforETW use the alternate kernel "
L"logger. This is needed on some machines where the main kernel logger is in use.");
toolTip_.AddTool(&btChromeDeveloper_, L"Check this to enable Chrome specific behavior such as "
L"setting the Chrome symbol server path, and preprocessing of Chrome symbols and "
L"traces.");
Expand Down Expand Up @@ -366,3 +372,9 @@ void CSettings::OnBnClickedSelectPerfCounters()
SetDlgItemTextW(IDC_PERFORMANCECOUNTERS, counters_string.c_str());
}
}


void CSettings::OnBnClickedUseOtherKernelLogger()
{
bUseOtherKernelLogger_ = !bUseOtherKernelLogger_;
}
3 changes: 3 additions & 0 deletions UIforETW/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class CSettings : public CDialog
std::wstring extraKernelStacks_;
std::wstring extraUserProviders_;
std::wstring perfCounters_;
bool bUseOtherKernelLogger_ = false;
bool bChromeDeveloper_ = false;
bool bAutoViewTraces_ = false;
bool bHeapStacks_ = false;
Expand All @@ -58,6 +59,7 @@ class CSettings : public CDialog

CButton btCopyStartupProfile_;

CButton btUseOtherKernelLogger_;
CButton btChromeDeveloper_;
CButton btAutoViewTraces_;
CButton btHeapStacks_;
Expand Down Expand Up @@ -87,4 +89,5 @@ class CSettings : public CDialog
afx_msg void OnBnClickedExpensivews();
afx_msg void OnBnClickedCheckfornewversions();
afx_msg void OnBnClickedSelectPerfCounters();
afx_msg void OnBnClickedUseOtherKernelLogger();
};
1 change: 1 addition & 0 deletions UIforETW/Support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void CUIforETWDlg::TransferSettings(bool saving)
{ L"GPUTracing", &bGPUTracing_ },
{ L"CLRTracing", &bCLRTracing_ },
{ L"ShowCommands", &bShowCommands_ },
{ L"UseOtherKernelLogger", &bUseOtherKernelLogger_ },
{ L"ChromeDeveloper", &bChromeDeveloper_ },
{ L"AutoViewTraces", &bAutoViewTraces_ },
{ L"HeapStacks", &bHeapStacks_ },
Expand Down
2 changes: 2 additions & 0 deletions UIforETW/UIforETW.rc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ BEGIN
EDITTEXT IDC_EXTRAUSERMODEPROVIDERS,95,91,133,14,ES_AUTOHSCROLL
LTEXT "Perf counters:",IDC_STATIC,7,112,47,8
PUSHBUTTON "&Copy startup profiles",IDC_COPYSTARTUPPROFILE,7,144,75,14
CONTROL "Use other kernel logger",IDC_USE_OTHER_KERNEL_LOGGER,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,180,91,10
CONTROL "Ch&rome developer",IDC_CHROMEDEVELOPER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,128,75,10
CONTROL "&Auto view traces",IDC_AUTOVIEWTRACES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,141,70,10
CONTROL "&Stacks on heap tracing",IDC_HEAPSTACKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,154,89,10
Expand Down
2 changes: 2 additions & 0 deletions UIforETW/UIforETWDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,7 @@ void CUIforETWDlg::OnBnClickedSettings()
dlgSettings.extraKernelStacks_ = extraKernelStacks_;
dlgSettings.extraUserProviders_ = extraUserProviders_;
dlgSettings.perfCounters_ = perfCounters_;
dlgSettings.bUseOtherKernelLogger_ = bUseOtherKernelLogger_;
dlgSettings.bChromeDeveloper_ = bChromeDeveloper_;
dlgSettings.bAutoViewTraces_ = bAutoViewTraces_;
dlgSettings.bHeapStacks_ = bHeapStacks_;
Expand Down Expand Up @@ -1773,6 +1774,7 @@ void CUIforETWDlg::OnBnClickedSettings()
}

// Copy over the remaining settings.
bUseOtherKernelLogger_ = dlgSettings.bUseOtherKernelLogger_;
WSMonitoredProcesses_ = dlgSettings.WSMonitoredProcesses_;
bExpensiveWSMonitoring_ = dlgSettings.bExpensiveWSMonitoring_;
extraKernelFlags_ = dlgSettings.extraKernelFlags_;
Expand Down
7 changes: 4 additions & 3 deletions UIforETW/UIforETWDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ class CUIforETWDlg : public CDialog
std::wstring GetHeapFile() const { return GetTempTraceDir() + L"heap.etl"; }

// Get session name for kernel logger
const std::wstring kernelLogger_ = L"\"NT Kernel Logger\"";
//const std::wstring logger_ = L"\"Circular Kernel Context Logger\"";
std::wstring GetKernelLogger() const { return kernelLogger_; }
const std::wstring NTKernelLogger_ = L"\"NT Kernel Logger\"";
const std::wstring CircularKernellogger_ = L"\"Circular Kernel Context Logger\"";
bool bUseOtherKernelLogger_ = false;
std::wstring GetKernelLogger() const { return bUseOtherKernelLogger_ ? CircularKernellogger_ : NTKernelLogger_; }

int initialWidth_ = 0;
int initialHeight_ = 0;
Expand Down

0 comments on commit 6368343

Please sign in to comment.