mirror of
https://github.com/GorgonMeducer/perf_counter.git
synced 2025-01-17 19:13:03 +08:00
add new function update_perf_counter()
This commit is contained in:
parent
ce1d99b088
commit
781389d0a7
@ -249,6 +249,14 @@ void __perf_os_patch_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief update perf_counter as SystemCoreClock has been updated.
|
||||
*/
|
||||
void update_perf_counter(void)
|
||||
{
|
||||
s_nUSUnit = SystemCoreClock / 1000000ul;
|
||||
s_nMSUnit = SystemCoreClock / 1000ul;
|
||||
}
|
||||
|
||||
/*! \brief initialise cycle counter service
|
||||
* \note - don't forget to tell the function whether the systick is already
|
||||
@ -290,8 +298,7 @@ void init_cycle_counter(bool bIsSysTickOccupied)
|
||||
//s_nSystemClockCounts = s_nCycleCounts;
|
||||
s_nOffset = stop_cycle_counter();
|
||||
|
||||
s_nUSUnit = SystemCoreClock / 1000000ul;
|
||||
s_nMSUnit = SystemCoreClock / 1000ul;
|
||||
update_perf_counter();
|
||||
s_lSystemClockCounts = 0; // reset system cycle counter
|
||||
s_nSystemMS = 0; // reset system millisecond counter
|
||||
|
||||
|
@ -582,6 +582,10 @@ extern void init_cycle_counter(bool bIsSysTickOccupied);
|
||||
*/
|
||||
extern void user_code_insert_to_systick_handler(void);
|
||||
|
||||
/*!
|
||||
* \brief update perf_counter as SystemCoreClock has been updated.
|
||||
*/
|
||||
extern void update_perf_counter(void);
|
||||
|
||||
//#if defined(__clang__)
|
||||
//# pragma clang diagnostic pop
|
||||
|
Loading…
x
Reference in New Issue
Block a user