
#ifndef PLS_INTERNAL_PROFILING_THREAD_STATS_H_
#define PLS_INTERNAL_PROFILING_THREAD_STATS_H_

#include <chrono>
#include <type_traits>

#include "context_switcher/context_switcher.h"

#include "pls/internal/base/system_details.h"
#include "pls/internal/base/stack_allocator.h"

#include "pls/internal/profiling/dag_node.h"

namespace pls::internal::profiling {

struct PLS_CACHE_ALIGN thread_stats {
  using clock = std::chrono::steady_clock;

  unsigned long total_steals_{0};
  unsigned long successful_steals_{0};
  unsigned long failed_steals_{0};
  unsigned long steal_cas_ops_{0};

  unsigned long total_time_stealing_{0};

  unsigned long total_sleeps_{0};
  unsigned long total_time_sleeping_{0};

  clock::time_point stealing_start_time_;
  clock::time_point sleeping_start_time_;
  clock::time_point task_run_start_time_;
};

}

#endif //PLS_INTERNAL_PROFILING_THREAD_STATS_H_
