Guide
compile
git clone https://github.com/yse/easy_profiler.git
cd easy_profiler && mkdir build && cd build && cmake-gui ..
make -j8
sudo make install
usage
CMakeLists.txt
find_package(easy_profiler REQUIRED)
#easy_profiler_Dir /usr/local/lib/cmake/easy_profiler
target_link_libraries(my_application easy_profiler)
code
#include <easy/profiler.h>
void foo() {
EASY_FUNCTION(profiler::colors::Magenta);
EASY_BLOCK("Calculating sum");
int sum = 0;
for (int i = 0; i < 10; ++i) {
EASY_BLOCK("Addition", profiler::colors::Red);
sum += i;
}
EASY_END_BLOCK;
EASY_BLOCK("Calculating multiplication", profiler::colors::Blue500);
int mul = 1;
for (int i = 1; i < 11; ++i)
mul *= i;
}
void bar() {
EASY_FUNCTION(0xfff080aa);
}
void baz() {
EASY_FUNCTION();
}
Reference
History