ReuseDistance Class Reference

#include <ReuseDistance.hpp>

Inheritance diagram for ReuseDistance:
SpatialLocality

List of all members.

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)
ReuseStatsGetStats (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 ReuseStatsGetStats (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

Detailed Description

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.


Constructor & Destructor Documentation

ReuseDistance::ReuseDistance ( uint64_t  w,
uint64_t  b 
)

Contructs a ReuseDistance object.

Parameters:
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.


Member Function Documentation

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.

Parameters:
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).
Returns:
none

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.

Parameters:
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).
Returns:
none

Definition at line 82 of file ReuseDistance.cpp.

ReuseStats * ReuseDistance::GetStats ( uint64_t  id  ) 

Get the ReuseStats object associated with some unique id.

Parameters:
id The unique id.
Returns:
The ReuseStats object associated with parameter id, or NULL if no ReuseStats is associate with 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.

Parameters:
annotate Also print annotations describing the meaning of output fields, preceded by a '#'.
Returns:
none

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

Parameters:
f The output stream to print results to.
annotate Also print annotations describing the meaning of output fields, preceded by a '#'.
Returns:
none
void ReuseDistance::PrintFormat ( std::ostream &  f  ) 

Print information about the output format of ReuseDistance or one of its subclasses

Parameters:
f The stream to receive the output.
Returns:
none
void ReuseDistance::Process ( std::vector< ReuseEntry * >  addrs  ) 

Process multiple memory addresses. Equivalent to calling Process on each element of the input vector.

Parameters:
addrs A std::vector of memory addresses to process.
Returns:
none
void ReuseDistance::Process ( std::vector< ReuseEntry rs  ) 

Process multiple memory addresses. Equivalent to calling Process on each element of the input vector.

Parameters:
addrs A std::vector of memory addresses to process.
Returns:
none
void ReuseDistance::Process ( ReuseEntry addrs,
uint64_t  count 
)

Process multiple memory addresses. Equivalent to calling Process on each element of the input array.

Parameters:
addrs An array of structures describing memory addresses to process.
count The number of elements in addrs.
Returns:
none

Definition at line 104 of file ReuseDistance.cpp.

void ReuseDistance::Process ( ReuseEntry addr  )  [virtual]

Process a single memory address.

Parameters:
addr The structure describing the memory address to process.
Returns:
none

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.

Parameters:
amount The number of addresses to skip.
Returns:
none

Reimplemented in SpatialLocality.

Definition at line 124 of file ReuseDistance.cpp.


Member Data Documentation

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.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Defines
Generated on Sun Oct 21 14:56:28 2012 for ReuseDistance by  doxygen 1.6.3