#include <ReuseDistance.hpp>
Public Member Functions | |
ReuseDistance (uint64_t w, uint64_t b) | |
ReuseDistance (uint64_t w) | |
virtual | ~ReuseDistance () |
virtual void | Print (std::ostream &f, bool annotate=false) |
virtual void | Print (bool annotate=false) |
void | PrintFormat (std::ostream &f) |
virtual void | Process (ReuseEntry &addr) |
void | Process (ReuseEntry *addrs, uint64_t count) |
void | Process (std::vector< ReuseEntry > rs) |
void | Process (std::vector< ReuseEntry * > addrs) |
ReuseStats * | GetStats (uint64_t id) |
void | GetIndices (std::vector< uint64_t > &ids) |
virtual void | GetActiveAddresses (std::vector< uint64_t > &addrs) |
virtual void | SkipAddresses (uint64_t amount) |
Static Public Attributes | |
static const uint64_t | DefaultBinIndividual = 32 |
static const uint64_t | Infinity = INFINITY_REUSE |
Protected Member Functions | |
void | Init (uint64_t w, uint64_t b) |
virtual ReuseStats * | GetStats (uint64_t id, bool gen) |
virtual const std::string | Describe () |
Protected Attributes | |
reuse_map_type< uint64_t, ReuseStats * > | stats |
uint64_t | capacity |
uint64_t | sequence |
uint64_t | binindividual |
uint64_t | maxtracking |
Tracks reuse distances for a memory address stream. Keep track of the addresses within a specific window of history, whose size can be finite or infinite. For basic usage, see the documentation at http://bit.ly/ScqZVj for the constructors, the Process methods and the Print methods. Also see the simple test file test/test.cpp included in this source package.
Definition at line 86 of file ReuseDistance.hpp.
ReuseDistance::ReuseDistance | ( | uint64_t | w, | |
uint64_t | b | |||
) |
Contructs a ReuseDistance object.
w | The maximum window size, or alternatively the maximum possible reuse distance that this tool will find. No window/distance limit is imposed if ReuseDistance::Infinity is used, though you could easily run of of memory. | |
b | All distances not greater than b will be tracked individually. All distances are tracked individually if b == ReuseDistance::Infinity. Beyond individual tracking, distances are tracked in bins whose boundaries are the powers of two greater than b (and not exeeding w, of course). |
Definition at line 56 of file ReuseDistance.cpp.
ReuseDistance::ReuseDistance | ( | uint64_t | w | ) |
Contructs a ReuseDistance object. Equivalent to calling the other constructor with b == ReuseDistance::DefaultBinIndividual
Definition at line 60 of file ReuseDistance.cpp.
ReuseDistance::~ReuseDistance | ( | ) | [virtual] |
Destroys a ReuseDistance object.
Definition at line 64 of file ReuseDistance.cpp.
virtual const std::string ReuseDistance::Describe | ( | ) | [inline, protected, virtual] |
Definition at line 108 of file ReuseDistance.hpp.
void ReuseDistance::GetActiveAddresses | ( | std::vector< uint64_t > & | addrs | ) | [virtual] |
Get a std::vector containing all of the addresses currently in this ReuseDistance object's active window.
addrs | A std::vector which will contain the addresses. It is an error to pass this vector non-empty (that is addrs.size() == 0 is enforced at runtime). |
Reimplemented in SpatialLocality.
Definition at line 90 of file ReuseDistance.cpp.
void ReuseDistance::GetIndices | ( | std::vector< uint64_t > & | ids | ) |
Get a std::vector containing all of the unique indices processed by this ReuseDistance object.
ids | A std::vector which will contain the ids. It is an error to pass this vector non-empty (that is addrs.size() == 0 is enforced at runtime). |
Definition at line 82 of file ReuseDistance.cpp.
ReuseStats * ReuseDistance::GetStats | ( | uint64_t | id | ) |
Get the ReuseStats object associated with some unique id.
id | The unique id. |
Definition at line 300 of file ReuseDistance.cpp.
ReuseStats * ReuseDistance::GetStats | ( | uint64_t | id, | |
bool | gen | |||
) | [protected, virtual] |
Definition at line 259 of file ReuseDistance.cpp.
void ReuseDistance::Init | ( | uint64_t | w, | |
uint64_t | b | |||
) | [protected] |
Definition at line 40 of file ReuseDistance.cpp.
void ReuseDistance::Print | ( | bool | annotate = false |
) | [virtual] |
Print statistics for this ReuseDistance to std::cout. See the other version of ReuseDistance::Print for information about output format.
annotate | Also print annotations describing the meaning of output fields, preceded by a '#'. |
Definition at line 100 of file ReuseDistance.cpp.
virtual void ReuseDistance::Print | ( | std::ostream & | f, | |
bool | annotate = false | |||
) | [virtual] |
Print statistics for this ReuseDistance to an output stream. The first line of the output is 7 tokens: [1] a string identifier for the class (REUSESTATS or SPATIALSTATS), [2] the capacity or window size (0 == unlimited), [3] the maximum individual value being tracked, above which values are tracked by bins whose boundaries are powers of 2, [4] the maximum value to track, above which any value is considered a miss. For ReuseDistance, this is equal to the capacity, for subclasses this can be different. [6] the number of ids that will be printed, [6] the total number of accesses made (the number of ReuseEntry elements that were Process'ed) and [7] the number of accesses that cold-misses or were outside the window range. The stats for individual ids are printed on subsequent lines. The printing of each id begins with a line which is comprised of 4 tokens: [1] a string identifier (REUSEID or SPATIALID), [2] the id, [3] the number of accesses to that id and [4] the number of accesses for that id that were cold-misses or were outside the window range. Each subsequent line contains information about a single bin for that id. These lines have 3 tokens: [1] and [2] the lower and upper boundaries (both inclusive) of the bin and [3] the number of accesses falling into that bin. See also ReuseDistance::PrintFormat
f | The output stream to print results to. | |
annotate | Also print annotations describing the meaning of output fields, preceded by a '#'. |
void ReuseDistance::PrintFormat | ( | std::ostream & | f | ) |
Print information about the output format of ReuseDistance or one of its subclasses
f | The stream to receive the output. |
void ReuseDistance::Process | ( | std::vector< ReuseEntry * > | addrs | ) |
Process multiple memory addresses. Equivalent to calling Process on each element of the input vector.
addrs | A std::vector of memory addresses to process. |
void ReuseDistance::Process | ( | std::vector< ReuseEntry > | rs | ) |
Process multiple memory addresses. Equivalent to calling Process on each element of the input vector.
addrs | A std::vector of memory addresses to process. |
void ReuseDistance::Process | ( | ReuseEntry * | addrs, | |
uint64_t | count | |||
) |
Process multiple memory addresses. Equivalent to calling Process on each element of the input array.
addrs | An array of structures describing memory addresses to process. | |
count | The number of elements in addrs. |
Definition at line 104 of file ReuseDistance.cpp.
void ReuseDistance::Process | ( | ReuseEntry & | addr | ) | [virtual] |
Process a single memory address.
addr | The structure describing the memory address to process. |
Reimplemented in SpatialLocality.
Definition at line 138 of file ReuseDistance.cpp.
void ReuseDistance::SkipAddresses | ( | uint64_t | amount | ) | [virtual] |
Pretend that some number of addresses in the stream were skipped. Useful for intervel-based sampling. This has the effect of flushing the entire window.
amount | The number of addresses to skip. |
Reimplemented in SpatialLocality.
Definition at line 124 of file ReuseDistance.cpp.
uint64_t ReuseDistance::binindividual [protected] |
Definition at line 103 of file ReuseDistance.hpp.
uint64_t ReuseDistance::capacity [protected] |
Definition at line 101 of file ReuseDistance.hpp.
const uint64_t ReuseDistance::DefaultBinIndividual = 32 [static] |
Definition at line 112 of file ReuseDistance.hpp.
const uint64_t ReuseDistance::Infinity = INFINITY_REUSE [static] |
Definition at line 113 of file ReuseDistance.hpp.
uint64_t ReuseDistance::maxtracking [protected] |
Definition at line 104 of file ReuseDistance.hpp.
uint64_t ReuseDistance::sequence [protected] |
Definition at line 102 of file ReuseDistance.hpp.
reuse_map_type<uint64_t, ReuseStats*> ReuseDistance::stats [protected] |
Definition at line 99 of file ReuseDistance.hpp.