Open-source OpenGL profiler for Linux [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
开发者_如何转开发 Improve this questionThe title sums my question up pretty well: are there any open source OpenGL profilers for Linux?
The only thing I could find was gDEBugger, but it only comes with a 7 day trial and is very much closed source. I would use this for free (as in freedom) software development so paying is not an option, though I might consider accept answers for a free (as in beer) but closed application. Bonus points if it works with open source drivers (my main computer has an integrated Intel graphics card).
Thanks to @cypheon's answer, I checked out BuGLe. It is fantastic, but I had to spend a bit of time getting useful profiling output. I wanted to add this as a comment on that answer, but I really need to paste full code examples so I started a new answer.
As he suggested, the stats_calltimes filter is good for profiling -- not ideal (since it doesn't show call stack information), but with a bit of work, it can show you the total flat time for each GL function per frame.
You need to edit both the ~/.bugle/filters
and ~/.bugle/statistics
files. Firstly, add this chain to the end of filters
:
chain showcalltimes
{
filterset stats_calls
filterset stats_calltimes
filterset showstats
{
show "average time per call"
}
}
Now run your program with the command:
BUGLE_CHAIN=showcalltimes LD_PRELOAD=libbugle.so <your-program>
This will print the average time spent in each GL function per frame. That isn't terribly useful by itself, because for a call like glVertex
, called thousands of times per frame, it will probably show up as 0.00ms even though the cumulative time is quite significant. So add a new entry to statistics
:
"total time per call" = d("calls:*") / d("calls:*") * d("calltimes:*") / d("frames") * 1000
{
precision 3
label "* (ms)"
}
I used the same trick as the "calls per frame" statistic: multiply and divide by d("calls:*")
to cause a divide-by-zero error for any function that was never called, to avoid showing 0.00 for all of the irrelevant functions.
Now, go back to the showcalltimes
chain we added to filters
, and change "average time per call"
to "total time per call"
:
chain showcalltimes
{
filterset stats_calls
filterset stats_calltimes
filterset showstats
{
show "total time per call"
#key_accumulate "A"
#key_noaccumulate "I"
}
}
And now we will see the useful stat of the total time spent in each function, per frame. If you want to average these stats out over many frames, uncomment the key_accumulate
lines above, and then you can hit "A" (or remap it to a key of your choice) to start accumulating. Over time, you will see the statistics stop bouncing around so much as they average out over many frames.
You can also log these statistics to an output file with this chain:
chain logcalltimes
{
filterset stats_calls
filterset stats_calltimes
filterset log
{
filename "bugle.log"
}
filterset logstats
{
show "total time per call"
}
}
This is pretty hard to read, since it simply puts the individual stats for each frame one after the other, and I haven't found a way to average them over time. So my preferred method for reading statistics is the showcalltimes
chain with the accumulator turned on.
Have a look at BuGLe. Its main target is not profiling, but it has a filter, which shows the time spent in each OpenGL call.
I would really recommend this small profiler:http://silverspaceship.com/src/iprof/, it is not bound to profiling opengl, but does so very well! Also it can use opengl to display the profiling stats, which means it is very portable.
I would use this for free software development so paying is not an option
"Free" doesn't mean "opensource".
See if NVPerfKit, NVPerfSDK are suitable for you. i've used NVPerfHud for profiling DirectX applications before, and if NVPerfKit offers even a tiny bit of PerfHud's functionality for OpenGL, it will be exactly what you're looking for.
Also, check NVIdia's OpenGL resources page.
I also like vogl a lot - check it out at https://github.com/ValveSoftware/vogl
It has profiling, capturing, replay - but the killer features are the frame captures, you can inspect all buffers, shader vars and so on just by replaying your captured state.
精彩评论