chipwhisperer icon indicating copy to clipboard operation
chipwhisperer copied to clipboard

Fix capture for big segments.

Open jmichelp opened this issue 4 years ago • 3 comments

Current logic was keeping all traces in memory instead of freeing each segment when possible.

jmichelp avatar Feb 15 '21 15:02 jmichelp

Oops, don't merge yet. It seems the fix is not complete yet

jmichelp avatar Feb 15 '21 15:02 jmichelp

I don't know if this is the expected behaviour for Chipwhisperer.

When I run a long capture, if I follow the given examples, I get the following simplified code:

project = cw.create_project(...)
for _ in range(...):
  trace = cw.capture_trace(...)
  if trace:
    project.traces.append(trace)
project.save()

There are 2 issues:

  1. I can't control the length of each segment because there's no official API to set it
  2. all traces and all segments stay in memory until project.save() is called to trigger Project.saveTraceManager() is called.

The first commit was trying to solve this situation by only keeping the current segment in memory but segments are created by calling Segments.new() which copies an empty TraceContainer without initialising the configuration object. This is fixed by calling Project.get_new_trace_segment() instead.

jmichelp avatar Feb 15 '21 16:02 jmichelp

On projects - it was always a bit messy for larger captures. We've been looking at changing around some of that, as even ourselves we just use larger NumPy arrays when it gets to longer captures for examples (and saving/segmenting them in the capture loop).

It might be easier to rebuild from something more modern (we had looked into Zarr here) rather than fixing the current code...

colinoflynn avatar Mar 05 '21 21:03 colinoflynn