28#include "timemory/components/rusage/backends.hpp"
30#include "timemory/components/timing/backends.hpp"
55 return "Measures changes in the high-water mark for the amount of memory "
56 "allocated in RAM. May fluctuate if swap is enabled";
62 return val /
static_cast<double>(base_type::get_unit());
69 value = (
record() - value);
74 void sample() { accum = value = std::max<int64_t>(value,
record()); }
79 accum = value = std::max<int64_t>(value,
record(_cache));
92 auto delta = tmp - value;
115 return "Amount of memory allocated in pages of memory. Unlike peak_rss, value "
116 "will fluctuate as memory is freed/allocated";
128 value = (
record() - value);
151 return "Number of times the filesystem had to perform input";
163 value = (
record() - value);
173 auto tmp =
record(_cache);
174 accum += (tmp - value);
196 return "Number of times the filesystem had to perform output";
208 value = (
record() - value);
218 auto tmp =
record(_cache);
219 accum += (tmp - value);
242 return "Number of page faults serviced without any I/O activity via 'reclaiming' "
243 "a page frame from the list of pages awaiting reallocation";
255 value = (
record() - value);
261 return _cache.get_num_minor_page_faults();
268 auto tmp =
record(_cache);
269 accum += (tmp - value);
291 return "Number of page faults serviced that required I/O activity";
303 value = (
record() - value);
309 return _cache.get_num_major_page_faults();
316 auto tmp =
record(_cache);
317 accum += (tmp - value);
341 return "Number of context switches due to a process voluntarily giving up the "
342 "processor before its time slice was completed";
354 value = (
record() - value);
360 return _cache.get_num_voluntary_context_switch();
367 auto tmp =
record(_cache);
368 accum += (tmp - value);
393 return "Number of context switch due to higher priority process becoming runnable"
394 " or because the current process exceeded its time slice";
406 value = (
record() - value);
412 return _cache.get_num_priority_context_switch();
419 auto tmp =
record(_cache);
420 accum += (tmp - value);
449 value = (
record() - value);
469 return "CPU time spent executing in user mode (via rusage)";
483 value = (tmp - value);
490 return _cache.get_user_mode_time();
497 auto tmp =
record(_cache);
500 accum += (tmp - value);
520 return "CPU time spent executing in kernel mode (via rusage)";
534 value = (tmp - value);
541 return _cache.get_kernel_mode_time();
548 auto tmp =
record(_cache);
551 accum += (tmp - value);
573 return "Absolute value of high-water mark of memory allocation in RAM";
589 return value_type{ _cache.get_peak_rss(), 0 };
603 std::stringstream ss;
604 std::stringstream ssv;
605 std::stringstream ssr;
606 auto _prec = base_type::get_precision();
607 auto _width = base_type::get_width();
608 auto _flags = base_type::get_format_flags();
614 ssv << std::setw(_width) << std::setprecision(_prec) << std::get<0>(_val);
615 if(!std::get<0>(_disp).empty())
616 ssv <<
" " << std::get<0>(_disp);
619 ssr << std::setw(_width) << std::setprecision(_prec) << std::get<1>(_val);
620 if(!std::get<1>(_disp).empty())
621 ssr <<
" " << std::get<1>(_disp);
623 ss << ssv.str() <<
", " << ssr.str();
635 static std::pair<double, double>
unit()
637 return std::pair<double, double>{ units::megabyte, units::megabyte };
648 return std::vector<std::string>{
"start peak rss",
" stop peak rss" };
657 return std::vector<std::string>{
"Resident set size at start",
658 "Resident set size at stop" };
664 static auto& _mem = _instance;
678 static auto& _mem = _instance;
::tim::statistics< Tp > max(::tim::statistics< Tp > lhs, const Tp &rhs)
void load(Archive &ar, tim::node::graph< Tp > &d)
std::tuple< std::string, int64_t > get_memory_unit(std::string _unit)
tim::mpl::apply< std::string > string
static int64_t get_unit()
typename trait::cache< peak_rss >::type cache_type
This is the total amount of time spent executing in kernel mode.
double get_display() const
static value_type record(const cache_type &_cache)
void start(const cache_type &_cache)
static std::string description()
static value_type record()
void stop(const cache_type &_cache)
static std::string label()
the number of times the file system had to perform input.
static value_type record(const cache_type &_cache)
static std::string label()
static const std::ios_base::fmtflags format_flags
value_type get_display() const
void stop(const cache_type &_cache)
void start(const cache_type &_cache)
static value_type record()
static const short precision
static std::string description()
the number of times the file system had to perform output.
static value_type record(const cache_type &_cache)
void stop(const cache_type &_cache)
value_type get_display() const
static std::string label()
static std::string description()
void start(const cache_type &_cache)
static const std::ios_base::fmtflags format_flags
static const short precision
static value_type record()
the number of page faults serviced that required I/O activity.
void start(const cache_type &_cache)
void stop(const cache_type &_cache)
value_type get_display() const
static const short precision
static value_type record()
static std::string description()
static const std::ios_base::fmtflags format_flags
static std::string label()
static value_type record(const cache_type &_cache)
the number of page faults serviced without any I/O activity; here I/O activity is avoided by reclaimi...
static const short precision
static const std::ios_base::fmtflags format_flags
value_type get_display() const
void stop(const cache_type &_cache)
static value_type record(const cache_type &_cache)
static std::string label()
static value_type record()
static std::string description()
void start(const cache_type &_cache)
the number of times a context switch resulted due to a higher priority process becoming runnable or b...
value_type get_display() const
static value_type record(const cache_type &_cache)
void start(const cache_type &_cache)
static const short precision
static const std::ios_base::fmtflags format_flags
static std::string label()
static value_type record()
void stop(const cache_type &_cache)
static std::string description()
This is the total amount of time spent executing in user mode.
static value_type record(const cache_type &_cache)
void start(const cache_type &_cache)
void stop(const cache_type &_cache)
static value_type record()
static std::string label()
double get_display() const
static std::string description()
this struct extracts the virtual memory usage
double get_display() const
static std::string label()
static value_type record()
static std::string description()
the number of times a context switch resulted due to a process voluntarily giving up the processor be...
void start(const cache_type &_cache)
static std::string label()
static value_type record(const cache_type &_cache)
value_type get_display() const
void stop(const cache_type &_cache)
static const short precision
static const std::ios_base::fmtflags format_flags
static value_type record()
static std::string description()