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

gcc virtual device runs at 100% cpu #1036

Closed
m-mcgowan opened this issue Jun 15, 2016 · 5 comments · Fixed by #1167

Comments

@m-mcgowan
Copy link
Contributor

commented Jun 15, 2016

The gcc virtual device emulates an embedded device, where the CPU is being given work to do all the time. This carries over to the cross compiled version, where it consumes 100% of the executing cpu core on a desktop machine.

Some steps to mitigate this will make the cross compile device more scalable and environmentally friendly.


Completeness:

  • Minimum test case added
  • Device, system and user firmware versions stated
  • Particle confirmed
@sergeuz

This comment has been minimized.

Copy link
Member

commented Jun 15, 2016

As a simple solution we can try to call std::this_thread::yield() before reentering busy loops, such as the application loop. Probably this can be even automated via gcc's instrumentation.

@joegoggins

This comment has been minimized.

Copy link
Contributor

commented Jun 15, 2016

A non firmware way to do this is to run a gcc virtual device in a Docker container and specify the --cpu-shares (relative CPU shares),--cpu-period, or--cpuset-cpus` flags to the docker run command to limit how much CPU it consumes.

@andyw-lala

This comment has been minimized.

Copy link
Contributor

commented Jun 15, 2016

That's just going to slow down the instance running in the container. It
will solve the host resource problem of pegging a core, but it will make
the instance run strangely as it meters the cpu out to the container.

On Wed, Jun 15, 2016 at 5:56 PM, Joe Goggins notifications@github.com
wrote:

A non firmware way to do this is to run a gcc virtual device in a Docker
container and specify the --cpu-shares (relative CPU shares),--cpu-period,
or--cpuset-cpus` flags to the docker run command
https://docs.docker.com/engine/reference/run/ to limit how much CPU it
consumes.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1036 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADv7QNGzv9q9_ib8DkejzEtKCE0WDdDkks5qMIMvgaJpZM4I22rg
.

Andy

@m-mcgowan m-mcgowan added this to the 0.7.x milestone Sep 13, 2016

@technobly technobly modified the milestones: 0.7.x, 0.6.1 Nov 29, 2016

@hazeem1991

This comment has been minimized.

Copy link

commented Jun 28, 2019

i really having like this kind of problem but i did not find any way to solve it any advice ?

@joegoggins

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2019

The referenced PR above provides a solution and more advice @hazeem1991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.