Bug fix in CostMon for > 1 thread
Previously a pointer to the EventContext
was cached when recording monitoring info on an alg.
However, with --threads 2
and higher, the object becomes invalid before the event of the event.
Spotted with the help of a multi-thread example (thanks @damazio)
This MR changes to copying the context, instead.
It also tidies up the recorded data into a simple struct.