Search found 4 matches

by musiclover
Sun May 14, 2017 9:27 am
Forum: General Support
Topic: Measuring CPU Usage
Replies: 20
Views: 32500

Re: Measuring CPU Usage

Thanks Giovanni and thanks for remind. That code will only be used for testing, and when testing is finished, I'll disable the code and change CH_DBG_STATISTICS to FALSE. :D
by musiclover
Sun May 14, 2017 3:45 am
Forum: General Support
Topic: Measuring CPU Usage
Replies: 20
Views: 32500

Re: Measuring CPU Usage

Hi Giovanni,
I wrote a function to measure the average usage of CPU. The code is below. Is this correct? Thanks a lot!

static void CPU_load(BaseSequentialStream *chp) {

thread_t *tp;

uint64_t sum=0;
uint16_t tmp1, tmp2;

tp = chRegFirstThread();
do {
sum += tp->p_stats.cumulative;
tp ...
by musiclover
Wed May 10, 2017 4:26 am
Forum: General Support
Topic: Measuring CPU Usage
Replies: 20
Views: 32500

Re: Measuring CPU Usage

Hi Giovanni

Thank you very much, I'll try it.
by musiclover
Tue May 09, 2017 4:31 pm
Forum: General Support
Topic: Measuring CPU Usage
Replies: 20
Views: 32500

Re: Measuring CPU Usage

Hi,

There is no default measurement system because several strategies could be implemented (recent usage only, usage since system start etc) but the system offers the hook and facilities to implement any measurement algorithm.

The hook macro SYSTEM_TICK_EVENT_HOOK() allows to hook code to handle ...