📄 mdprof.c
字号:
/*++
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.
Copyright (c) 1995, 1996, 1997, 1998 Microsoft Corporation
Module Name: mdprof.c
Abstract:
This file implements the platform specific profiler support
Functions:
Notes:
--*/
#include <windows.h>
#include <bldver.h>
#include "nkintr.h"
#include "p2debug.h"
#include "..\..\hal\arm\timer.h"
#include "sa11x0.h"
#include "sa11x0bd.h"
#define TICKS_25MS 92160
#define PROF_MULT 500
#define TICKS_PROF (TICKS_25MS / PROF_MULT)
extern DWORD GetEPC(void);
int ProfileInterrupt(void);
//BOOL bProfileEnabled=FALSE; // platform profiler enabled flag
//LPDWORD lpdwProfileBufStart=NULL; // platform profile buffer start
//LPDWORD lpdwProfileBufNext=NULL; // platform profile buffer next
//LPDWORD lpdwProfileBufEnd=NULL; // platform profile buffer end
unsigned int ReschedCount;
extern int (*PProfileInterrupt)(void); // pointer to profiler ISR
extern void ProfilerHit(DWORD);
extern DWORD CurMSec;
#if (CE_MAJOR_VER == 0x0003)
extern DWORD DiffMSec;
#endif
//extern DWORD dwProfileCount;
//extern unsigned int MyEPC;
//extern BOOL bProfileObjCall; // profile object calls flag
//extern BOOL bProfileKCall; // profile KCalls flag
void
OEMProfileTimerEnable(
DWORD dwUSec
)
{
#ifdef SA1100
volatile struct ostreg*const v_pOSTReg = (struct ostreg *)OST_BASE_VIRTUAL;
PProfileInterrupt=ProfileInterrupt;
v_pOSTReg->osmr[0] = v_pOSTReg->oscr + TICKS_PROF;
//ost->ossr = OSSR_M_M0; // clear any current interrupt
TIMER_M0_INT_CLR(1);
//ost->oier = OIER_M_E0; // turn on the interrupt
TIMER_M0_INT_EN(1);
ReschedCount=PROF_MULT;
#endif
}
void OEMProfileTimerDisable(void) {
#ifdef SA1100
volatile struct ostreg*const v_pOSTReg = (struct ostreg *)OST_BASE_VIRTUAL;
v_pOSTReg->osmr[0] = v_pOSTReg->oscr + TICKS_25MS;
//ost->ossr = OSSR_M_M0; // clear any current interrupt
TIMER_M0_INT_CLR(1);
//ost->oier = OIER_M_E0; // turn on the interrupt
TIMER_M0_INT_EN(1);
PProfileInterrupt=NULL;
#endif
}
int ProfileInterrupt(void) {
#ifdef SA1100
volatile struct ostreg*const v_pOSTReg = (struct ostreg *)OST_BASE_VIRTUAL;
//
// Service the timer interrupt. Note that the interrupt interval is
// hard wired at 25 mSec. (25*3686.4 = 92160)
//
v_pOSTReg->osmr[0] += TICKS_PROF;
//Clear the interrupt
//sa1100_ostimer0->ossr = OSSR_M_M0;
TIMER_M0_INT_CLR(1);
ReschedCount--;
ProfilerHit(GetEPC());
if (!ReschedCount) {
CurMSec += 25;
#if (CE_MAJOR_VER == 0x0003)
DiffMSec += 25;
#endif
ReschedCount=PROF_MULT;
return SYSINTR_RESCHED;
}
#endif
return SYSINTR_NOP;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -