Hello,
Is there any functions to display the CPU usage of each JAVA task with MicroEJ ?
Thanks
Hello,
Is there any functions to display the CPU usage of each JAVA task with MicroEJ ?
Thanks
Hello marvelous,
In which context do you want to get CPU usage information about the managed threads?
For profiling, in a development environment, we have the trace system that provides information about thread execution context switch.
Coupled with a native profiler, you can get the CPU usage per thread (and even profile the execution of your Application in the context of the system or process depending on what you are doing).
Typically, we provide integration with the SEGGER SystemView profiler for RTOS: SystemView — MicroEJ Documentation
For Linux or other systems/profilers, let us know more about your project, we may have more context-specific recommendations. You can also contact your MicroEJ support.
If you need to monitor the usage at runtime, for multi-sandbox Applications, we provide a mechanism to limit the CPU usage per Application using execution quotas: Kernel & Features Specification (KF) — MicroEJ Documentation
Best regards,
Rémy
Hello,
This is for an ESP32 application in a IOT hub controller.
When the IOT hub have a lot of devices, the code seems to be laggy (logs are slower and we know that it doesn’t process the messages fast enough)
We have a task scheduled at 10 seconds that display the RAM (and execute the garbage collector) and we found that this task “is helping”: When the garbage collector is executed the code runs faster.
We don’t know if this is a RAM or CPU issue:
We was more looking for something that can display in the logs each JAVA task with it’s CPU usage. Like the FreeRTOS functions in C side.
I already found SystemView thing, but we don’t have JTAG/SWD on our board, so we are not able to connect a debugger
Hello @marvelous,
So indeed, what you are looking for is profiling tools ![]()
We have a task scheduled at 10 seconds that display the RAM (and execute the garbage collector) and we found that this task “is helping”: When the garbage collector is executed the code runs faster.
What version of the MicroEJ Architecture are you using?
It may be worth testing with a recent version of MicroEJ Architecture.
In the latest release (8.5.0), the memory allocator in the Core Engine was optimized to better handle the large fragmented heaps: Architectures Changelog — MicroEJ Documentation
You can contact your MicroEJ Support to get an updated version.
I already found SystemView thing, but we don’t have JTAG/SWD on our board, so we are not able to connect a debugger
JTAG/SWD is not a strict requirement for SystemView trace recording.
It is very convenient indeed, and needed for live recording.
But it is also possible to do “single shot recording”, and dump the traces buffer through a different interface (UART, …).
In this mode, you could have the following setup:
Alternatively, you could implement your own profiler in the native code by implementing the Core Engine Monitoring hooks and mixing the information with the FreeRTOS scheduler hooks for your use case.
Let us know if you need help with either solution, or need some help with the investigation on the performance of your application.
Best regards,
Rémy