diff mbox series

[v3,3/3] kernel-shark: Set a maximum number of plots to be shown by default

Message ID 20200508152302.27843-4-y.karadz@gmail.com (mailing list archive)
State Accepted
Commit f247f1ad56d751bb10ad11a8070c1f3ed3d7a16e
Delegated to: Steven Rostedt
Headers show
Series [v3,1/3] kernel-shark: Add methods for selecting the plots to be shown | expand

Commit Message

Yordan Karadzhov May 8, 2020, 3:23 p.m. UTC
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@gmail.com>
Suggested-by: Julia Lawall  <julia.lawall@inria.fr>
---
 kernel-shark/src/KsGLWidget.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

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);