rib / gputop

A GPU profiling tool
162 stars 37 forks source link

Graphs for system/context FPS #188

Open eero-t opened 6 years ago

eero-t commented 6 years ago

After there's support for graphing tracepoints (#180), whole system and per-context FPS can be graphed by adding ftrace uprobe tracepoints to suitable functions in user space libraries.

I can provide (Python) code for adding these trace points. It checks from /proc/*/maps which of the currently running processes link relevant (EGL/GLX/Vulkan) libraries, uses readelf to find out buffer swap/present functions offsets in these libraries, and then adds uprobe tracepoints for all of them.

djdeath commented 6 years ago

Please, give a link for this :) :+1:

eero-t commented 6 years ago

Provided python & shell code by email.

Because gputop knows which processes have contexts, it doesn't need to scan whole /proc/, it can dig the paths to relevant libraries from maps files of just those processes.

Easiest way to get symbol offsets for the libraries, is using readelf binary (or objdump) like the scripts, but it should be doable with libreadlef functions too.

In case of Vulkan, Vulkan driver internal present function need to be tracked (many programs don't go through Vulkan loader, but use address gotten by vkGet*ProcAddress), whereas with EGL/GLX it's enough to track egl/glXSwapBuffers calls.

Easiest way for graphing FPS would be for gputop server to provide it as a counter value.

At least in case of FPS, I would like this to something that is available also for gputop-wrapper. That way I can normalize all the other counter values (other than percentages or Mhz) by the FPS, to convert them to average per-frame values. Such "per-frame" counter values would be directly comparable between different driver versions.