Set a maximum number of CPU plots to be shown by default. No more than 16 CPU plots will be shown if no command line options, per-selecting the plots, are provided. This will be useful when opening trace file containing hundreds of CPU cores. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> Suggested-by: Julia Lawall <julia.lawall@xxxxxxxx> --- kernel-shark/src/KsGLWidget.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp index e930006..78ded33 100644 --- a/kernel-shark/src/KsGLWidget.cpp +++ b/kernel-shark/src/KsGLWidget.cpp @@ -340,6 +340,11 @@ void KsGLWidget::keyReleaseEvent(QKeyEvent *event) return; } +/** + * The maximum number of CPU plots to be shown by default when the GUI starts. + */ +#define KS_MAX_START_PLOTS 16 + /** * @brief Load and show trace data. * @@ -358,7 +363,6 @@ void KsGLWidget::loadData(KsDataStore *data) * One bin will correspond to one pixel. */ nBins = width() - _hMargin * 2; - nCPUs = tep_get_cpus(_data->tep()); _model.reset(); @@ -368,8 +372,13 @@ void KsGLWidget::loadData(KsDataStore *data) ksmodel_set_bining(_model.histo(), nBins, tMin, tMax); _model.fill(_data->rows(), _data->size()); - /* Make a default CPU list. All CPUs will be plotted. */ + /* Make a default CPU list. All CPUs (or the first N_max) will be plotted. */ _cpuList = {}; + + nCPUs = tep_get_cpus(_data->tep()); + if (nCPUs > KS_MAX_START_PLOTS) + nCPUs = KS_MAX_START_PLOTS; + for (int i = 0; i < nCPUs; ++i) _cpuList.append(i); -- 2.20.1