mirror of
https://github.com/GorgonMeducer/perf_counter.git
synced 2025-02-07 19:34:18 +08:00
fix stop_cycle_counter() return value overflow issue
This commit is contained in:
parent
58cb54f009
commit
47c8c3be6f
@ -16,8 +16,8 @@
|
|||||||
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
|
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
|
||||||
|
|
||||||
<releases>
|
<releases>
|
||||||
<release date="2023-03-03" version="2.1.0-dev" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.2.1.0-dev.pack">
|
<release date="2023-03-06" version="2.1.0-dev2" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.2.1.0-dev2.pack">
|
||||||
- Add Coremark
|
- Update stop_cycle_counter prototype to solve return-value-overflow issue
|
||||||
</release>
|
</release>
|
||||||
<release date="2023-03-02" version="2.0.0" url="https://github.com/GorgonMeducer/perf_counter/raw/0c6b79b20308bb9b7d15a7c65f0fe91174c78061/cmsis-pack/GorgonMeducer.perf_counter.2.0.0.pack">
|
<release date="2023-03-02" version="2.0.0" url="https://github.com/GorgonMeducer/perf_counter/raw/0c6b79b20308bb9b7d15a7c65f0fe91174c78061/cmsis-pack/GorgonMeducer.perf_counter.2.0.0.pack">
|
||||||
- Add Coremark
|
- Add Coremark
|
||||||
@ -271,12 +271,12 @@
|
|||||||
</Pre_Include_Global_h>
|
</Pre_Include_Global_h>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
<component Cgroup="perf_counter" Csub="Benchmark" Cvariant="Coremark" Cversion="1.0.0" condition="perf_counter">
|
<component Cgroup="perf_counter" Csub="Benchmark" Cvariant="Coremark" Cversion="1.1.0" condition="perf_counter">
|
||||||
<description>Coremark</description>
|
<description>Coremark</description>
|
||||||
<files>
|
<files>
|
||||||
<file category="source" name="benchmark/coremark_port/core_main.c"/>
|
<file category="source" name="benchmark/coremark_port/core_main.c"/>
|
||||||
<file category="source" name="benchmark/coremark_port/core_portme.c" attr="config" version="1.0.0" />
|
<file category="source" name="benchmark/coremark_port/core_portme.c" attr="config" version="1.1.0" />
|
||||||
<file category="header" name="benchmark/coremark_port/core_portme.h" attr="config" version="1.0.0" />
|
<file category="header" name="benchmark/coremark_port/core_portme.h" attr="config" version="1.1.0" />
|
||||||
|
|
||||||
<file category="include" name="benchmark/coremark/" />
|
<file category="include" name="benchmark/coremark/" />
|
||||||
<file category="source" name="benchmark/coremark/core_list_join.c"/>
|
<file category="source" name="benchmark/coremark/core_list_join.c"/>
|
||||||
|
@ -65,7 +65,7 @@ volatile ee_s32 seed5_volatile = 0;
|
|||||||
|
|
||||||
extern uint32_t SystemCoreClock;
|
extern uint32_t SystemCoreClock;
|
||||||
|
|
||||||
static volatile CORE_TICKS s_nCycleElapsed = 0;
|
static volatile CORE_TICKS s_tCycleElapsed = 0;
|
||||||
|
|
||||||
/* Function : start_time
|
/* Function : start_time
|
||||||
This function will be called right before starting the timed portion of
|
This function will be called right before starting the timed portion of
|
||||||
@ -91,7 +91,7 @@ start_time(void)
|
|||||||
void
|
void
|
||||||
stop_time(void)
|
stop_time(void)
|
||||||
{
|
{
|
||||||
s_nCycleElapsed = stop_cycle_counter();
|
s_tCycleElapsed = stop_cycle_counter();
|
||||||
}
|
}
|
||||||
/* Function : get_time
|
/* Function : get_time
|
||||||
Return an abstract "ticks" number that signifies time on the system.
|
Return an abstract "ticks" number that signifies time on the system.
|
||||||
@ -105,7 +105,7 @@ stop_time(void)
|
|||||||
CORE_TICKS
|
CORE_TICKS
|
||||||
get_time(void)
|
get_time(void)
|
||||||
{
|
{
|
||||||
return s_nCycleElapsed;
|
return s_tCycleElapsed;
|
||||||
}
|
}
|
||||||
/* Function : time_in_secs
|
/* Function : time_in_secs
|
||||||
Convert the value returned by get_time to seconds.
|
Convert the value returned by get_time to seconds.
|
||||||
|
@ -76,7 +76,7 @@ Original Author: Shay Gal-on
|
|||||||
/* Configuration : CORE_TICKS
|
/* Configuration : CORE_TICKS
|
||||||
Define type of return from the timing functions.
|
Define type of return from the timing functions.
|
||||||
*/
|
*/
|
||||||
typedef int32_t CORE_TICKS;
|
typedef int64_t CORE_TICKS;
|
||||||
|
|
||||||
/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
|
/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
|
||||||
Initialize these strings per platform
|
Initialize these strings per platform
|
||||||
|
Binary file not shown.
@ -16,7 +16,10 @@
|
|||||||
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
|
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
|
||||||
|
|
||||||
<releases>
|
<releases>
|
||||||
<release date="2023-03-02" version="2.0.0" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.2.0.0.pack">
|
<release date="2023-03-06" version="2.1.0-dev2" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.2.1.0-dev2.pack">
|
||||||
|
- Update stop_cycle_counter prototype to solve return-value-overflow issue
|
||||||
|
</release>
|
||||||
|
<release date="2023-03-02" version="2.0.0" url="https://github.com/GorgonMeducer/perf_counter/raw/0c6b79b20308bb9b7d15a7c65f0fe91174c78061/cmsis-pack/GorgonMeducer.perf_counter.2.0.0.pack">
|
||||||
- Add Coremark
|
- Add Coremark
|
||||||
</release>
|
</release>
|
||||||
<release date="2023-02-09" version="1.9.11" url="https://github.com/GorgonMeducer/perf_counter/raw/659eb12026977d81391d90290706f9ac3c8efe7e/cmsis-pack/GorgonMeducer.perf_counter.1.9.11.pack">
|
<release date="2023-02-09" version="1.9.11" url="https://github.com/GorgonMeducer/perf_counter/raw/659eb12026977d81391d90290706f9ac3c8efe7e/cmsis-pack/GorgonMeducer.perf_counter.1.9.11.pack">
|
||||||
@ -227,7 +230,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<components>
|
<components>
|
||||||
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="2.0.0">
|
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="2.1.0-dev">
|
||||||
<description>A dedicated performance counter for Cortex-M systick.</description>
|
<description>A dedicated performance counter for Cortex-M systick.</description>
|
||||||
<doc>documents/Doxygen/html/index.html</doc>
|
<doc>documents/Doxygen/html/index.html</doc>
|
||||||
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" condition="CMSIS-CORE">
|
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" condition="CMSIS-CORE">
|
||||||
@ -268,12 +271,12 @@
|
|||||||
</Pre_Include_Global_h>
|
</Pre_Include_Global_h>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
<component Cgroup="perf_counter" Csub="Benchmark" Cvariant="Coremark" Cversion="1.0.0" condition="perf_counter">
|
<component Cgroup="perf_counter" Csub="Benchmark" Cvariant="Coremark" Cversion="1.1.0" condition="perf_counter">
|
||||||
<description>Coremark</description>
|
<description>Coremark</description>
|
||||||
<files>
|
<files>
|
||||||
<file category="source" name="benchmark/coremark_port/core_main.c"/>
|
<file category="source" name="benchmark/coremark_port/core_main.c"/>
|
||||||
<file category="source" name="benchmark/coremark_port/core_portme.c" attr="config" version="1.0.0" />
|
<file category="source" name="benchmark/coremark_port/core_portme.c" attr="config" version="1.1.0" />
|
||||||
<file category="header" name="benchmark/coremark_port/core_portme.h" attr="config" version="1.0.0" />
|
<file category="header" name="benchmark/coremark_port/core_portme.h" attr="config" version="1.1.0" />
|
||||||
|
|
||||||
<file category="include" name="benchmark/coremark/" />
|
<file category="include" name="benchmark/coremark/" />
|
||||||
<file category="source" name="benchmark/coremark/core_list_join.c"/>
|
<file category="source" name="benchmark/coremark/core_list_join.c"/>
|
||||||
|
@ -424,11 +424,11 @@ void start_cycle_counter(void)
|
|||||||
* \return int32_t the elapsed cycle count
|
* \return int32_t the elapsed cycle count
|
||||||
*/
|
*/
|
||||||
__STATIC_INLINE
|
__STATIC_INLINE
|
||||||
int32_t stop_cycle_counter(void)
|
int64_t stop_cycle_counter(void)
|
||||||
{
|
{
|
||||||
int32_t nTemp = (int32_t)(get_system_ticks() - g_lLastTimeStamp);
|
int64_t lTemp = (get_system_ticks() - g_lLastTimeStamp);
|
||||||
|
|
||||||
return nTemp - g_nOffset;
|
return lTemp - g_nOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -424,11 +424,11 @@ void start_cycle_counter(void)
|
|||||||
* \return int32_t the elapsed cycle count
|
* \return int32_t the elapsed cycle count
|
||||||
*/
|
*/
|
||||||
__STATIC_INLINE
|
__STATIC_INLINE
|
||||||
int32_t stop_cycle_counter(void)
|
int64_t stop_cycle_counter(void)
|
||||||
{
|
{
|
||||||
int32_t nTemp = (int32_t)(get_system_ticks() - g_lLastTimeStamp);
|
int64_t lTemp = (get_system_ticks() - g_lLastTimeStamp);
|
||||||
|
|
||||||
return nTemp - g_nOffset;
|
return lTemp - g_nOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user