From caeb58ae1a9b2dae888717fbf12a77dfdcb44acd Mon Sep 17 00:00:00 2001 From: Nate Rogers Date: Thu, 23 Feb 2017 15:39:26 -0500 Subject: [PATCH] Add system information to the summary tab to show info about the machine where the perf record was performed. Also add a scroll bar to the summary tab to support different screen sizes and to make it have a similar look and feel as the other tabs. Fixes: #24 --- src/mainwindow.cpp | 13 + src/mainwindow.ui | 730 +++++++++++++++++++++++--------- src/models/summarydata.h | 11 + src/parsers/perf/perfparser.cpp | 16 +- 4 files changed, 570 insertions(+), 200 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 70c4ffbb..c69fb274 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include "aboutdialog.h" #include "flamegraph.h" @@ -222,6 +223,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(m_parser, &PerfParser::summaryDataAvailable, this, [this, bottomUpCostModel, topDownCostModel, callerCalleeCostModel, calleesModel, callersModel] (const SummaryData& data) { + KFormat format; ui->appRunTimeValue->setText(formatTimeString(data.applicationRunningTime)); ui->threadCountValue->setText(QString::number(data.threadCount)); ui->processCountValue->setText(QString::number(data.processCount)); @@ -243,6 +245,17 @@ MainWindow::MainWindow(QWidget *parent) : } else { ui->lostMessage->setVisible(false); } + ui->hostNameValue->setText(data.hostName); + ui->linuxKernelVersionValue->setText(data.linuxKernelVersion); + ui->perfVersionValue->setText(data.perfVersion); + ui->cpuDescriptionValue->setText(data.cpuDescription); + ui->cpuIdValue->setText(data.cpuId); + ui->cpuArchitectureValue->setText(data.cpuArchitecture); + ui->cpusOnlineValue->setText(QString::number(data.cpusOnline)); + ui->cpusAvailableValue->setText(QString::number(data.cpusAvailable)); + ui->cpuSiblingCoresValue->setText(data.cpuSiblingCores); + ui->cpuSiblingThreadsValue->setText(data.cpuSiblingThreads); + ui->totalMemoryValue->setText(format.formatByteSize(data.totalMemoryInKiB * 1024, 1, KFormat::MetricBinaryDialect)); }); for (int i = 0, c = ui->resultsTabWidget->count(); i < c; ++i) { diff --git a/src/mainwindow.ui b/src/mainwindow.ui index fbbb9669..b28ecbfc 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 745 - 515 + 1123 + 769 @@ -259,200 +259,534 @@ 0 - - - Too much data was generated during the profile and some events got lost. Try to reduce the event load or increase the memory caches. - - - Lost messages - - - - - - - Summary - - - - - - The command that was used to generate this profile. - - - Command: - - - - - - - The time duration for which the application was profiled. - - - Application Run Time: - - - - - - - The time duration for which the application was profiled. - - - - - - true - - - - - - - The number of processes that have been encountered in the profile data. - - - Process Count: - - - - - - - The number of processes that have been encountered in the profile data. - - - - - - true - - - - - - - The number of threads found in the profile. - - - Thread Count: - - - - - - - The number of threads found in the profile. - - - - - - true - - - - - - - The command that was used to generate this profile. - - - - - - true - - - - - - - The number of samples in the profile. - - - Sample Count: - - - - - - - The number of samples in the profile. - - - - - - true - - - - - - - The number of lost chunks. If this value is larger than zero, you should increase the buffer sizes or reduce the event frequency. - - - Lost Chunks: - - - - - - - The number of lost chunks. If this value is larger than zero, you should increase the buffer sizes or reduce the event frequency. - - - - - - true - - - - - - - - - - The hotspots found in the profile, i.e. the code that contributed the most samples. - - - Top Hotspots + + + true - - - - - true - - - false - - - true - - - - + + + + 0 + -90 + 1102 + 772 + + + + + + + Too much data was generated during the profile and some events got lost. Try to reduce the event load or increase the memory caches. + + + Lost messages + + + + + + + Summary + + + + + + Command: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The command that was used to generate this profile. + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The time duration for which the application was profiled. + + + Application Run Time: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The time duration for which the application was profiled. + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of samples in the profile. + + + Sample Count: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of samples in the profile. + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of lost chunks. If this value is larger than zero, you should increase the buffer sizes or reduce the event frequency. + + + Lost Chunks: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of lost chunks. If this value is larger than zero, you should increase the buffer sizes or reduce the event frequency. + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of processes that have been encountered in the profile data. + + + Process Count: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of processes that have been encountered in the profile data. + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of threads found in the profile. + + + Thread Count: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of threads found in the profile. + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + + The hotspots found in the profile, i.e. the code that contributed the most samples. + + + Top Hotspots + + + + + + true + + + false + + + true + + + + + + + + + + System Information + + + + + + The host machine's computer name. + + + Host Name: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's computer name. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's Linux kernel version. + + + Linux Kernel Version: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's Linux kernel version. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's Perf version. + + + Perf Version: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's Perf version. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's CPU description. + + + CPU Description: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's CPU description. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's CPU IDentification. + + + CPU ID: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's CPU IDentification. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's CPU Architecture. + + + CPU Architecture: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The host machine's CPU Architecture. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of CPUs that were online while recording the perf data. + + + CPUs Online: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of CPUs that were online while recording the perf data. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of CPUs that were available while recording the perf data. + + + CPUs Available: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of CPUs that were available while recording the perf data. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of CPU sibling cores on the host machine. + + + CPU Sibling Cores: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of CPU sibling cores on the host machine. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of CPU sibling threads on the host machine. + + + CPU Sibling Threads: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The number of CPU sibling threads on the host machine. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The total amount of RAM on the host machine. + + + Total Memory: + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + The total amount of RAM on the host machine. + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -476,7 +810,7 @@ 0 - + Filter the call graph tree. @@ -518,7 +852,7 @@ 0 - + Filter the call graph tree. @@ -585,7 +919,7 @@ 0 - + @@ -659,8 +993,8 @@ 0 0 - 745 - 27 + 1123 + 25 diff --git a/src/models/summarydata.h b/src/models/summarydata.h index 2247231f..51205efa 100644 --- a/src/models/summarydata.h +++ b/src/models/summarydata.h @@ -37,6 +37,17 @@ struct SummaryData quint64 sampleCount = 0; QString command; quint64 lostChunks = 0; + QString hostName; + QString linuxKernelVersion; + QString perfVersion; + QString cpuDescription; + QString cpuId; + QString cpuArchitecture; + quint32 cpusOnline; + quint32 cpusAvailable; + QString cpuSiblingCores; + QString cpuSiblingThreads; + quint64 totalMemoryInKiB; }; Q_DECLARE_METATYPE(SummaryData) diff --git a/src/parsers/perf/perfparser.cpp b/src/parsers/perf/perfparser.cpp index 8803307d..f01671bf 100644 --- a/src/parsers/perf/perfparser.cpp +++ b/src/parsers/perf/perfparser.cpp @@ -811,8 +811,20 @@ struct PerfParserPrivate auto args = features.cmdline; args.removeFirst(); summaryResult.command = QLatin1String("perf ") + QString::fromUtf8(args.join(' ')); - - // TODO: add system info to summary page + summaryResult.hostName = QString::fromUtf8(features.hostName); + summaryResult.linuxKernelVersion = QString::fromUtf8(features.osRelease); + summaryResult.perfVersion = QString::fromUtf8(features.version); + summaryResult.cpuDescription = QString::fromUtf8(features.cpuDesc); + summaryResult.cpuId = QString::fromUtf8(features.cpuId); + summaryResult.cpuArchitecture = QString::fromUtf8(features.arch); + summaryResult.cpusOnline = features.nrCpusOnline; + summaryResult.cpusAvailable = features.nrCpusAvailable; + auto formatCpuList = [](const QByteArrayList& list) -> QString { + return QString::fromUtf8('[' + list.join("], [") + ']'); + }; + summaryResult.cpuSiblingCores = formatCpuList(features.siblingCores); + summaryResult.cpuSiblingThreads = formatCpuList(features.siblingThreads); + summaryResult.totalMemoryInKiB = features.totalMem; } enum State {