0

I have written a software in Qt for a company, which works with a hardware device and shows realtime plots. I have problems with its speed and I need to know which parts are cpu intensive, but there are lots of threads and events, and when I use valgrind the application gets so slow that serial handlers won't work as expected and timeouts happen and therefore I can't find what's going on. The code base is huge and simplification is almost impossible, because things depend on each other. I'm developing on MacOSX but the application runs on Linux, I wanted to know if there is a faster profiler than valgrind out there. Preferably one that works on MacOSX, as valgrind doesn't work on MacOSX (It says it does, but there are so many problems that makes it just not practical). Thanks in advance.

P.S. If you need any more info, please comment instead of down voting, I can't offer the code as it is proprietary, but I can say it is well written, and I'm a fairly experienced C++ programmer.

arashka
  • 1,226
  • 3
  • 17
  • 30
  • 2
    Valgrind can't help much, since it's mostly single-threaded; also, as you noticed, it's slow as hell, given that it essentially *emulates* the CPU. I doubt you'll find a cross-platform real-time profiler, it's a problem that is inherently tied to the hardware and (partially) to the operating system. On Linux you can use `perf` as a sampling profiler. – Matteo Italia Oct 04 '16 at 06:19
  • I had some good experience with the Intel Amplifier, which handels multi-threading just fine and also does not result in too much of a slow down (a few percentage points, usually). It is, however, rather pricey (starting at $1600) and only runs on Windows and Linux. – Claudius Oct 04 '16 at 08:21
  • Thanks, but I can't pay that price. Anyway I found Apple's instruments that is freely available quite useful. Matteo Italia's comment about linux's pref gave me a hint. pref is a linux feature, so I thought maybe MacOSX has it's own equivalent, and boy it has! Instruments works like a charm, it is quite fast, and has a very good UI. – arashka Oct 04 '16 at 10:07
  • Fast, cheap, portable - if that existed, we wouldn't be talking about valgrind. I cannot prove the absence of such a tool, but I'm absolutely convinced this doesn't exist. – MSalters Oct 04 '16 at 10:15
  • 1
    Valgrind is for catching segfaults and memory profiling (for the memory there are faster things for Linux). For the performance profiling, use `gperf` or simply break in `gdb` (most of the time it'll land in the slow parts). Also, you can add time measurements into the code, if there is something specific to measure (like frames per second or time to process all events in the event queue). – Velkan Oct 04 '16 at 11:44
  • 1
    @Arash: Do you have a debugger (like GDB) that you can use on the target machine? Then you can [*use this method*](http://stackoverflow.com/a/378024/23771). – Mike Dunlavey Oct 04 '16 at 12:33

0 Answers0