Skip to content

Commit

Permalink
Update m_t1_real start
Browse files Browse the repository at this point in the history
  • Loading branch information
jfinken committed Oct 18, 2023
1 parent 1058363 commit 9ef7240
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions performance_metrics/src/resource_usage_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,20 @@ 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
m_logger_thread = std::thread(
[ = ]() {
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);
Expand Down

0 comments on commit 9ef7240

Please sign in to comment.