#include #ifdef ENABLE_PROFILING #include "gperftools/profiler.h" #include "gperftools/heap-profiler.h" #endif std::string get_timestamp() { std::time_t now = std::time(nullptr); std::tm timeInfo; localtime_r(&now, &timeInfo); char buffer[64]; std::strftime(buffer, sizeof(buffer), "./profile/feature_pipe_%Y%m%d", &timeInfo); return std::string(buffer); } int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); #ifdef ENABLE_PROFILING std::string prof_name = get_timestamp() + ".prof"; std::string heap_name = get_timestamp() + ".heap"; ProfilerStart(prof_name.c_str()); HeapProfilerStart(heap_name.c_str()); #endif auto ret = RUN_ALL_TESTS(); #ifdef ENABLE_PROFILING ProfilerStop(); HeapProfilerStop(); #endif return ret; }