High CPU utilization with Pylab

M

Madhur

I am trying to plot a runtime graph using pylab. But the very purpose
of functionality is lost because of high CPU percentage hogged by
plotting the graph.

Here is the piece of code which I have written.

def timerfunc(ulcm, dlcm):
count=0
xaxis=[]
yaxis=[]
ion()
while 1:
xaxis.append(count)
dr=(((dlcm.sum)/dlcm.timer)*8)
dlcm.counter=0
yaxis.append(dr)
dlcm.sum=0
h=plot(xaxis,yaxis,'b')
draw()
count=count+1
time.sleep(dlcm.timer/1000.0)
if (count>100):
xlim(count-100, count)

Here is the function which plots the graph.

Is there something which does not makes sense .?

-Madhur
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top