how to measure CPU load

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, 99jonathan, imaqine

how to measure CPU load

Postby Aswin » Wed Mar 13, 2013 11:44 am

Hi,

Does anyone know of a way to measure the CPU load of the NXT when running a program?
I want to add functionality to my program. But before I start I would like to know how much resources the NXT still has available.

Aswin
My NXT blog: http://nxttime.wordpress.com/
Aswin
Active User
 
Posts: 122
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: how to measure CPU load

Postby gloomyandy » Wed Mar 13, 2013 5:24 pm

Not very easy to do. Best I can come up with is to create a very low priority thread that counts in a loop. Zero the counter from time to time and see how many counts you get per second. Problem is if you have any busy wait loops in your (or in other code) it won't run at all (leJOS is totally priority driven for threading). If that does not work you could try doing the same but with the thread at normal priority and perhaps with a sleep in it... Compare the results you get with what happens with no other threads running, may give you some sort of feel for how busy things are...
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: how to measure CPU load

Postby skoehler » Wed Mar 13, 2013 7:53 pm

gloomyandy wrote:(leJOS is totally priority driven for threading)

which means that a thread of priority x is only scheduled if no threads of a priority larger than x is ready to be execute
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff