How to get GPU counter values per process using PVRScopeStats API on CLI

Using the sample code in this page -PVRScopeStats API usage

I am able to obtain GPU counter values.
But it only gives values per process for FPS counter.

Other counters such as -

  • Renderer active
  • Renderer time per frame
  • Renderer time
  • SPM active
  • Tiler active
  • Tiler time per frame
  • Tiler time

that are shown per process in the ‘PVRTune GUI’ are obtained as aggregated values in the CLI from API usage as in above documentation link.
How to get per process values of these counters using PVRScopeStats API.

Hi onlineAV,

Thanks for your message and welcome to the PowerVR Developer Forum!

I reviewed the definition of each one of the counters listed (Tiler time, Tiler time per frame, Tiler active, SPM active, Renderer time, Renderer time per frame and Renderer active). Each of them is process independent, in the sense that they just measure when a part of the GPU is active or is processing tasks, regardless on whether the tasks are from a single process or from multiple processes.

If you can describe the goal you have I could assist you. For profiling purposes for example other counters would be more useful.

Also unrelated, but in case it helps: We have two examples on how to use PVRScope in our SDK:

Best regards,
Alejandro

Thanks for answering Alejandro.
On PVRTune, I get the values of above mentioned counters for the processes currently using GPU resources.
For example 2 processes running on the system, both of them render something on the screen, at the same time, so for both I get to see different values of above counters on PVRTune UI.
But if I try to access values of these counters using PVRScopeStats API on CLI with the sample cpp code in the link - PVRScopeStats API usage, I get their aggregated values, not per process values as shown below -

GPU PowerVR SeriesBXE, BXE-4-32, Device 0/Renderer active: 25.685020%
GPU PowerVR SeriesBXE, BXE-4-32, Device 0/Renderer time per frame: 0.013921
GPU PowerVR SeriesBXE, BXE-4-32, Device 0/Renderer time: 0.111366
GPU PowerVR SeriesBXE, BXE-4-32, Device 0/SPM active: 0.000000%
GPU PowerVR SeriesBXE, BXE-4-32, Device 0/Tiler active: 1.381632%
GPU PowerVR SeriesBXE, BXE-4-32, Device 0/Tiler time per frame: 0.000749
GPU PowerVR SeriesBXE, BXE-4-32, Device 0/Tiler time: 0.005991

But I get FPS counter values per process as below -
Processes/PID 480 (-)/Frames per second (FPS) @PIDDRIVERCONTEXTSTR@: 13.838181
Processes/PID 1203 (-)/Frames per second (FPS) @PIDDRIVERCONTEXTSTR@: 0.000000
Processes/PID 1414 (-)/Frames per second (FPS) @PIDDRIVERCONTEXTSTR@: 4.612727

I also get aggregated FPS counter value in the same iteration of printing all counter values -
GPU PowerVR SeriesBXE, BXE-4-32, Device 0/Frames per second (FPS): 18.450909

(which equals to the sum of per process FPS values) .

Is it possible to get per process values for any other counter using PVRScopeStats API ?

Hi onlineAV,

Thanks for the detailed explanation.

I am trying to understand the first part, where you detail you can get per-process GPU information for the counters mentioned (like Renderer active).

In the example below, I show a screenshot of PVRTune. In the green box there are two GPU tasks being run (the lower one from a game, the upper one is the surface flinger). As you can see, the Renderer active GPU counter is being displayed in red, but only shows information on the % of time the GPU is active. The two GPU tasks being run at the same time are extra visual information not provided by the counter itself, but by the application:

Just in case I am missing something, could you please provide an example where one of the GPU counters mentioned provides per-procces GPU information?

Best regards,
Alejandro

Thanks for answering Alejandro.

In the provided screenshot, only the ‘GPU PowerVR Series6XT, GX6250, Device 0’ section is visible.

There would be other sections as well

Counter Table >
	> GPU PowerVR Series6XT, GX6250, Device 0
	> System
	> Processes

I request you to search for above mentioned counters in the ‘Processes’ section of the ‘Counter Table Window’.
There you should get the counter values (Renderer active, Renderer time per frame, Renderer time, SPM active, Tiler active, Tiler time per frame, Tiler time) for the process that is utilizing GPU as shown below -

    > Processes
		> PID 4204(process_name)  //some process utilizing CPU+GPU resources
			> CPU active kernel                          
			> CPU active user                            
			> CPU active                               
			> Frames per second (FPS) 00                 
			> System memory load                         
			> System memory use                          
			> GPU PowerVR Series6XT, GX6250, Device 0    
				> Render active                          
				> Renderer time per frame                
				> Renderer time                         
				> SPM active                             
				> Tiler active                           
				> Tiler time per frame                   
				> Tiler time                            

So per process counter values (for some specific CPU and GPU counters) are shown in ‘Processes’ section and aggregated values (for the same GPU related counters) in the ‘GPU PowerVR Series6XT, GX6250, Device 0’ section (outside ‘Processes’) and in the ‘System’ section (for the same CPU related counters).

I hope this helps :+1: .

Best regards,
onlineAV :slight_smile:

Hi onlineAV,

Sorry for the delay, and thanks a lot for the clarifications provided.

Unfortunately, the per-process counter information provided by PVRScope is limited to the counters you already mentioned (FPS), I am sorry no more information can be provided.

Best regards,
Alejandro

Hi Alejandro,

Thanks for this information.

Best regards,
OnlineAV

Hi Alejandro

Is there any other way by which we can obtain per process data for GPU counters on CLI as shown in PVRTune UI ?
It may not be through PVRScope.
How does PVRTune (or PVRPerfServer) get these values?

Best regards,
OnlineAV