Slow scripted acquisition


#1

The simpleserial_aes_trace_capture_xmega.py script is significantly slower (i.e. factor 2) than the Capture Many function from the ChipWhisperer capture GUI.

By inspecting the code I see that both method use the same underlying functions. I can not figure out why the GUI version is 2 times faster than the example script.

What is the reason for this? How can I speed up scripted acquisition?

Thanks,
Rainer


#2

After two days of debugging, I finally spotted the problem:

In _OpenADCInterface.py you find the following code:

            while ((status & STATUS_ARM_MASK) == STATUS_ARM_MASK) | ((status &  STATUS_FIFO_MASK) == 0):
              status = self.getStatus()
              # Wait for a moment before re-running the loop
              time.sleep(0.05)
              diff = datetime.datetime.now() - starttime

The sleep(0.05) code slows down capturing.
Because the GUI version is slower as the command line version, the while loop will never be executed! Therefore the sleep doesn’t matter here.
But on the faster command line version, the while loop will be executed once! Therefore sleep code is executed and waits for 0.05 seconds, which is twice as long as the GUI version needs.

By setting the sleep to a lower value (e.g. 0.01) acquisition on the command line version gets far faster then on the GUI version!


#3

Nice find! I was also trying to figure this out but you got it before me. Suggestion: instead of reducing the sleep time in the while loop, add a time.sleep before the getStatus call outside of the while loop, to prevent entering the while loop at all. On my system that boosts the iterations/second from ~22 to ~24.

Jean-Pierre


#4

I am now a bit puzzled why I have such extreme differences due to the sleep (from 7/sec to 22/sec).
I am using the newae virtual machine on Parallels/iMac pro and version 4.0.2 of the chipwhisperer.

Rainer