mdprof.c

来自「WinCE 3.0 BSP, 包含Inter SA1110, Intel_815」· C语言 代码 · 共 118 行

C
118
字号
/* -*-C-*-
 *
 * $Revision: 1.2 $
 *   $Author: kwelton $
 *     $Date: 1999/10/25 21:40:56 $
 *
 */

/*++
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 "nkintr.h"
#include "win_plat.h"
#include "timer.h"

extern DWORD AlarmTime;

int ProfileInterrupt(void);

unsigned int ReschedCount;
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
extern int (*PProfileInterrupt)(void);  // pointer to profiler ISR



extern void ProfilerHit(DWORD);
extern DWORD SetTimerInterval(DWORD);
extern DWORD CurMSec;
extern DWORD DiffMSec;
extern DWORD dwProfileCount;
extern unsigned int MyEPC;
extern BOOL bProfileObjCall;            // profile object calls flag
extern BOOL bProfileKCall;              // profile KCalls flag


// When profiling is turned on, we halve the interrupt period so that
// we can use one interrupt for the profile and one for the timing
void OEMProfileTimerEnable(void)
{
#if defined(FORCE_ARM720) || defined(FORCE_ARM920)

        if (bProfileObjCall || bProfileKCall) {
                bProfileEnabled = TRUE;
                return;
        }

        //
        // Set up the timer for 2 interrupts per 25 ms.
        //
        SetTimerInterval(TIMER_PERIOD / 2);
#endif
}

void OEMProfileTimerDisable(void)
{
#if defined(FORCE_ARM720) || defined(FORCE_ARM920)

        bProfileEnabled=FALSE;
        if (bProfileObjCall)
                return;
        //
        // Set up the timer for 1 interrupt per 25 ms.
        //
        SetTimerInterval(TIMER_PERIOD) ;

#endif
}

int ProfileInterrupt(void)
{
#if defined(FORCE_ARM720) || defined(FORCE_ARM920)

        if (bProfileEnabled) {
                ReschedCount++;
                ProfilerHit(MyEPC);
                if (ReschedCount & 1) {
                        // The handler will clear the interrupt
                        return SYSINTR_NOP;
                }
        }

        // Otherwise, just return and let the handler process the interrupt
        //
        return SYSINTR_RESCHED;

#endif
  return SYSINTR_NOP;
}

/* The following routines were here, but were also in hal/arm/timer.c.
 * Since these are timer functions, they don't belong in the profiler.
 *      KCPTime_t KCP_GetCurrentTime(void) ;
 *      DWORD KCP_ScaleDown(DWORD N) ;
 *      DWORD KCP_GetStartTime(void) ;
 *      DWORD KCP_GetElapsedTime(DWORD t0) ;
 */

/* EOF mdprof.c */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?