mirror of
https://github.com/GorgonMeducer/perf_counter.git
synced 2025-01-17 19:13:03 +08:00
v1.9.0
This commit is contained in:
parent
af9551a4db
commit
ebf2323b52
@ -16,7 +16,12 @@
|
||||
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
|
||||
|
||||
<releases>
|
||||
<release date="2022-01-29" version="1.8.2" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.8.2.pack">
|
||||
<release date="2022-01-29" version="1.9.0" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.0.pack">
|
||||
- Add preprocessing in perf_counter.h to detect whether GNU extension is enabled or not.
|
||||
- Enhance RTOS support
|
||||
- Add macro __PERF_COUNTER__ in RTE_Components.h for compile-time detection.
|
||||
</release>
|
||||
<release date="2022-01-29" version="1.8.2" url="https://github.com/GorgonMeducer/perf_counter/raw/1607c021f50d0305394870ca34b5412d949aaa4f/cmsis-pack/GorgonMeducer.perf_counter.1.8.2.pack">
|
||||
- Fix a bug found in __cycleof__. The __cycle_counter__ was not updated with the measure result.
|
||||
- Add macros for version info.
|
||||
</release>
|
||||
@ -138,10 +143,10 @@
|
||||
-->
|
||||
|
||||
<components>
|
||||
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.8.2">
|
||||
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.0">
|
||||
<description>A dedicated performance counter for Cortex-M systick.</description>
|
||||
<doc></doc>
|
||||
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true">
|
||||
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true" condition="CMSIS-CORE">
|
||||
<description>A dedicated performance counter for Cortex-M systick.</description>
|
||||
<files>
|
||||
<file category="header" name="lib/perf_counter.h"/>
|
||||
|
Binary file not shown.
BIN
cmsis-pack/GorgonMeducer.perf_counter.1.9.0.pack
Normal file
BIN
cmsis-pack/GorgonMeducer.perf_counter.1.9.0.pack
Normal file
Binary file not shown.
@ -16,7 +16,12 @@
|
||||
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
|
||||
|
||||
<releases>
|
||||
<release date="2022-01-29" version="1.8.2" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.8.2.pack">
|
||||
<release date="2022-01-29" version="1.9.0" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.0.pack">
|
||||
- Add preprocessing in perf_counter.h to detect whether GNU extension is enabled or not.
|
||||
- Enhance RTOS support
|
||||
- Add macro __PERF_COUNTER__ in RTE_Components.h for compile-time detection.
|
||||
</release>
|
||||
<release date="2022-01-29" version="1.8.2" url="https://github.com/GorgonMeducer/perf_counter/raw/1607c021f50d0305394870ca34b5412d949aaa4f/cmsis-pack/GorgonMeducer.perf_counter.1.8.2.pack">
|
||||
- Fix a bug found in __cycleof__. The __cycle_counter__ was not updated with the measure result.
|
||||
- Add macros for version info.
|
||||
</release>
|
||||
@ -138,16 +143,20 @@
|
||||
-->
|
||||
|
||||
<components>
|
||||
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.8.2">
|
||||
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.0">
|
||||
<description>A dedicated performance counter for Cortex-M systick.</description>
|
||||
<doc></doc>
|
||||
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true">
|
||||
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true" condition="CMSIS-CORE">
|
||||
<description>A dedicated performance counter for Cortex-M systick.</description>
|
||||
<files>
|
||||
<file category="header" name="lib/perf_counter.h"/>
|
||||
<file category="library" name="lib/perf_counter.lib" condition="Cortex-M Arm Compiler"/>
|
||||
<file category="library" name="lib/libperf_counter_gcc.a" condition="Cortex-M Arm GCC"/>
|
||||
</files>
|
||||
<Pre_Include_Global_h>
|
||||
|
||||
#define __PERF_COUNTER__
|
||||
</Pre_Include_Global_h>
|
||||
</component>
|
||||
|
||||
<component Cgroup="perf_counter" Csub="Core" Cvariant="Source" condition="CMSIS-CORE">
|
||||
@ -158,6 +167,10 @@
|
||||
<file category="source" name="systick_wrapper_ual.s" condition="Cortex-M Arm Compiler CMSIS-CORE"/>
|
||||
<file category="source" name="systick_wrapper_gcc.s" condition="Cortex-M Arm GCC CMSIS-CORE"/>
|
||||
</files>
|
||||
<Pre_Include_Global_h>
|
||||
|
||||
#define __PERF_COUNTER__
|
||||
</Pre_Include_Global_h>
|
||||
</component>
|
||||
|
||||
<component Cgroup="perf_counter" Csub="RTX5 Patch" condition="RTX5 Patch">
|
||||
|
@ -75,12 +75,12 @@
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>7</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>1</uSim>
|
||||
<uTrg>0</uTrg>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
@ -292,7 +292,7 @@
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>7</CpuCode>
|
||||
<DebugOpt>
|
||||
@ -881,7 +881,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>::Utilities</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<TargetName>example_arm_compiler_6</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>6160000::V6.16::ARMCLANG</pCCUsed>
|
||||
<pCCUsed>6170000::V6.17::.\Arm Compiler 6.17</pCCUsed>
|
||||
<uAC6>1</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
@ -938,7 +938,7 @@
|
||||
<uC99>1</uC99>
|
||||
<uGnu>1</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6Lang>4</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
|
Binary file not shown.
@ -24,12 +24,13 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "cmsis_compiler.h"
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
#define __PERF_COUNTER_VER_MAJOR__ 1
|
||||
#define __PERF_COUNTER_VER_MINOR__ 8
|
||||
#define __PERF_COUNTER_VER_REVISE__ 2
|
||||
#define __PERF_COUNTER_VER_MINOR__ 9
|
||||
#define __PERF_COUNTER_VER_REVISE__ 0
|
||||
|
||||
#define __PER_COUNTER_VER__ (__PERF_COUNTER_VER_MAJOR__ * 10000ul \
|
||||
+__PERF_COUNTER_VER_MINOR__ * 100ul \
|
||||
@ -250,7 +251,13 @@
|
||||
SAFE_NAME(temp2);}), \
|
||||
__set_PRIMASK(SAFE_NAME(temp)))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if __PLOOC_VA_NUM_ARGS() != 0
|
||||
#warning Please enable GNC extensions, it is required by __cycleof__() and \
|
||||
__super_loop_monitor__()
|
||||
#endif
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
|
||||
@ -304,7 +311,9 @@ typedef struct {
|
||||
int64_t lStart;
|
||||
int64_t lUsedTotal;
|
||||
int32_t nUsedRecent;
|
||||
uint32_t wActiveCount;
|
||||
uint16_t hwActiveCount;
|
||||
uint16_t : 15;
|
||||
uint16_t bEnabled : 1;
|
||||
} task_cycle_info_t;
|
||||
|
||||
typedef struct task_cycle_info_agent_t task_cycle_info_agent_t;
|
||||
@ -314,11 +323,8 @@ struct task_cycle_info_agent_t {
|
||||
task_cycle_info_agent_t *ptNext;
|
||||
task_cycle_info_agent_t *ptPrev;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
@ -379,6 +385,11 @@ extern int64_t get_system_ticks(void);
|
||||
|
||||
|
||||
#if defined(__PERF_CNT_USE_RTOS__)
|
||||
|
||||
/*! \brief initialize the default virtual cycle counter for the current task
|
||||
*/
|
||||
extern void init_task_cycle_counter(void);
|
||||
|
||||
/*! \brief provide cycle information for target task if perf_counter is used
|
||||
*! together with an RTOS in the support list.
|
||||
*!
|
||||
@ -387,9 +398,33 @@ extern int64_t get_system_ticks(void);
|
||||
*/
|
||||
extern task_cycle_info_t * get_rtos_task_cycle_info(void);
|
||||
|
||||
/*! \brief initialize the default virtual cycle counter for the current task
|
||||
|
||||
/*! \brief intialize a given task_cycle_info_t object and enable it before
|
||||
*! registering it.
|
||||
*/
|
||||
extern void init_task_cycle_counter(void);
|
||||
extern task_cycle_info_t *init_task_cycle_info(task_cycle_info_t *ptInfo);
|
||||
|
||||
/*! \brief enable a given task_cycle_info_t object
|
||||
*!
|
||||
*! \param ptInfo the address of target task_cycle_info_t object
|
||||
*! \return previous status
|
||||
*/
|
||||
extern bool enable_task_cycle_info(task_cycle_info_t *ptInfo)
|
||||
|
||||
/*! \brief disable a given task_cycle_info_t object
|
||||
*!
|
||||
*! \param ptInfo the address of target task_cycle_info_t object
|
||||
*! \return previous status
|
||||
*/
|
||||
extern bool disable_task_cycle_info(task_cycle_info_t *ptInfo)
|
||||
|
||||
/*! \brief resume the enabled status of a given task_cycle_info_t object
|
||||
*!
|
||||
*! \param ptInfo the address of target task_cycle_info_t object
|
||||
*! \param bEnabledStatus the previous status
|
||||
*/
|
||||
extern
|
||||
void resume_task_cycle_info(task_cycle_info_t *ptInfo, bool bEnabledStatus)
|
||||
|
||||
/*! \brief register a global virtual cycle counter agent to the current task
|
||||
*!
|
||||
|
Binary file not shown.
@ -423,6 +423,57 @@ void init_task_cycle_counter(void)
|
||||
ptRootAgent->wMagicWord = MAGIC_WORD_CANARY;
|
||||
}
|
||||
|
||||
task_cycle_info_t *init_task_cycle_info(task_cycle_info_t *ptInfo)
|
||||
{
|
||||
do {
|
||||
if (NULL == ptInfo) {
|
||||
break;
|
||||
}
|
||||
|
||||
memset(ptInfo, 0, sizeof(task_cycle_info_t));
|
||||
|
||||
ptInfo->bEnabled = true;
|
||||
} while(0);
|
||||
|
||||
return ptInfo;
|
||||
}
|
||||
|
||||
bool enable_task_cycle_info(task_cycle_info_t *ptInfo)
|
||||
{
|
||||
if (NULL == ptInfo) {
|
||||
return false;
|
||||
}
|
||||
bool bOrig;
|
||||
__IRQ_SAFE {
|
||||
bOrig = ptInfo->bEnabled;
|
||||
ptInfo->bEnabled = true;
|
||||
}
|
||||
return bOrig;
|
||||
}
|
||||
|
||||
bool disable_task_cycle_info(task_cycle_info_t *ptInfo)
|
||||
{
|
||||
if (NULL == ptInfo) {
|
||||
return false;
|
||||
}
|
||||
bool bOrig;
|
||||
__IRQ_SAFE {
|
||||
bOrig = ptInfo->bEnabled;
|
||||
ptInfo->bEnabled = false;
|
||||
}
|
||||
return bOrig;
|
||||
}
|
||||
|
||||
void resume_task_cycle_info(task_cycle_info_t *ptInfo, bool bEnabledStatus)
|
||||
{
|
||||
if (NULL == ptInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
ptInfo->bEnabled = bEnabledStatus;
|
||||
}
|
||||
|
||||
|
||||
task_cycle_info_agent_t *register_task_cycle_agent(task_cycle_info_t *ptInfo,
|
||||
task_cycle_info_agent_t *ptAgent)
|
||||
{
|
||||
@ -440,7 +491,6 @@ task_cycle_info_agent_t *register_task_cycle_agent(task_cycle_info_t *ptInfo,
|
||||
|
||||
ptRootAgent->wMagicWord = MAGIC_WORD_AGENT_LIST_VALID;
|
||||
|
||||
memset(ptInfo, 0, sizeof(task_cycle_info_t));
|
||||
ptAgent->ptInfo = ptInfo;
|
||||
|
||||
//! push to the stack
|
||||
@ -504,14 +554,16 @@ void __on_context_switch_in(uint32_t *pwStack)
|
||||
uint64_t dwTimeStamp = get_system_ticks();
|
||||
|
||||
ptRootAgent->lLastTimeStamp = dwTimeStamp;
|
||||
ptRootAgent->tInfo.wActiveCount++;
|
||||
ptRootAgent->tInfo.hwActiveCount++;
|
||||
|
||||
if (MAGIC_WORD_AGENT_LIST_VALID == ptRootAgent->wMagicWord) {
|
||||
//! update all agents
|
||||
task_cycle_info_agent_t *ptAgent = ptRootAgent->tList.ptNext;
|
||||
while(NULL != ptAgent) {
|
||||
if (NULL != ptAgent->ptInfo) {
|
||||
ptAgent->ptInfo->wActiveCount++;
|
||||
if (ptAgent->ptInfo->bEnabled) {
|
||||
ptAgent->ptInfo->hwActiveCount++;
|
||||
}
|
||||
}
|
||||
ptAgent = ptAgent->ptNext;
|
||||
}
|
||||
@ -531,8 +583,10 @@ void __on_context_switch_out(uint32_t *pwStack)
|
||||
task_cycle_info_agent_t *ptAgent = ptRootAgent->tList.ptNext;
|
||||
while(NULL != ptAgent) {
|
||||
if (NULL != ptAgent->ptInfo) {
|
||||
ptAgent->ptInfo->nUsedRecent = lCycleUsed;
|
||||
ptAgent->ptInfo->lUsedTotal += lCycleUsed;
|
||||
if (ptAgent->ptInfo->bEnabled) {
|
||||
ptAgent->ptInfo->nUsedRecent = lCycleUsed;
|
||||
ptAgent->ptInfo->lUsedTotal += lCycleUsed;
|
||||
}
|
||||
}
|
||||
ptAgent = ptAgent->ptNext;
|
||||
}
|
||||
|
@ -24,12 +24,13 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "cmsis_compiler.h"
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
#define __PERF_COUNTER_VER_MAJOR__ 1
|
||||
#define __PERF_COUNTER_VER_MINOR__ 8
|
||||
#define __PERF_COUNTER_VER_REVISE__ 2
|
||||
#define __PERF_COUNTER_VER_MINOR__ 9
|
||||
#define __PERF_COUNTER_VER_REVISE__ 0
|
||||
|
||||
#define __PER_COUNTER_VER__ (__PERF_COUNTER_VER_MAJOR__ * 10000ul \
|
||||
+__PERF_COUNTER_VER_MINOR__ * 100ul \
|
||||
@ -250,7 +251,13 @@
|
||||
SAFE_NAME(temp2);}), \
|
||||
__set_PRIMASK(SAFE_NAME(temp)))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if __PLOOC_VA_NUM_ARGS() != 0
|
||||
#warning Please enable GNC extensions, it is required by __cycleof__() and \
|
||||
__super_loop_monitor__()
|
||||
#endif
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
|
||||
@ -304,7 +311,9 @@ typedef struct {
|
||||
int64_t lStart;
|
||||
int64_t lUsedTotal;
|
||||
int32_t nUsedRecent;
|
||||
uint32_t wActiveCount;
|
||||
uint16_t hwActiveCount;
|
||||
uint16_t : 15;
|
||||
uint16_t bEnabled : 1;
|
||||
} task_cycle_info_t;
|
||||
|
||||
typedef struct task_cycle_info_agent_t task_cycle_info_agent_t;
|
||||
@ -314,11 +323,8 @@ struct task_cycle_info_agent_t {
|
||||
task_cycle_info_agent_t *ptNext;
|
||||
task_cycle_info_agent_t *ptPrev;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
@ -379,6 +385,11 @@ extern int64_t get_system_ticks(void);
|
||||
|
||||
|
||||
#if defined(__PERF_CNT_USE_RTOS__)
|
||||
|
||||
/*! \brief initialize the default virtual cycle counter for the current task
|
||||
*/
|
||||
extern void init_task_cycle_counter(void);
|
||||
|
||||
/*! \brief provide cycle information for target task if perf_counter is used
|
||||
*! together with an RTOS in the support list.
|
||||
*!
|
||||
@ -387,9 +398,33 @@ extern int64_t get_system_ticks(void);
|
||||
*/
|
||||
extern task_cycle_info_t * get_rtos_task_cycle_info(void);
|
||||
|
||||
/*! \brief initialize the default virtual cycle counter for the current task
|
||||
|
||||
/*! \brief intialize a given task_cycle_info_t object and enable it before
|
||||
*! registering it.
|
||||
*/
|
||||
extern void init_task_cycle_counter(void);
|
||||
extern task_cycle_info_t *init_task_cycle_info(task_cycle_info_t *ptInfo);
|
||||
|
||||
/*! \brief enable a given task_cycle_info_t object
|
||||
*!
|
||||
*! \param ptInfo the address of target task_cycle_info_t object
|
||||
*! \return previous status
|
||||
*/
|
||||
extern bool enable_task_cycle_info(task_cycle_info_t *ptInfo)
|
||||
|
||||
/*! \brief disable a given task_cycle_info_t object
|
||||
*!
|
||||
*! \param ptInfo the address of target task_cycle_info_t object
|
||||
*! \return previous status
|
||||
*/
|
||||
extern bool disable_task_cycle_info(task_cycle_info_t *ptInfo)
|
||||
|
||||
/*! \brief resume the enabled status of a given task_cycle_info_t object
|
||||
*!
|
||||
*! \param ptInfo the address of target task_cycle_info_t object
|
||||
*! \param bEnabledStatus the previous status
|
||||
*/
|
||||
extern
|
||||
void resume_task_cycle_info(task_cycle_info_t *ptInfo, bool bEnabledStatus)
|
||||
|
||||
/*! \brief register a global virtual cycle counter agent to the current task
|
||||
*!
|
||||
|
Loading…
x
Reference in New Issue
Block a user