Processor utilization in percent

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: Processor utilization in percent

Postby rudi ;-) » Thu Mar 09, 2017 11:31 pm

Hans Dorn wrote:Try doing a make menuconfig first to trigger a complete rebuild.
Just toggle an option on and off, save config and build.
thank you Hans,

make clean
make menuconfig
toggle an option
saved
make menconfig
toggle an option
saved
make all

same error

best wishes
rudi ;-)

seems few core/task utilies are missing in the freertos or gone private
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Hans Dorn
Posts: 62
Joined: Tue Feb 21, 2017 2:21 am

Re: Processor utilization in percent

Postby Hans Dorn » Thu Mar 09, 2017 11:42 pm

I don't know what gives here.

I'm using the arduino IDE because I like it's simplicity, but have the SDK installed somewhere, too.

I'll try playing around with it during the weekend and see if I can get the task stats running.


Cheers

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Processor utilization in percent

Postby kolban » Fri Mar 10, 2017 12:16 am

Remember that the source of FreeRTOS is in the ESP-IDF.

vTaskGetRunTimeStats is a macro ...

https://github.com/espressif/esp-idf/bl ... pers.h#L97
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Hans Dorn
Posts: 62
Joined: Tue Feb 21, 2017 2:21 am

Re: Processor utilization in percent

Postby Hans Dorn » Fri Mar 10, 2017 12:29 am

Not sure if this applies to the ESP IDF.

There's no MPU_vTaskDelay in libfreertos.a, but vTaskDelay is there.

Also, the code for vTaskGetRunTimeStats can be found in tasks.c

Cheers

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: Processor utilization in percent

Postby rudi ;-) » Fri Mar 10, 2017 9:37 am

hi guys

thank you

yes found the double as macro defined too
but we have it in tasks.c as function too

https://github.com/espressif/esp-idf/bl ... ks.c#L3989

btw we have
tasks.c and task.h

Currently I am helpless

best wishes
rudi ;-)

edit:
Where is the sorting what may go into the freertos lib and what is not
we have no OBJS ( .o ) file in the build too
so where is this outsorted in the makefile? project_makefile?
https://github.com/espressif/esp-idf/bl ... _config.mk

https://github.com/espressif/esp-idf/bl ... _common.mk
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: Processor utilization in percent

Postby rudi ;-) » Fri Mar 10, 2017 10:02 am

ok..
https://github.com/espressif/esp-idf/bl ... ks.c#L3987

Code: Select all


#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) )

so where we set this config in the menuconfig ?
https://github.com/espressif/esp-idf/bl ... sk.h#L1360

we have to set manual?

Code: Select all

#define configGENERATE_RUN_TIME_STATS 1
mhm..

C:/eMbeddedHome2017/CLK_erzeuger/hello_world/main/hello_world_main.c:23:0: warning: "configGENERATE_RUN_TIME_STATS" redefined
#define configGENERATE_RUN_TIME_STATS 1
^
In file included from C:/eMbeddedHome2017/CLK_erzeuger/hello_world/main/hello_world_main.c:10:0:
C:/idf/1970_142_23/components/freertos/include/freertos/FreeRTOS.h:622:0: note: this is the location of the previous definition
#define configGENERATE_RUN_TIME_STATS 0
^
further test:

Code: Select all

// #define configGENERATE_RUN_TIME_STATS 1
#ifdef configGENERATE_RUN_TIME_STATS
#undef configGENERATE_RUN_TIME_STATS 
#define configGENERATE_RUN_TIME_STATS 1
#endif
helps not
edit :
https://github.com/espressif/esp-idf/bl ... TOS.h#L620

Code: Select all


#ifndef configGENERATE_RUN_TIME_STATS
	#define configGENERATE_RUN_TIME_STATS 1 // test rudi .orig is 0
#endif


error

Code: Select all


#if ( configGENERATE_RUN_TIME_STATS == 1 )

	#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
		#error If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined.  portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base.
	#endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */

	#ifndef portGET_RUN_TIME_COUNTER_VALUE
		#ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
			#error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined.  See the examples provided and the FreeRTOS web site for more information.
		#endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
	#endif /* portGET_RUN_TIME_COUNTER_VALUE */

https://github.com/espressif/esp-idf/bl ... TOS.h#L638

Code: Select all

#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
	#define PortCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#endif

next step?

RTFM
http://www.freertos.org/rtos-run-time-stats.html

we need to create 2 macros
portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
portGET_RUN_TIME_COUNTER_VALUE()



best wishes
rudi ;-)


edit:
seems to be a weekend work
here are examples from other cpu's
http://www.freertos.org/Free-RTOS-For-N ... C17xx.html
http://www.freertos.org/portLM3Sxxxx_Eclipse.html

so perhabs
the best will be we create for this an ESP32 example too?
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Re: Processor utilization in percent

Postby dmaxben » Thu Mar 22, 2018 3:36 pm

Curious if anyone else has any updates on getting CPU utilization working in % using Arduino?

I'd like to print each core's CPU utilization in "xx%" in a serial terminal window...

thanks

Who is online

Users browsing this forum: No registered users and 119 guests