Simple C++ source instrumentation? -


i want use shiny on large-ish c++ code base, i'd rather not add required profile_func() calls source. figure it's easy enough write script each source file, regex-searches function definitions, adds macro call after opening bracket , pipes result g++; seems awfully obvious source-code instrumentation case, so find hard believe no-one has come better solution already.

unfortunately, searching around find references llvm / clang instrumentation , odd research tool, overly complicated solutions comparatively simple problem. in fact, there seems no straightforward way perform simple automated code edits c/c++ code prior compilation.

is so? or missing something?

update: forgot mention "c++ code base" native application porting android. can use neither gprof (which isn't available on android), valgrind (which requires older version of ndk i'm using) nor android-ndk-profiler (which dynamic libraries loaded android activities, either java or native, not plain executables). hence looking shiny.

update 2: despite previous claims managed build valgrind on android ndk r8e, settled on using instead of shiny. still think original question valid: isn't there straightforward tool effecting simple compile-time edits c / c++ source files – sort of macro preprocessor on steroids?

you can consider gprof or valgrind. if memory serves, gprof uses instrumentation , valgrind sampling-based profiler. neither of them requires annotate source code.


Comments