Bandwidth¶
-
class bandwidth¶
This class encapuslates the operation of consuming a fixed number of operations, a very common operation in ChampSim. Once initialized, the maximum bandwidth cannot be changed. Instead, consuming the bandwidth reduces the amount available until it is depleted.
Public Types
-
using maximum_type = max_t¶
The type of the maximum. This type is integer-like, with the exception that it is immutable.
This type is exported so that other types can keep maximums as members.
Public Functions
-
void consume(underlying_type delta)¶
Consume some of the bandwidth.
- Parameters:
delta – The amount of bandwidth to consume
- Throws:
std::range_error – if more than the maximum amount of bandwidth will have been consumed.
-
void consume()¶
Consume one unit of bandwidth.
- Throws:
std::range_error – if more than the maximum amount of bandwidth will have been consumed.
-
bool has_remaining() const¶
Report if the bandwidth has one or more unit remaining.
-
underlying_type amount_consumed() const¶
Report the amount of bandwidth that has been consumed
-
underlying_type amount_remaining() const¶
Report the amount of bandwidth that remains
-
void reset()¶
Reset the bandwidth, so that it can be used again.
-
explicit bandwidth(maximum_type maximum)¶
Initialize a bandwidth with the specified maximum.
-
using maximum_type = max_t¶