diff --git a/performance_metrics/src/resource_usage_logger.cpp b/performance_metrics/src/resource_usage_logger.cpp index 6076671..260dce8 100644 --- a/performance_metrics/src/resource_usage_logger.cpp +++ b/performance_metrics/src/resource_usage_logger.cpp @@ -49,10 +49,8 @@ void ResourceUsageLogger::start(std::chrono::milliseconds period) std::cout << "[ResourceUsageLogger]: Logging to " << m_filename << std::endl; m_t1_real_start = std::chrono::steady_clock::now(); - // Question: make this a flag? That is, calc RU since program start or over - // the last `period` ms. //m_t1_user = std::clock(); - m_t1_real = std::chrono::steady_clock::now(); + //m_t1_real = std::chrono::steady_clock::now(); m_logger_thread_done = false; // create a detached thread that monitors resource usage periodically @@ -60,10 +58,11 @@ void ResourceUsageLogger::start(std::chrono::milliseconds period) [ = ]() { int64_t i = 1; while (m_is_logging) { - // Updating m_t1_user here will have the effect of averaging resource - // utilization only over the last `period` milliseconds, *not* since - // program start. + // Updating m_t1_user and m_t1_real here will have the effect of calculating + // resource utilization only over the last `period` milliseconds, *not* + // since program start. m_t1_user = std::clock(); + m_t1_real = std::chrono::steady_clock::now(); std::this_thread::sleep_until(m_t1_real_start + period * i); if (i == 1) { _print_header(m_file);