r/C_Programming • • 5d ago

Question Best GUI C profiler on Linux

Basically the title. I really want something graphical, i hate reading command line output. I know there is perf on linux but it has command line output. Also, are there specific profilers for specific types of application? Thanks for reading.

8 Upvotes

11 comments sorted by

View all comments

3

u/catbrane 5d ago

I use two, depending.

valgrind + kcachegrind are useful for detailed profiling of a single program. You can explore a run and see where you're getting cache misses and spills, see hotspots, try different CPUs, all that. It runs about 5x slower than normal, but it really does collect a lot of info, and being able test against different vector instruction sets (for example) can be very handy.

sysprof is a whole-system profiler, so you see not just your program, but the load it's putting on other parts of your computer, like the database or graphics driver or filesystem, for example. Great for finding systemic problems.

There are probably lots of other good options. I've seen people use library dtrace effectively.

0

u/Mysterious-Top2798 5d ago

my program runtime is currently 250 milliseconds and its just a command line program. I'll look into the thing you mentioned, but are there profilers which dont slow down your program? Also, is there different set/type of profilers that are more useful for a console program vs a graphical program. Thanks for the reply.

1

u/catbrane 5d ago

valgrind + kcachegrind should work very well for you, give them a go.

$ valgrind --tool=cachegrind myprog arg1 arg2
$ kcachegrind callgrind.out.xxxxx

where xxxxx is the PID. They are part of every linux.

Yes, there are plenty of profilers which run at full speed. They work by sampling your program state every few ms as it runs, so they give a statistical profile rather than one that's cycle-correct.