Is there a way to export or compute the CPU utilization graph plotted by Night Systems?

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.

hello can I re-open this issue?

After profiling, I can see several metrics through the Nsight system UI. cpu utilization, and gpu utilization are such information.

Maybe it is contained in qdrep file. But after converting this into sqlite, it seems there is no such information.

So the same question, can I get such information from any of report?
Is there any way to parse the qdrep file? or is there any plan to add these information to the sqlite?

1 Like

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)
SELECT
    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
        ),
        2
    ) as CPU_utilization,
    (SELECT value FROM StringIds WHERE id = 
        (
            SELECT nameId FROM ThreadNames 
            WHERE ThreadNames.globalTid = COMPOSITE_EVENTS.globalTid
        )
    ) as thread_name
FROM COMPOSITE_EVENTS
GROUP BY globalTid
ORDER BY CPU_utilization DESC
LIMIT 10;

results

PID         TID         CPU_utilization  thread_name    
----------  ----------  ---------------  ---------------
19163       19163       98.4             radixSortThrust
19163       19168       1.35             CUPTI worker th
19163       19166       0.25             [NS]         

These are from the documentation. Take a look.

As I mentioned above, I could find several examples.
However for my case, COMPOSITE_EVENTS table doesn’t exist.

How can I get such information?
and also, even though there is no such information how qerep shows cpu utilization? any idea?

@jkreibich