#include #include #include #include "profile.hpp" #ifdef TATUM_STA_PROFILE_VTUNE #include "ittnotify.h" #endif #ifdef TATUM_STA_PROFILE_CALLGRIND #include #endif typedef std::chrono::duration dsec; typedef std::chrono::high_resolution_clock Clock; std::map> profile(size_t num_iterations, std::shared_ptr serial_analyzer) { //To selectively profile using callgrind: // valgrind --tool=callgrind --collect-atstart=no --instr-atstart=no --cache-sim=yes --cacheuse=yes ./command std::map> prof_data; #ifdef TATUM_STA_PROFILE_CALLGRIND CALLGRIND_START_INSTRUMENTATION; #endif for(size_t i = 0; i < num_iterations; i++) { //Analyze #ifdef TATUM_STA_PROFILE_VTUNE __itt_resume(); #endif #ifdef TATUM_STA_PROFILE_CALLGRIND CALLGRIND_TOGGLE_COLLECT; #endif serial_analyzer->update_timing(); #ifdef TATUM_STA_PROFILE_CALLGRIND CALLGRIND_TOGGLE_COLLECT; #endif #ifdef TATUM_STA_PROFILE_VTUNE __itt_pause(); #endif for(auto key : {"arrival_pre_traversal_sec", "arrival_traversal_sec", "required_pre_traversal_sec", "required_traversal_sec", "reset_sec", "update_slack_sec", "analysis_sec"}) { prof_data[key].push_back(serial_analyzer->get_profiling_data(key)); } std::cout << "."; std::cout.flush(); } #ifdef TATUM_STA_PROFILE_CALLGRIND CALLGRIND_STOP_INSTRUMENTATION; #endif return prof_data; }