Hello, I am trying to perform some automated CPU performance analysis using my own scripts. I find that Nsight Systems has a very handy feature that plots a CPU utilization graph over time, and I’d like to export it into text or some other script-readable format.
However, I failed to find the data directly in the exported Sqlite format report. I suspect, though, that the table named COMPOSITE_EVENTS have something to do with CPU utilization. It seem to show a “start” time and a “cpuCycles” for every sampling point. But I still cannot make any sense out of it.
So, is there a way to export or compute that CPU utilization graph from a Nsys report? I am using Nsight Systems 2020.5.3 that comes with my Xavier Jetpack.
I don’t think it is possible to directly export the data in most of the GUI displays.
The SQLite exports contain almost all of the raw capture and event data found in the QDREP file. The data used by all of the GUI displays, reports, and graphs is calculated from this raw data. That “display data” is not recorded in either file format, but you should be able to recreate any of the displays from the export data. The calculations and data manipulations required to do so are not always obvious or easy, however.
The documentation that explains the SQLite export format can be found in the Documentation directory of your nsys install directory. For more examples, also see the nsys stats report scripts, which can be found in the reports directory of your install directory.
I’m not familiar with the specific data display you’re talking about, but it should be possible to recreate from the SQLite data. Also be aware that data exports and reporting features are areas that have had a lot of attention over the last year or so, and it might be worth updating to make sure you have the latest features and docs.
thanksfully from nv-u I could find the sqlite document.
based on the information, COMPOSITE_EVENTS table contains
Table name COMPOSITE_EVENTS
Column Name Column Type Column Description
start INT NOT NULL Event start timestamp in nanoseconds.
cpu INT NOT NULL ID of CPU this thread was running on.
threadState INT NOT NULL Thread state at the moment of sampling.
globalTid INT NOT NULL Serialized GlobalId.
cpuCycles INT NOT NULL The value of Performance Monitoring Unit (PMU) counter.
and there are several sql examples also,
-- Thread summary calculated using CPU cycles (when available)
globalTid / 0x1000000 % 0x1000000 AS PID,
globalTid % 0x1000000 AS TID,
ROUND(100.0 * SUM(cpuCycles) /
SELECT SUM(cpuCycles) FROM COMPOSITE_EVENTS
GROUP BY globalTid / 0x1000000000000 % 0x100
) as CPU_utilization,
(SELECT value FROM StringIds WHERE id =
SELECT nameId FROM ThreadNames
WHERE ThreadNames.globalTid = COMPOSITE_EVENTS.globalTid
) as thread_name
GROUP BY globalTid
ORDER BY CPU_utilization DESC