Custom Analyzer and what's happening behind the scene?

Hello everyone,

started to work on my own analyzer and have not yet found an answer to my question. Until now it looks like that the action of each analyzer is happening in this “WorkerThread” function. Inside there is an infinite “for” loop and my question is:

How does the main program knows when it can stop this “WorkerThread”?
Or how does it know that I’m done with my analysis?

Thank you very much for your time.
Best regards

1 Like

One of the Analyzer SDK APIs is the ReportProgress() function that will update the UI with how far along you’ve processed the incoming AnalyzerChannelData from the core Logic software.

Note: If you fail to keep up-to-date with progress reports, then I believe your analyzer will be halted by the core – thinking that you’ve somehow stalled in processing the new data (i.e., if too many new samples are collected by the Logic software capture process, but your custom analyzer never indicated that those new samples were actually processed).

So, at the highest level – I think the UI will create a new instance of your Analyzer (i.e., CreateAnalyzer) and then spawn a thread to call your WorkerThread() to process the data as it comes in ‘live’ after clicking Start (or on loading a previous capture file with your analyzer saved, and/or when adding your analyzer into a previous capture already in memory). Depending on what API(s) you call, it may ‘block’ waiting for new input/edges. For example, AdvanceToNextEdge() will block until another edge is actually available from the incoming capture data stream.

Thus, I don’t think the WorkerThread() is ever really ‘done’ – as it just continues to process any incoming AnalyzerChannelData. However, it is still expected to be ‘up-to-date’ with calling ReportProgress() API to show it has processed the most recent (largest) sample provided from the Traversing the Data APIs in the SDK. I think it is considered ‘up-to-date’ (i.e., progress is at 100%) as long as the sample_number indicated in ReportProgress() is (close enough to) the latest one provided by the capture data traversal APIs.

However, to answer the original question directly – I think the program knows when to halt the WorkerThread() and call DestroyAnalyzer() – based on a user removing the analyzer from the capture, closing the capture tab, and/or closing the application :wink:


@BitBob @t.kammerer having written an analyzer, I believe and recall that what BitBob has provided is correct. I can double check, but am sure there is no need.

Thank you very much for the really detailed answer and thoughts :slight_smile:

The question actually only came up because I used the “ReportProgress” function in the “WorkerThread” of my analyzer but it never led to the desired result. It always ran to the end, but should have stopped at half of the samples.

As you have already said, and you are right - it probably saves a reference point internally and when the user “retrieves” this data, it updates its reference point and its progress. The thread is then paused and restarted when new data is available.

After this realization, the whole thing makes more sense to me and now I understand it better how it works.

1 Like