I need to implement a statistics reporter - an object that prints to screen bunch of statistic. This info is updated by 20 threads.
The reporter must be a thread itself that wakes up every 1 sec, read the info and prints it to screen.
My design so far: InfoReporterElement - one element of info. has two function, PrintInfo and UpdateData. InfoReporterRow - one row on screen. A row holds vector of ReporterInfoElement. InfoReporterModule - a module composed of a header and vector of rows. InfoRporter - the reporter composed of a vector of modules and a header. The reporter exports the function 'PrintData' that goes over all modules\rows\basic elements and prints the data to screen.
I think that I should an Object responsible to receive updates from the threads and update the basic info elements.
The main problem is how to update the info - should I use one mutex for the object or use mutex per basic element? Also, which object should be a threads - the reporter itself, or the one that received updates from the threads?