[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Slow performance in writing to a driver
- From: Ico <lua@...>
- Date: Thu, 14 May 2009 11:01:01 +0200
* On 2009-05-14 Daniel Ng <daniel_ng11@lycos.com> wrote :
> I'm running lua 5.1.3 on a Linux 2.6 uClibc system.
>
> My Lua script writes to an SPI driver 256 bytes at a time.
> Unfortunately the time it takes to get the 256 bytes to the driver is
> almost 2 seconds!
>
> I need this to write about 2MB of data in total, so this rate is
> unfortunately not acceptable.
>
> Please have a look below at a description of the script. Am I doing
> too much memory copying? Or could it be something else?
You should be able to solve this with some simple instrumentation. Just
add some lines to well-chosen points in the code where your print the
current time (probably using gettimeofday() or someething similar to get
sub-second resolution), and find out what your program is doing when.
Could it be that your SPI driver is simply blocking until all data is
transferred over the wire ? I assume the interface to the driver (which
you lacked to mention in the description) is done with a write() to a
character device ? If the SPI clock is slow, it is likely that the
write() system call only returns after 2 seconds when the driver is done
sending out all data.
--
:wq
^X^Cy^K^X^C^C^C^C