How is the CPU utilization computed?

I am using nsight systems 2020.5.3.
After profiling a program, I exported my report into a sqlite file.
I have noticed that the GUI version of nsys can compute the CPU utilization, but I failed to find any corresponding sqlite tables that tells the CPU utilization directly.
I am trying to write some scripts to perform statistical analysis of the CPU utilization, so I need a way to find the CPU utilization without using the GUI. (I am particularly interested in the gaps in the CPU utilization graph, where there is no CPU utilization information. I assumed that the CPU is idle in those gaps, but I would like to make sure if I am correct.)
How exactly does the GUI compute CPU utilization? I would be grateful for any information on this.