Overflow Caused by Slow Data Processing
Learn how slow data processing, not just a high incoming tag rate, can cause overflow and a low measured count rate.
Buffer overflow can be caused not only by a data rate higher than the specified maximum transfer rate, but also by how quickly your software processes the incoming data, especially during computationally intensive measurements.
Each initialized measurement runs on its own thread, but only a few of our API measurements, such as HistogramLogBins, can utilize multiple cores. If a single measurement consumes excessive CPU time, the Time Tagger’s hardware buffer can fill up, leading to an overflow event and data loss.
Example Scenario
Consider a time-resolved imaging experiment with 500 pixels × 500 pixels × 1000 bins per histogram, resulting in approximately 1 GByte of data. Modern high-performance computers (e.g., processors with DDR5 RAM) have a CPU-to-RAM bandwidth of about 38.4 GByte/s.
Under ideal conditions, assuming no other CPU activity and the data being transferred to an independent memory channel, copying 1 GByte of data theoretically takes at least 26 ms.
Because getData() returns the current state of a fixed-size histogram, the amount of data copied stays the same
regardless of how many events arrived since the previous call; it does not grow with a backlog. What matters is
simply how long the pipeline stays locked during that one call. Data blocks normally arrive from the Time Tagger
with a default maximum latency of 20 ms
(configurable via setStreamBlockSize()).
If getData() locks the pipeline for much longer than this, for example with a very large histogram of 1000
pixels × 1000 pixels × 10,000 bins per histogram (≈40 GByte, ≈1 s to copy), incoming tags cannot be
processed for that entire second. If such calls happen frequently, the pipeline does not get enough time to drain
between them, increasing the risk of overflow: incoming tags are discarded once the buffer is full, causing the
corresponding drop in measured count rate. In this case, consider calling getData() less often, or reducing the
amount of data retrieved per call.
To retrieve the data, you would use the getData() method. This method:
- Locks the data pipeline,
- Copies the data to the user, and
- Unlocks the pipeline for further processing.
Key Takeaway
To avoid CPU overload and ensure smooth data processing:
- Minimize the frequency of calls to
getData()for large data sets. - Optimize the number of parallel measurements to match your CPU’s capabilities.
- Use modern high-bandwidth systems (e.g., DDR5 RAM) for large-scale experiments.