29#ifndef __BASE_STATS_UNITS_HH__
30#define __BASE_STATS_UNITS_HH__
43#define UNIT_CYCLE GEM5_DEPRECATED_MACRO( \
44 UNIT_CYCLE, statistics::units::Cycle::get(), \
45 "Use statistics::units::Cycle::get()")
46#define UNIT_TICK GEM5_DEPRECATED_MACRO( \
47 UNIT_TICK, statistics::units::Tick::get(), "Use statistics::units::Tick::get()")
48#define UNIT_SECOND GEM5_DEPRECATED_MACRO( \
49 UNIT_SECOND, statistics::units::Second::get(), \
50 "Use statistics::units::Second::get()")
51#define UNIT_BIT GEM5_DEPRECATED_MACRO( \
52 UNIT_BIT, statistics::units::Bit::get(), "Use statistics::units::Bit::get()")
53#define UNIT_BYTE GEM5_DEPRECATED_MACRO( \
54 UNIT_BYTE, statistics::units::Byte::get(), "Use statistics::units::Byte::get()")
55#define UNIT_JOULE GEM5_DEPRECATED_MACRO( \
56 UNIT_JOULE, statistics::units::Joule::get(), \
57 "Use statistics::units::Joule::get()")
58#define UNIT_VOLT GEM5_DEPRECATED_MACRO( \
59 UNIT_VOLD, statistics::units::Volt::get(), "Use statistics::units::Volt::get()")
60#define UNIT_CELSIUS GEM5_DEPRECATED_MACRO( \
61 UNIT_CELSIUS, statistics::units::DegreeCelsius::get(), \
62 "Use statistics::units::DegreeCelsius::get()")
63#define UNIT_RATE(T1, T2) GEM5_DEPRECATED_MACRO( \
64 UNIT_RATE, (statistics::units::Rate<T1, T2>::get()), \
65 "Use statistics::units::Rate<T1, T2>::get()")
66#define UNIT_RATIO GEM5_DEPRECATED_MACRO( \
67 UNIT_RATIO, statistics::units::Ratio::get(), \
68 "Use statistics::units::Ratio::get()")
69#define UNIT_COUNT GEM5_DEPRECATED_MACRO( \
70 UNIT_COUNT, statistics::units::Count::get(), \
71 "Use statistics::units::Count::get()")
72#define UNIT_WATT GEM5_DEPRECATED_MACRO( \
73 UNIT_WATT, statistics::units::Watt::get(), "Use statistics::units::Watt::get()")
74#define UNIT_UNSPECIFIED GEM5_DEPRECATED_MACRO( \
75 UNIT_UNSPECIFIED, statistics::units::Unspecified::get(), \
76 "Use statistics::units::Unspecified::get()")
136 static Cycle instance;
153 static Tick instance;
204 static Byte instance;
221 static Watt instance;
239 static Joule instance;
256 static Volt instance;
276 static std::string
toString() {
return "Celsius"; }
295 static Count instance;
312 static Ratio instance;
332 static std::string
toString() {
return "Unspecified"; }
340template <
typename T1,
typename T2>
343 static_assert(std::is_base_of_v<Base, T1>,
"Rate(T1,T2) must have "
344 "T1 and T2 derived from statistics::units::Base");
345 static_assert(std::is_base_of_v<Base, T2>,
"Rate(T1,T2) must have "
346 "T1 and T2 derived from statistics::units::Base");
347 static_assert(!std::is_same_v<T1, T2> || std::is_same_v<T1, Count> ||
348 std::is_same_v<T1, Unspecified>,
349 "Rate(T1,T2) must have T1 and T2 of different types; "
350 "otherwise, it would be a Ratio");
366 return csprintf(
"(%s/%s)", T1::toString(), T2::toString());
The Base class is the parent class of all unit classes.
virtual std::string getUnitString() const =0
void operator=(Bit const &)=delete
static std::string toString()
std::string getUnitString() const override
std::string getUnitString() const override
Byte(Byte const &)=delete
static std::string toString()
void operator=(Byte const &)=delete
Count(Count const &)=delete
std::string getUnitString() const override
void operator=(Count const &)=delete
static std::string toString()
static std::string toString()
void operator=(Cycle const &)=delete
std::string getUnitString() const override
Cycle(Cycle const &)=delete
std::string getUnitString() const override
DegreeCelsius(DegreeCelsius const &)=delete
void operator=(DegreeCelsius const &)=delete
static DegreeCelsius * get()
static std::string toString()
std::string getUnitString() const override
void operator=(Joule const &)=delete
Joule(Joule const &)=delete
static std::string toString()
static std::string toString()
static Rate< T1, T2 > * get()
void operator=(Rate< T1, T2 > const &)=delete
std::string getUnitString() const override
void operator=(Ratio const &)=delete
static std::string toString()
Ratio(Ratio const &)=delete
std::string getUnitString() const override
std::string getUnitString() const override
void operator=(Second const &)=delete
Second(Second const &)=delete
static std::string toString()
static std::string toString()
Tick(Tick const &)=delete
std::string getUnitString() const override
void operator=(Tick const &)=delete
static std::string toString()
std::string getUnitString() const override
void operator=(Unspecified const &)=delete
static Unspecified * get()
Unspecified(Unspecified const &)=delete
Volt(Volt const &)=delete
void operator=(Volt const &)=delete
std::string getUnitString() const override
static std::string toString()
void operator=(Watt const &)=delete
static std::string toString()
std::string getUnitString() const override
Watt(Watt const &)=delete
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::string csprintf(const char *format, const Args &...args)