📄 profiler.cpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
#ifdef PROFILE
#include <windows.h>
#include <profiler.h>
// wKeyNum:
// 8 (F8) Toggle output mode (buffered, unbuffered, CeLog)
// 9 (F9) Start Monte Carlo profiling
// 10 (F10) Start KCall profiling
// 11 (F11) Start ObjCall profiling
// 12 (F12) Stop profiling
BOOL DoProfilerKey(WORD wKeyNum)
{
// Default to buffered mode
static DWORD dwOutputMode = PROFILE_BUFFER;
static DWORD dwInterval = 200;
switch (wKeyNum) {
case 8:
// Circular toggle
if (dwOutputMode == PROFILE_BUFFER) {
// Buffered mode, go into unbuffered mode
dwOutputMode = 0;
dwInterval = 1000;
NKDbgPrintfW(L"Kernel Profiler mode: Unbuffered\r\n");
} else if (dwOutputMode == 0) {
// Unbuffered mode, go into CeLog mode
dwOutputMode = PROFILE_CELOG;
dwInterval = 200;
NKDbgPrintfW(L"Kernel Profiler mode: CeLog\r\n");
} else {
// CeLog mode, go into buffered mode
dwOutputMode = PROFILE_BUFFER;
dwInterval = 200;
NKDbgPrintfW(L"Kernel Profiler mode: Buffered\r\n");
}
break;
case 9:
ProfileStart(dwInterval, dwOutputMode); // Monte Carlo
break;
case 10:
ProfileStart(dwInterval, PROFILE_KCALL | dwOutputMode);
break;
case 11:
ProfileStart(dwInterval, PROFILE_OBJCALL | dwOutputMode);
break;
case 12:
ProfileStop();
break;
default:
break;
}
return TRUE;
}
#endif // PROFILE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -