Query the gputime spent in an application Determine the time the GPU was active


I was wondering if there is a way to query the gputime of an process. To be more precise, lets say I have a GPU with N SMs numbered SM_1 to SM_N. Then I would like to query the total gputime which I would define as follows:

total_gputime = ( \sum_{i=1}^N number_of_active_cycles(SM_i) ) / clocks_per_second.

Is there a reliable way to compute/query this quantity without introducing timer events and synchronization points?
Does somebody know how the command line profiler or nvpp gets the gputime they are reporting? Also, does somebody know
what their exact definition of gputime is?