Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iotdk: cpu_stats function doesn't work as expected #27771

Closed
maksimmasalski opened this issue Aug 25, 2020 · 2 comments · Fixed by #28001
Closed

iotdk: cpu_stats function doesn't work as expected #27771

maksimmasalski opened this issue Aug 25, 2020 · 2 comments · Fixed by #28001
Assignees
Labels
area: ARC ARC Architecture bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@maksimmasalski
Copy link
Collaborator

Describe the bug
cpu_stats profiling function doesn’t work as expected, it always report cpu usage 100 even if cpu in idle thread for a long time. It looks like the cpu_stats hooks does not have a chance to count the switch in of idle thread (stats_hw_tick.idle always 0).

Hello World! iotdk
CPU usage: 100
CPU usage: 100
CPU usage: 100
CPU usage: 100
CPU usage: 100

It always report cpu usage 100%, and global variable stats_hw_tick.idle is 0, but I confirmed cpu can enter idle

To Reproduce

  1. Use latest master c64e0ce
  2. SDK 0.11.4
  3. Go to samples/hello_world
  4. Add to prj.conf configuration for turning on cpu_stats:
CONFIG_TRACING=y
CONFIG_TRACING_CPU_STATS=y
CONFIG_TRACING_CPU_STATS_LOG=y
  1. west build -p -b iotdk samples/hello_world/
  2. west flash
  3. View the output

Expected behavior
When system idle, the cpu usage reported should not be always 100%
My expectation

Hello World! iotdk
CPU usage: 0
CPU usage: 0
CPU usage: 0
CPU usage: 0
CPU usage: 0

Impact
Wrong cpu_stats function execution on the arc board.

Environment (please complete the following information):

  • OS: Linux Ubuntu 18.04.4 LTS
  • Toolchain Zephyr SDK 0.11.4
  • Commit SHA c64e0ce
@maksimmasalski maksimmasalski added bug The issue is a bug, or the PR is fixing a bug area: ARC ARC Architecture labels Aug 25, 2020
@MaureenHelm MaureenHelm added the priority: low Low impact/importance bug label Aug 25, 2020
@nashif
Copy link
Member

nashif commented Aug 31, 2020

Here we are not recording switched_in/switched_out correctly for all threads and cpu stats depends on such information. switched_in might need to move to the arch context switch code and not be in the c code.

@jocelyn-li
Copy link
Collaborator

@evgeniy-paltsev I am interested with this fix. Do you have timeline for the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARC ARC Architecture bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants