-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintaining high capture rates for long captures #344
Comments
I see you've got a merged in changes already - so we were running slower this past week here. As a side-note - the "project format" in ChipWhisperer is one of those very "funky" things, I don't know if it's truly worth fixing as-is or just needs a total overhaul. Internally we ended up often just writing traces to arrays using Zarr or other tools, rather than trying to reinvent the storage part. Depending on how analysis is done this might make more sense - the ChipWhisperer system originally started more heavily tuned towards training & education. For higher performance CPA and similar attacks we are normally using external libraries (LASCAR or SCARED right now), which don't directly work with CW format. Depending what your end goal is we can look at what makes most sense there (fixing CW vs. doing another format).
I think this is planned change for husky already - we could do this (or as an option) w/ CW-Lite. The backstory there is mostly "from the beginning" we translate to floating point because that is what people were used to seeing (that is the serious answer). Academia doesn't like change & I found people liked seeing their plots with "smallish" numbers for power, so I scaled everything. It also seemed to be easier to translate into MATLAB (which is what a lot of people were using before that already had the algorithms), the unsigned int raw values sometimes seemed to explode certain algorithms. So basically this is like the classic "width of horses ass defined the road width" situation, there was no reason to keep it going. |
On the latest develop, you can now pass |
sorry @colinoflynn, I completely forgot about this issue. I fully understand your points. And as always it's very hard to fit all the needs. Anyway, the existing project format and all the infrastructure around it was completely fine for us to get started. I guess we are now at the edge where we need to think a little and define what the best way forward/trace format is for us. Thanks @alex-dewar for pointing out the addition of this new argument. I've tried it out but ran into some other issues. I will open a new issue for this. |
Both the OpenADC scope and the Trace class can already output and store integers instead of doubles for the waves, respectively. But the corresponding arguments were not exposed to the API previously. This commit exposes these arguments to the API to allow users capture e.g. waves as uint16 instead of doubles. This allows to reduce the memory and storage requirements of long captures by roughly 4x. This is related to newaetech#344.
After a long time, I've finally been able to successfully test |
Hi,
using the CW-Lite and CW-Husky capture boards in batch mode we get pretty good capture rates of a several hundreds of AES power traces per second. However, when capturing millions of traces I noted that the capture rate starts to drop significantly over time.
I had a close look on the ChipWhisperer API and identified a couple of things that seem to be non-ideal. For some of them, I could successfully create workarounds using the provided functionality of the API. For others, I did not yet find a solution. Anyway, I would be curious to get your opinion. I can imagine you already faced some of these problems and that maybe there are better ways to prevent them than what I did.
traces.cur_seg.tracehint
) and then get increased by 25 traces on demand. This results in frequent array resizing. I don't know how bad this really is for performance. But it would probably be possible to start new trace segments with the configured number of traces per segment, i.e.traces.seg_len
, instead and avoid the resizing completely. In our capture setup I was able to avoid this problem by checkingtracehint
and setting it toseg_len
directly usingsetTraceHint()
. This improves performance.For more details see
addWave()
inchipwhisperer/common/traces/_base.py.
_updateRanges()
function insidechipwhisperer/common/api/TraceManager.py
is called which loops over all previously captured traces. As a result the complexity of theappend()
function increases linearly with the number of captured traces. This is a major performance bottleneck for long captures. What I did to avoid it is to only keep the latest two trace segments enabled usingsetTraceSegmentStatus()
._updateRanges()
then only compares the ranges of all traces in the newest two segments. Using this trick, I can maintain the same capture rate for nearly 10 Mio traces.OpenADC.py
. Is there a way to change the data format used for storage inside the ChipWhisperer API?The text was updated successfully, but these errors were encountered: