Limit size of cell's thread pool, and only reset it when need its size to change
Currently, the number of threads in the SWATCH cell's thread pool (i.e. instance of swatch::action::ThreadPool
) is equal to the number of actionable objects in the system. However, for some systems, this is very large - e.g. 60 for twinmux, far larger than the number of CPU cores / hyperthreading units.
However, in principle increasing the size of the thread pool beyond the number of CPU cores / hyperthreading units should not reduce the execution time of SWATCH commands.
It's been observed that increasing the thread pool's size far beyond the number of CPU cores / hyperthreading units can significantly exacerbate the malloc-caused memory growth of cells (confirmed so far for the example SWATCH cell, on a development VM - see issue #25).
Therefore, I'll update the cell's implementation to ...
- Limit the size of the thread pool to the number of CPU cores / hyperthreading units - as returned by
boost::thread::hardware_concurrency()
- Only reset the thread pool if its size needs to change