gperftools

Has anyone successfully used gperftools to profile a Rack module?

Running on Ubuntu 20.04 LTS, I’ve installed gperftools via sudo apt-get install google-perftools libgoogle-perftools-dev and added -lprofiler to LDFLAGS in my plugin’s makefile. Should this instead/also be added to Rack’s makefile?

When including <gperftools/profiler.h> in my module and using ProfilerStart() and ProfilerStop() within the module’s code, Rack complains at launch that the plugin could not be loaded due to undefined symbol: ProfilerStart.

Hi @xandermogue I’m a Windows slave but makefile-curious person, so I’m just tossing a coin, have you tried this (found with some googling) about LDFLAGS?
-Wl,--no-as-needed -lprofiler -Wl,--as-needed

1 Like

That worked. Thank you!

1 Like