Update perf_counter.c

This commit is contained in:
Gabriel Wang 2024-12-06 11:10:33 +00:00 committed by GitHub
parent 2d7f024492
commit d36aced13a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -102,29 +102,34 @@ void perfc_port_clear_system_timer_counter(void);
void perfc_port_insert_to_system_timer_insert_ovf_handler(void)
{
int64_t lLoad = perfc_port_get_system_timer_top() + 1;
s_lSystemClockCounts += lLoad;
// update system ms counter
do {
int64_t lTemp = s_wMSResidule + lLoad;
/* prevent high priority exceptions from preempting the system timer OVF
* exception handling
*/
__IRQ_SAFE {
s_lSystemClockCounts += lLoad;
// update system ms counter
do {
int64_t lTemp = s_wMSResidule + lLoad;
int64_t lMS = lTemp / s_wMSUnit;
s_lSystemMS += lMS;
s_wMSResidule = (uint32_t)((int64_t)lTemp - (int64_t)lMS * s_wMSUnit);
int64_t lMS = lTemp / s_wMSUnit;
s_lSystemMS += lMS;
s_wMSResidule = (uint32_t)((int64_t)lTemp - (int64_t)lMS * s_wMSUnit);
} while(0);
} while(0);
// update system us counter
do {
int64_t lTemp = s_wUSResidule + lLoad;
// update system us counter
do {
int64_t lTemp = s_wUSResidule + lLoad;
int64_t lUS = lTemp / s_wUSUnit;
s_lSystemUS += lUS;
int64_t lUS = lTemp / s_wUSUnit;
s_lSystemUS += lUS;
s_wUSResidule = (uint32_t)((int64_t)lTemp - (int64_t)lUS * s_wUSUnit);
} while(0);
s_wUSResidule = (uint32_t)((int64_t)lTemp - (int64_t)lUS * s_wUSUnit);
} while(0);
}
}
uint32_t perfc_get_systimer_frequency(void)