71 lines
2.4 KiB
C++
71 lines
2.4 KiB
C++
/*-----------------------------------------------------------------------------*/
|
|
/* PRF_fn_vInitProfileModule*/
|
|
/* Must be called once at the beginning of the program*/
|
|
/*-----------------------------------------------------------------------------*/
|
|
void PRF_fn_vInitProfileModule ()
|
|
{
|
|
unsigned long i;
|
|
short sTimerHandle;
|
|
|
|
/* create the timer that will be used to compute time*/
|
|
sTimerHandle = TMR_fn_wCreateTimer(C_wTimerFrequencyHigh);
|
|
|
|
if (Erm_M_uwCheckError(Tmr,C_ucErmDefaultChannel))
|
|
{
|
|
Erm_M_ClearLastError(C_ucErmDefaultChannel);
|
|
assert(0);
|
|
}
|
|
|
|
/* get the CPU frequency*/
|
|
TMR_fn_wGetTimerFrequency(sTimerHandle,&ulTimerFrequency);
|
|
ulTimerFrequency /= 1000000;
|
|
|
|
/* no more need of the timer*/
|
|
TMR_fn_wDestroyTimer(sTimerHandle);
|
|
|
|
/* get the screen frequency*/
|
|
/*
|
|
ulMonitorFrequency = TMR_fn_ulMonitorFrequency();
|
|
ulMonitorFrequency /= 100;
|
|
*/
|
|
ulMonitorFrequency = 60;
|
|
|
|
/* print result*/
|
|
printf ("monitor frequency : %i Hz, CPU frequency : %i Mhz\n",ulMonitorFrequency,ulTimerFrequency);
|
|
/* clear all arrays*/
|
|
for (i = 0 ; i < PRF_C_lMaxNbFunction ; i ++)
|
|
{
|
|
PRF_g_a_stFunctionInformation[i].szFunctionName = 0;
|
|
PRF_g_a_stFunctionInformation[i].ulHistorySize = 0;
|
|
PRF_g_a_stFunctionInformation[i].ulUserDataSize = 0;
|
|
PRF_g_a_stFunctionInformation[i].p_stFrameHistory = NULL;
|
|
PRF_g_a_stFunctionInformation[i].p_stUserDataSummary = NULL;
|
|
}
|
|
|
|
for (i = 0 ; i < PRF_C_lMaxNbVariable ; i ++)
|
|
{
|
|
PRF_g_a_stVariableInformation[i].szVariableName = 0;
|
|
PRF_g_a_stVariableInformation[i].ulHistorySize = 0;
|
|
PRF_g_a_stVariableInformation[i].ulUserDataSize = 0;
|
|
PRF_g_a_stVariableInformation[i].p_stFrameHistory = NULL;
|
|
PRF_g_a_stVariableInformation[i].p_stUserDataSummary = NULL;
|
|
}
|
|
|
|
for (i = 0 ; i < PRF_C_lMaxNbVariable ; i ++)
|
|
PRF_g_a_stVariableInformation[i].szVariableName = 0;
|
|
|
|
memset (a_lIndependantVariable , 0 , sizeof(long) * PRF_C_lMaxNbIndependantVariable);
|
|
memset (a_szIndependantVariableName , 0 , sizeof(char*) * PRF_C_lMaxNbIndependantVariable);
|
|
|
|
memset (a_fFloatIndependantVariable , 0 , sizeof(float) * PRF_C_lMaxNbFloatIndependantVariable);
|
|
memset (a_szFloatIndependantVariableName , 0 , sizeof(char*) * PRF_C_lMaxNbFloatIndependantVariable);
|
|
|
|
PRF_g_bModuleInitialized = TRUE;
|
|
}
|
|
|
|
void PRF_fn_vUpdateMonitorFrequency( unsigned long _ulFrequency )
|
|
{
|
|
ulMonitorFrequency = _ulFrequency;
|
|
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpMonitorFrequency, _ulFrequency );
|
|
}
|