All times are UTC-06:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed Jun 04, 2008 11:21 am 
Offline

Joined: Mon Mar 31, 2008 11:15 am
Posts: 17
Location: Bari, Italy
I have written a very simple application in python for my Efika that reads from the PSC0 serial 33 bytes every 10 ms. I am using a 2.6.25.3 vanilla kernel on a 2008.0 gentoo installation, configured for lowest latency and 1000 as HZ value.

It is normal to have a system load of 15% (user load almost zero) when just reading from the serial port at 115200 bps?

As I can remeber with the SuSE 10.3 stock kernel top was indicating a load less than 1%...maybe it was with my pentium-m based laptop, but I'm quite sure it was the Efika.

Am I doing something wrong?


Top
   
PostPosted: Thu Jun 05, 2008 5:35 am 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Quote:
I have written a very simple application in python for my Efika that reads from the PSC0 serial 33 bytes every 10 ms. I am using a 2.6.25.3 vanilla kernel on a 2008.0 gentoo installation, configured for lowest latency and 1000 as HZ value.
So you're using HZ and not tickless?
Quote:
It is normal to have a system load of 15% (user load almost zero) when just reading from the serial port at 115200 bps?
There may be some overheads in the serial driver caused by all the layers between the PSC code and usersace. That assumes.. you are reading the port through userspace?
Quote:
Am I doing something wrong?
Would you care to post your code?

_________________
Matt Sealey


Top
   
 Post subject:
PostPosted: Tue Jun 17, 2008 10:56 am 
Offline

Joined: Mon Mar 31, 2008 11:15 am
Posts: 17
Location: Bari, Italy
I can confirm that the SuSE's 10.3 kernel (2.6.22) runs the program with a very low overhead, almost unnoticed by top. I have tried several combinations (tickless, 100 to 1000 HZ) on my vanilla 2.6.25 kernel.

With some combinations I have very high user loads, up to 40%, sometimes top indicates that the task is using about 33% of the CPU but the overall values are very low!

I noticed that many settings of the config.gz embedded into SuSE's kernel do not exist in the vanilla kernel.

If needed, I can post or send my .config file

That's the code I have used, but as you can see it's just a meat-and-potatoes test...
Code:
import serial, struct, time, signal

def read_from_ins():
a = ser.read(33)
if len(a) < 1:
return
print "read ",len(a)," bytes"
pattern = "B"*len(a)
outy = struct.unpack(pattern,a)
print "*** ",
for i in range(0, len(a)):
print hex(outy),
print " ***"
print "length:",len(a)

def int_handler(signum, frame):
print "exiting..."
ser.write(stop_baby)
ser.close()
exit

start_baby="\xbc\x05\x53\x54\x41\x52\x54\x45"
stop_baby="\xbc\x05\x52\x45\x53\x45\x54\x50"
reset_baby="\xbc\x04\x53\x54\x4f\x50\x1c"
hw_reset_baby="\xbc\x04\x48\x52\x53\x54\x19"

signal.signal(signal.SIGINT, int_handler)
ser = serial.Serial('/dev/ttyPSC0',115200)
print "port opened"
ser.write(hw_reset_baby)
print "uC reset"
time.sleep(1)
ser.write(start_baby)
while 1:
read_from_ins()



Top
   
 Post subject:
PostPosted: Thu Jun 19, 2008 5:13 am 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Quote:
I can confirm that the SuSE's 10.3 kernel (2.6.22) runs the program with a very low overhead, almost unnoticed by top. I have tried several combinations (tickless, 100 to 1000 HZ) on my vanilla 2.6.25 kernel.
Hmm, Python :(

Perhaps the CFS scheduler could be causing problems with reporting of CPU time used; It might just be a reporting flaw, maybe it's counting time that it didn't before..?

_________________
Matt Sealey


Top
   
 Post subject:
PostPosted: Thu Jul 10, 2008 4:28 am 
Offline

Joined: Mon Mar 31, 2008 11:15 am
Posts: 17
Location: Bari, Italy
Quote:
Perhaps the CFS scheduler could be causing problems with reporting of CPU time used; It might just be a reporting flaw, maybe it's counting time that it didn't before..?
Recompiling a pre-CFS kernel with HZ=1000 gives a lot of overhead too, so it seems not to be related to the scheduler itself.

Python almost goes nuts with threads on 2.6.25. :(

I have rewritten Efika's app in C and now it runs with sub-zero CPU usage.

Had to take off the shelf my old dusty Kernighan&Ritchie relic... ;)


Top
   
 Post subject:
PostPosted: Fri Jul 11, 2008 2:33 am 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Quote:
Python almost goes nuts with threads on 2.6.25. :(
It's good to know it's just Python.. so much for rapid application development :)

I wonder what causes Python to do this though.. it sounds like a bug if it worked one day and exploded the next.
Quote:
Had to take off the shelf my old dusty Kernighan&Ritchie relic... ;)
I wish I still had that to reference. I lent it out to a friend who wanted to learn C, and when I got all my books back, K&R was not in the pile :(

_________________
Matt Sealey


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
PowerDeveloper.org: Copyright © 2004-2012, Genesi USA, Inc. The Power Architecture and Power.org wordmarks and the Power and Power.org logos and related marks are trademarks and service marks licensed by Power.org.
All other names and trademarks used are property of their respective owners. Privacy Policy
Powered by phpBB® Forum Software © phpBB Group