📄 iltiming.c
字号:
//
// 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.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Module Name:
iltiming.c
Abstract:
This module implements the code to support iltiming measurement.
Notes:
--*/
#include <windows.h>
#include <nkintr.h>
#include <pkfuncs.h>
#include <iltiming.h>
extern volatile BOOL fIntrTime, fProfilerRunning;
extern DWORD ARMTimer2CountSinceTick(void);
extern DWORD PerfCountFreq (void);
extern void ARMStartTimer2 (DWORD dwUsec);
extern void ARMStopTimer2 (void);
DWORD dwIsrTime1;
DWORD dwIsrTime2;
DWORD dwSPC;
WORD wNumInterrupts;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
DWORD ARMHandleIlTiming (PILTIMING_MESSAGE pITM)
{
int nMSec;
// Check for invalid argument
if (!pITM) return FALSE;
switch (pITM->wMsg) {
case ILTIMING_MSG_ENABLE :
if (fProfilerRunning) {
RETAILMSG (1, (TEXT("Cannot start ILTiming while Monte Carlo Profiler is running\r\n")));
return FALSE;
}
if (!(nMSec = (int) pITM->dwFrequency)) {
RETAILMSG (1, (TEXT("ILTiming dwFreqency cannot b 0\r\n")));
return FALSE;
}
if (!fIntrTime) {
wNumInterrupts = 0;
dwIsrTime1 = 0xFFFFFFFF;
fIntrTime = TRUE;
ARMStartTimer2 (nMSec * 1000);
}
RETAILMSG (1, (TEXT("ILTiming Enable (@ every %d MSec)\r\n"), nMSec));
break;
case ILTIMING_MSG_DISABLE :
RETAILMSG (1, (TEXT("ILTiming Disable\r\n")));
if (fIntrTime) {
fIntrTime = FALSE;
ARMStopTimer2 ();
}
break;
case ILTIMING_MSG_GET_TIMES :
pITM->dwIsrTime1 = dwIsrTime1;
pITM->dwIsrTime2 = dwIsrTime2;
pITM->wNumInterrupts = wNumInterrupts;
pITM->dwSPC = dwSPC;
pITM->dwFrequency = PerfCountFreq();
wNumInterrupts = 0;
// RETAILMSG (1, (TEXT("ILTiming GetTime @ 0x%08X:%08X\r\n"), pITM->dwParam1, pITM->dwParam2));
break;
case ILTIMING_MSG_GET_PFN :
pITM->pfnPerfCountSinceTick = (PVOID) ARMTimer2CountSinceTick;
RETAILMSG (1, (TEXT("ILTiming GetPFN\r\n")));
break;
default :
RETAILMSG (1, (TEXT("IOCTL_HAL_ILTIMING : BAD MESSAGE!!!\r\n")));
return (FALSE);
}
return (TRUE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -