void CWorkingSetMonitor::SetProcessFilter(const std::wstring& processes, bool bExpensiveWSMonitoring) { // A 32-bit process on 64-bit Windows will not be able to read the // full working set of 64-bit processes, so don't even try. if (Is64BitWindows() && !Is64BitBuild()) return; CSingleLock locker(&processesLock_); if (processes == L"*") { processAll_ = true; } else { processAll_ = false; processes_ = split(processes, ';'); } bExpensiveWSMonitoring_ = bExpensiveWSMonitoring; }
BOOL CSettings::OnInitDialog() { CDialog::OnInitDialog(); SetDlgItemText(IDC_HEAPEXE, heapTracingExes_.c_str()); CheckDlgButton(IDC_CHROMEDEVELOPER, bChromeDeveloper_); CheckDlgButton(IDC_AUTOVIEWTRACES, bAutoViewTraces_); CheckDlgButton(IDC_HEAPSTACKS, bHeapStacks_); CheckDlgButton(IDC_VIRTUALALLOCSTACKS, bVirtualAllocStacks_); CheckDlgButton(IDC_CHECKFORNEWVERSIONS, bVersionChecks_); btBufferSizes_.EnableWindow(FALSE); if (IsWindows8Point1OrGreater()) { // The working set monitoring is not needed on Windows 8.1 and above because // of the Microsoft-Windows-Kernel-Memory provider. btWSMonitoredProcesses_.EnableWindow(FALSE); btExpensiveWSMonitoring_.EnableWindow(FALSE); GetDlgItem(IDC_WS_MONITOR_STATIC)->EnableWindow(FALSE); } else { // A 32-bit process on 64-bit Windows will not be able to read the // full working set of 64-bit processes, so don't even try. if (Is64BitWindows() && !Is64BitBuild()) btWSMonitoredProcesses_.EnableWindow(FALSE); else SetDlgItemText(IDC_WSMONITOREDPROCESSES, WSMonitoredProcesses_.c_str()); CheckDlgButton(IDC_EXPENSIVEWS, bExpensiveWSMonitoring_); } btExtraKernelFlags_.SetWindowTextW(extraKernelFlags_.c_str()); btExtraStackwalks_.SetWindowTextW(extraKernelStacks_.c_str()); if (toolTip_.Create(this)) { toolTip_.SetMaxTipWidth(400); toolTip_.Activate(TRUE); toolTip_.AddTool(&btHeapTracingExe_, L"Specify the file names of the exes to be heap traced, " L"separated by semi-colons. " L"Enter just the file parts (with the .exe extension) not a full path. For example, " L"'chrome.exe;notepad.exe'. This is for use with the heap-tracing-to-file mode."); toolTip_.AddTool(&btExtraKernelFlags_, L"Extra kernel flags, separated by '+', such as " L"\"REGISTRY+PERF_COUNTER\". See \"xperf -providers k\" for the full list. " L"Note that incorrect kernel flags will cause tracing to fail to start."); toolTip_.AddTool(&btExtraStackwalks_, L"List of extra stacks to collect from the kernel " L"kernel provider. For example, \"DiskReadInit+DiskWriteInit+DiskFlushInit\". " L"Run \"xperf -help stackwalk\" to see the full list. Note that incorrect stack " L"walk flags will cause tracing to fail to start. Note also that stack walk flags " L"are ignored if the corresponding kernel flag is not enabled."); toolTip_.AddTool(&btWSMonitoredProcesses_, L"Names of processes whose working sets will be " L"monitored, separated by semi-colons. An empty string means no monitoring. A '*' means " L"that all processes will be monitored. For instance 'chrome.exe;notepad.exe'"); toolTip_.AddTool(&btExpensiveWSMonitoring_, L"Check this to have private working set and PSS " L"(proportional set size) calculated for monitored processes. This may consume " L"dozens or hundreds of ms each time. Without this checked only full working " L"set is calculated, which is cheap."); 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(&btCopySymbolDLLs_, L"Copy dbghelp.dll and symsrv.dll to the xperf directory to " L"try to resolve slow or failed symbol loading in WPA. See " L"https://randomascii.wordpress.com/2012/10/04/xperf-symbol-loading-pitfalls/ " L"for details."); 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."); toolTip_.AddTool(&btAutoViewTraces_, L"Check this to have UIforETW launch the trace viewer " L"immediately after a trace is recorded."); toolTip_.AddTool(&btHeapStacks_, L"Check this to record call stacks on HeapAlloc, HeapRealloc, " L"and similar calls, when doing heap traces."); toolTip_.AddTool(&btVirtualAllocStacks_, L"Check this to record call stacks on VirtualAlloc on all " L"traces instead of just heap traces."); toolTip_.AddTool(&btVersionChecks_, L"Check this to have UIforETW check for new versions at startup."); toolTip_.AddTool(&btChromeCategories_, L"Check the chrome tracing categories that you want Chrome " L"to emit ETW events for. This requires running Chrome version 46 or later, and " L"using chrome://flags/ to \"Enable exporting of tracing events to ETW\" - search for " L"trace-export on the chrome://flags/ page."); } // Initialize the list of check boxes with all of the Chrome categories which // we can enable individually. btChromeCategories_.SetCheckStyle(BS_AUTOCHECKBOX); int index = 0; for (auto category : filtered_event_group_names) { btChromeCategories_.AddString(category); btChromeCategories_.SetCheck(index, (chromeKeywords_ & (1LL << index)) != 0); ++index; } // Manually add the two special Chrome category options. btChromeCategories_.AddString(other_events_group_name); btChromeCategories_.SetCheck(index, (chromeKeywords_ & other_events_keyword_bit) != 0); ++index; btChromeCategories_.AddString(disabled_other_events_group_name); btChromeCategories_.SetCheck(index, (chromeKeywords_ & disabled_other_events_keyword_bit) != 0); return TRUE; // return TRUE unless you set the focus to a control }
BOOL CSettings::OnInitDialog() { CDialogEx::OnInitDialog(); SetDlgItemText(IDC_HEAPEXE, heapTracingExes_.c_str()); CheckDlgButton(IDC_CHROMEDEVELOPER, bChromeDeveloper_); CheckDlgButton(IDC_AUTOVIEWTRACES, bAutoViewTraces_); CheckDlgButton(IDC_HEAPSTACKS, bHeapStacks_); CheckDlgButton(IDC_VIRTUALALLOCSTACKS, bVirtualAllocStacks_); btExtraProviders_.EnableWindow(FALSE); btExtraStackwalks_.EnableWindow(FALSE); btBufferSizes_.EnableWindow(FALSE); // A 32-bit process on 64-bit Windows will not be able to read the // full working set of 64-bit processes, so don't even try. if (Is64BitWindows() && !Is64BitBuild()) btWSMonitoredProcesses_.EnableWindow(FALSE); else SetDlgItemText(IDC_WSMONITOREDPROCESSES, WSMonitoredProcesses_.c_str()); CheckDlgButton(IDC_EXPENSIVEWS, bExpensiveWSMonitoring_); if (toolTip_.Create(this)) { toolTip_.SetMaxTipWidth(400); toolTip_.Activate(TRUE); toolTip_.AddTool(&btHeapTracingExe_, L"Specify the file names of the exes to be heap traced, " L"separated by semi-colons. " L"Enter just the file parts (with the .exe extension) not a full path. For example, " L"'chrome.exe;notepad.exe'. This is for use with the heap-tracing-to-file mode."); 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(&btCopySymbolDLLs_, L"Copy dbghelp.dll and symsrv.dll to the xperf directory to " L"try to resolve slow or failed symbol loading in WPA. See " L"https://randomascii.wordpress.com/2012/10/04/xperf-symbol-loading-pitfalls/ " L"for details."); 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."); toolTip_.AddTool(&btAutoViewTraces_, L"Check this to have UIforETW launch the trace viewer " L"immediately after a trace is recorded."); toolTip_.AddTool(&btHeapStacks_, L"Check this to record call stacks on HeapAlloc, HeapRealloc, " L"and similar calls, when doing heap traces."); toolTip_.AddTool(&btWSMonitoredProcesses_, L"Names of processes whose working sets will be " L"monitored, separated by semi-colons. An empty string means no monitoring. A '*' means " L"that all processes will be monitored. For instance 'chrome.exe;notepad.exe'"); toolTip_.AddTool(&btExpensiveWSMonitoring_, L"Check this to have private working set and PSS " L"(proportional set size) calculated for monitored processes. This may consume " L"dozens or hundreds of ms each time. Without this checked only full working " L"set is calculated, which is cheap."); toolTip_.AddTool(&btVirtualAllocStacks_, L"Check this to record call stacks on VirtualAlloc on all " L"traces instead of just heap traces."); toolTip_.AddTool(&btChromeCategories_, L"Check the chrome tracing categories that you want Chrome " L"to emit ETW events for. This requires running Chrome version 45 or later, with " L"--trace-export-events-to-etw on the command-line."); } // Initialize the list of check boxes with all of the Chrome categories which // we can enable individually. btChromeCategories_.SetCheckStyle(BS_AUTOCHECKBOX); int index = 0; for (auto category : filtered_event_group_names) { btChromeCategories_.AddString(category); btChromeCategories_.SetCheck(index, (chromeKeywords_ & (1LL << index)) != 0); ++index; } // Manually add the two special Chrome category options. btChromeCategories_.AddString(other_events_group_name); btChromeCategories_.SetCheck(index, (chromeKeywords_ & other_events_keyword_bit) != 0); ++index; btChromeCategories_.AddString(disabled_other_events_group_name); btChromeCategories_.SetCheck(index, (chromeKeywords_ & disabled_other_events_keyword_bit) != 0); return TRUE; // return TRUE unless you set the focus to a control }
BOOL CSettings::OnInitDialog() { CDialog::OnInitDialog(); SetDlgItemText(IDC_HEAPEXE, heapTracingExes_.c_str()); CheckDlgButton(IDC_USE_OTHER_KERNEL_LOGGER, bUseOtherKernelLogger_); CheckDlgButton(IDC_BACKGROUND_MONITORING, bBackgroundTracing_); CheckDlgButton(IDC_CHROMEDEVELOPER, bChromeDeveloper_); CheckDlgButton(IDC_IDENTIFY_CHROME_CPU, bIdentifyChromeProcessesCPU_); CheckDlgButton(IDC_AUTOVIEWTRACES, bAutoViewTraces_); CheckDlgButton(IDC_RECORD_PRE_TRACE, bRecordPreTrace_); CheckDlgButton(IDC_HEAPSTACKS, bHeapStacks_); CheckDlgButton(IDC_VIRTUALALLOCSTACKS, bVirtualAllocStacks_); CheckDlgButton(IDC_CHECKFORNEWVERSIONS, bVersionChecks_); btIdentifyChromeProcessesCPU_.EnableWindow(bChromeDeveloper_); if (IsWindows8Point1OrGreater()) { // The working set monitoring is not needed on Windows 8.1 and above because // of the Microsoft-Windows-Kernel-Memory provider. btWSMonitoredProcesses_.EnableWindow(FALSE); btExpensiveWSMonitoring_.EnableWindow(FALSE); GetDlgItem(IDC_WS_MONITOR_STATIC)->EnableWindow(FALSE); } else { // A 32-bit process on 64-bit Windows will not be able to read the // full working set of 64-bit processes, so don't even try. if (Is64BitWindows() && !Is64BitBuild()) btWSMonitoredProcesses_.EnableWindow(FALSE); else SetDlgItemText(IDC_WSMONITOREDPROCESSES, WSMonitoredProcesses_.c_str()); CheckDlgButton(IDC_EXPENSIVEWS, bExpensiveWSMonitoring_); } btExtraKernelFlags_.SetWindowTextW(extraKernelFlags_.c_str()); btExtraStackwalks_.SetWindowTextW(extraKernelStacks_.c_str()); btExtraUserProviders_.SetWindowTextW(extraUserProviders_.c_str()); btPerfCounters_.SetWindowTextW(perfCounters_.c_str()); if (toolTip_.Create(this)) { toolTip_.SetMaxTipWidth(400); toolTip_.Activate(TRUE); toolTip_.AddTool(&btHeapTracingExe_, L"Specify which processes to heap trace when using " L"heap-tracing-to-file mode. Three different methods can be used to specify the processes:\n" L"1) A semi-colon separated list of process names, such as 'chrome.exe;notepad.exe'. " L"The processes must be launched after this is set and heap-tracing-to-file is selected.\n" L"2) A semi-colon separated list of process IDs (PIDs) - maximum of two - such as '1234;5678'.\n" L"3) A fully specified path to an executable that will be launched by ETW when heap tracing is " L"started."); toolTip_.AddTool(&btExtraKernelFlags_, L"Extra kernel flags, separated by '+', such as " L"\"REGISTRY+PERF_COUNTER\". See \"xperf -providers k\" for the full list. " L"Note that incorrect kernel flags will cause tracing to fail to start."); toolTip_.AddTool(&btExtraStackwalks_, L"List of extra stacks to collect from the kernel " L"kernel provider. For example, \n\"DiskReadInit+DiskWriteInit+DiskFlushInit\". " L"Run \"xperf -help stackwalk\" to see the full list. Note that incorrect stack " L"walk flags will cause tracing to fail to start. Note also that stack walk flags " L"are ignored if the corresponding kernel flag is not enabled."); toolTip_.AddTool(&btExtraUserProviders_, L"Extra user providers, separated by '+', such as " L"\n\"Microsoft-Windows-Audio+Microsoft-Windows-HttpLog\". See \"xperf -providers\" " L"for the full list. " L"TraceLogging and EventSource providers must be prefixed by '*'. " L"Note that incorrect user providers will cause tracing to fail to start."); toolTip_.AddTool(&btPerfCounters_, L"Arbitrary performance counters to be logged occasionally."); toolTip_.AddTool(&btWSMonitoredProcesses_, L"Names of processes whose working sets will be " L"monitored, separated by semi-colons. An empty string means no monitoring. A '*' means " L"that all processes will be monitored. For instance 'chrome.exe;notepad.exe'"); toolTip_.AddTool(&btExpensiveWSMonitoring_, L"Check this to have private working set and PSS " L"(proportional set size) calculated for monitored processes. This may consume " L"dozens or hundreds of ms each time. Without this checked only full working " L"set is calculated, which is cheap."); 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 identifying Chrome processes."); toolTip_.AddTool(&btAutoViewTraces_, L"Check this to have UIforETW launch the trace viewer " L"immediately after a trace is recorded."); toolTip_.AddTool(&btRecordPreTrace_, L"Check this to enable recording of a startup trace " L"to grab a snapshot of module version and symbol information. This allows analyzing " L"traces across upgrades, such as chrome restart upgrades."); toolTip_.AddTool(&btHeapStacks_, L"Check this to record call stacks on HeapAlloc, HeapRealloc, " L"and similar calls, when doing heap traces."); toolTip_.AddTool(&btVirtualAllocStacks_, L"Check this to record call stacks on VirtualAlloc on all " L"traces instead of just heap traces."); toolTip_.AddTool(&btVersionChecks_, L"Check this to have UIforETW check for new versions at startup."); toolTip_.AddTool(&btChromeCategories_, L"Check the chrome tracing categories that you want Chrome " L"to emit ETW events for. This requires running Chrome version 46 or later, and " L"using chrome://flags/ to \"Enable exporting of tracing events to ETW\" - search for " L"trace-export on the chrome://flags/ page."); toolTip_.AddTool(&btIdentifyChromeProcessesCPU_, L"If this is checked and \"Chrome developer\" is " L"checked then CPU usage details of Chrome processes will be added to the trace information " L"file when traces are recorded. Calculating the CPU usage details can take a while."); toolTip_.AddTool(&btBackgroundMonitoring_, L"When this is checked background threads will periodically " L"(a few times per second) record information about system performance to the trace being " L"recorded. This can be helpful in understanding performance problems but may affect " L"power consumption."); } // Initialize the list of check boxes with all of the Chrome categories which // we can enable individually. btChromeCategories_.SetCheckStyle(BS_AUTOCHECKBOX); int index = 0; for (auto category : filtered_event_group_names) { btChromeCategories_.AddString(category); btChromeCategories_.SetCheck(index, (chromeKeywords_ & (1LL << index)) != 0); ++index; } // Manually add the two special Chrome category options. btChromeCategories_.AddString(other_events_group_name); btChromeCategories_.SetCheck(index, (chromeKeywords_ & other_events_keyword_bit) != 0); ++index; btChromeCategories_.AddString(disabled_other_events_group_name); btChromeCategories_.SetCheck(index, (chromeKeywords_ & disabled_other_events_keyword_bit) != 0); return TRUE; // return TRUE unless you set the focus to a control }