27 : n_blocks_(n_blocks),
35 cache_block& blk = blocks_[block_idx];
38 requested_bytes_ += requested_region.
size();
39 fetched_bytes_ += fetched_regions.
size();
44 std::size_t temporal_hit_size = temporal_hit_regions.
size();
45 std::size_t spatial_hit_size = hit_regions.
size() - temporal_hit_size;
47 temporal_hit_bytes_ += temporal_hit_size;
48 spatial_hit_bytes_ += spatial_hit_size;
50 if (fetched_regions.
empty()) {
57 blk.requested_regions.add(requested_region);
65 cache_block& blk = blocks_[block_idx];
68 requested_bytes_ += requested_region.
size();
75 std::size_t temporal_hit_size = temporal_hit_regions.
size();
76 std::size_t spatial_hit_size = hit_regions.
size() - temporal_hit_size;
78 temporal_hit_bytes_ += temporal_hit_size;
79 spatial_hit_bytes_ += spatial_hit_size;
81 skip_fetch_hit_bytes_ += skip_fetch_hit_regions.
size();
86 blk.requested_regions.add(requested_region);
92 cache_block& blk = blocks_[block_idx];
95 wasted_fetched_bytes_ += valid_regions.
size() - blk.requested_regions.size();
98 blk.requested_regions.clear();
102 requested_bytes_ = 0;
104 wasted_fetched_bytes_ = 0;
105 temporal_hit_bytes_ = 0;
106 spatial_hit_bytes_ = 0;
107 skip_fetch_hit_bytes_ = 0;
108 block_hit_count_ = 0;
109 block_miss_count_ = 0;
129 printf(
"[Cache blocks]\n");
130 printf(
" User requested: %18ld bytes\n" , requested_bytes_all);
131 printf(
" Fetched: %18ld bytes\n" , fetched_bytes_all);
132 printf(
" Fetched (wasted): %18ld bytes\n" , wasted_fetched_bytes_all);
133 printf(
" Temporal hit: %18ld bytes\n" , temporal_hit_bytes_all);
134 printf(
" Spatial hit: %18ld bytes\n" , spatial_hit_bytes_all);
135 printf(
" Skip-fetch hit: %18ld bytes\n" , skip_fetch_hit_bytes_all);
136 printf(
" Hit count: %18ld blocks\n", block_hit_count_all);
137 printf(
" Miss count: %18ld blocks\n", block_miss_count_all);
149 std::vector<cache_block> blocks_;
151 std::size_t requested_bytes_ = 0;
152 std::size_t fetched_bytes_ = 0;
153 std::size_t wasted_fetched_bytes_ = 0;
154 std::size_t temporal_hit_bytes_ = 0;
155 std::size_t spatial_hit_bytes_ = 0;
156 std::size_t skip_fetch_hit_bytes_ = 0;
157 std::size_t block_hit_count_ = 0;
158 std::size_t block_miss_count_ = 0;
160 bool enabled_ =
false;
Definition: cache_profiler.hpp:13
void invalidate(cache_entry_idx_t, const block_region_set &)
Definition: cache_profiler.hpp:18
void stop()
Definition: cache_profiler.hpp:20
void record_writeonly(cache_entry_idx_t, block_region, const block_region_set &)
Definition: cache_profiler.hpp:17
void record(cache_entry_idx_t, block_region, const block_region_set &)
Definition: cache_profiler.hpp:16
void print() const
Definition: cache_profiler.hpp:21
void start()
Definition: cache_profiler.hpp:19
cache_profiler_disabled(cache_entry_idx_t)
Definition: cache_profiler.hpp:15
Definition: cache_profiler.hpp:24
void invalidate(cache_entry_idx_t block_idx, const block_region_set &valid_regions)
Definition: cache_profiler.hpp:89
void stop()
Definition: cache_profiler.hpp:114
void record_writeonly(cache_entry_idx_t block_idx, block_region requested_region, const block_region_set &valid_regions)
Definition: cache_profiler.hpp:60
void print() const
Definition: cache_profiler.hpp:118
cache_profiler_stats(cache_entry_idx_t n_blocks)
Definition: cache_profiler.hpp:26
void start()
Definition: cache_profiler.hpp:101
void record(cache_entry_idx_t block_idx, block_region requested_region, const block_region_set &fetched_regions)
Definition: cache_profiler.hpp:30
region_set< T > complement(region< T > r) const
Definition: block_region_set.hpp:162
bool empty() const
Definition: block_region_set.hpp:82
std::size_t size() const
Definition: block_region_set.hpp:242
#define ITYR_CONCAT(x, y)
Definition: util.hpp:20
#define ITYR_CHECK(cond)
Definition: util.hpp:48
MPI_Comm mpicomm()
Definition: topology.hpp:206
rank_t my_rank()
Definition: topology.hpp:207
T mpi_reduce_value(const T &value, int root_rank, MPI_Comm comm, MPI_Op op=MPI_SUM)
Definition: mpi_util.hpp:170
Definition: block_region_set.hpp:9
ITYR_CONCAT(cache_profiler_, ITYR_ORI_CACHE_PROF) cache_profiler
Definition: cache_profiler.hpp:163
region< T > get_intersection(const region< T > &r1, const region< T > &r2)
Definition: block_region_set.hpp:56
int cache_entry_idx_t
Definition: cache_system.hpp:30
#define ITYR_ORI_CACHE_PROF
Definition: block_region_set.hpp:12
std::size_t size() const
Definition: block_region_set.hpp:23