-
Notifications
You must be signed in to change notification settings - Fork 50
Parallel Libtrace HOWTO: Reporter Thread
The reporter thread receives all of the results published by the processing threads. The order in which these results are received will depend on which combiner is being used. A parallel libtrace program only has at most one reporting thread, regardless of how many processing threads there are.
Having a reporter thread is optional. If there are no results to publish or there is no need to combine results from multiple threads, then you do not need to implement any callbacks for a reporter thread. However, most libtrace programs will probably need a reporter thread.
In our scenario, our reporter thread will be receiving the final tallies and average packet sizes from each thread so it will need to merge those results together to produce a final average across all threads. The final result can then be written out as the output from our program.
First, we're going to need somewhere to store our tallies while we collate them. Let's write a starting callback to do just that.