Hello,
what is the difference between statistic module (CH_DBG_STATISTICS) and profiling module (CH_DBG_THREADS_PROFILING) ?
do they offer same kind of service ?
CH_DBG_THREADS_PROFILING is not compatible with tickless mode, so is it only there for legacy, and new development should use STATISTICS instead ?
Alexandre
Programmatic use of CH_DBG_STATISTICS
Moderators: RoccoMarco, barthess
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Programmatic use of CH_DBG_STATISTICS
Profiling uses the system tick interrupt to increase a counter in threads, it is only meaningful after a long runtime. It is a legacy mechanism, it could be removed in future versions.
Giovanni
Giovanni
Re: Programmatic use of CH_DBG_STATISTICS
Giovanni wrote:There should not be weird values for "cumulative", that is an uint64_t variable that is only increased until it wraps.
Giovanni
Ok eliminating 0 and 0xFFFFFFFF makes things a bit better, but I still have this:
stats.best=0x151 stats.worst=0x88887DCB stats.cumulative=0x899038D8 stats.n=16898
FTP PRI= 58 sp=0x30023D40 STACK=1488/2896 MIN= 43 AVG=17073 MAX=286330810 TOT=25.0%
So the cumulative/worst value is totally unbelievable. This also happens to be the calling thread - is there some possibility that the stats are messed up if you are in the thread concerned? (the first line is the raw values, the second via unsigned(RTC2US(STM32_HSECLK, stats.worst)) for instance)
Re: Programmatic use of CH_DBG_STATISTICS
andypiper wrote:
Ok eliminating 0 and 0xFFFFFFFF makes things a bit better, but I still have this:
stats.best=0x151 stats.worst=0x88887DCB stats.cumulative=0x899038D8 stats.n=16898
FTP PRI= 58 sp=0x30023D40 STACK=1488/2896 MIN= 43 AVG=17073 MAX=286330810 TOT=25.0%
So the cumulative/worst value is totally unbelievable. This also happens to be the calling thread - is there some possibility that the stats are messed up if you are in the thread concerned? (the first line is the raw values, the second via unsigned(RTC2US(STM32_HSECLK, stats.worst)) for instance)
Solved it! It's not safe to call chTMObjectInit(&tp->stats) when tp is the current thread!
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Programmatic use of CH_DBG_STATISTICS
Hi,
You should not change anything in a thread structure, why are you initializing that? it is done already when the thread is created.
Giovanni
You should not change anything in a thread structure, why are you initializing that? it is done already when the thread is created.
Giovanni
Re: Programmatic use of CH_DBG_STATISTICS
Giovanni wrote:Hi,
You should not change anything in a thread structure, why are you initializing that? it is done already when the thread is created.
Giovanni
I need to reset the statistics so that the data is not skewed by transient initial conditions
Re: Programmatic use of CH_DBG_STATISTICS
Giovanni wrote:Hi,
You should not change anything in a thread structure, why are you initializing that? it is done already when the thread is created.
Giovanni
Another question - is it possible to get the stats for the ISRs?
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Programmatic use of CH_DBG_STATISTICS
Yes, in "ch.kernel_stats", see "struct ch_system" in chschd.h.
Giovanni
Giovanni
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: Programmatic use of CH_DBG_STATISTICS
Hi,
This topics make me discover STATISTICS module.
This module fulfills all my needs, ChibiOS is full of gems that are sometime hard to discover.
Perhaps the thread command in the shell examples should use it and display thread and ISR cpu %
Alexandre
This topics make me discover STATISTICS module.
This module fulfills all my needs, ChibiOS is full of gems that are sometime hard to discover.
Perhaps the thread command in the shell examples should use it and display thread and ISR cpu %
Alexandre
Who is online
Users browsing this forum: No registered users and 38 guests