Home | History | Annotate | Download | only in disk_cache

Lines Matching defs:Stats

5 #include "net/disk_cache/stats.h"
20 int data_sizes[disk_cache::Stats::kDataSizesLength];
21 int64 counters[disk_cache::Stats::MAX_COUNTER];
41 // WARNING: Add new stats only at the end, or change LoadStats().
65 COMPILE_ASSERT(arraysize(kCounterNames) == disk_cache::Stats::MAX_COUNTER,
72 bool LoadStats(BackendImpl* backend, Addr address, OnDiskStats* stats) {
79 memset(stats, 0, sizeof(*stats));
80 if (!file->Read(stats, sizeof(*stats), offset))
83 if (stats->signature != kDiskSignature)
88 if (static_cast<unsigned int>(stats->size) > sizeof(*stats)) {
89 memset(stats, 0, sizeof(*stats));
95 bool StoreStats(BackendImpl* backend, Addr address, OnDiskStats* stats) {
102 return file->Write(stats, sizeof(*stats), offset);
105 bool CreateStats(BackendImpl* backend, Addr* address, OnDiskStats* stats) {
111 COMPILE_ASSERT(sizeof(*stats) <= 256 * 2, use_more_blocks);
112 memset(stats, 0, sizeof(*stats));
113 stats->signature = kDiskSignature;
114 stats->size = sizeof(*stats);
116 return StoreStats(backend, *address, stats);
119 Stats::Stats() : backend_(NULL), size_histogram_(NULL) {
122 Stats::~Stats() {
125 bool Stats::Init(BackendImpl* backend, uint32* storage_addr) {
126 OnDiskStats stats;
129 if (!LoadStats(backend, address, &stats))
132 if (!CreateStats(backend, &address, &stats))
140 memcpy(data_sizes_, stats.data_sizes, sizeof(data_sizes_));
141 memcpy(counters_, stats.counters, sizeof(counters_));
151 // Stats may be reused when the cache is re-created, but we want only one
162 void Stats::ModifyStorageStats(int32 old_size, int32 new_size) {
177 void Stats::OnEvent(Counters an_event) {
182 void Stats::SetCounter(Counters counter, int64 value) {
187 int64 Stats::GetCounter(Counters counter) const {
192 void Stats::GetItems(StatsItems* items) {
207 int Stats::GetHitRatio() const {
211 int Stats::GetResurrectRatio() const {
215 void Stats::ResetRatios() {
222 int Stats::GetLargeEntriesSize() {
232 void Stats::Store() {
236 OnDiskStats stats;
237 stats.signature = kDiskSignature;
238 stats.size = sizeof(stats);
239 memcpy(stats.data_sizes, data_sizes_, sizeof(data_sizes_));
240 memcpy(stats.counters, counters_, sizeof(counters_));
243 StoreStats(backend_, address, &stats);
246 int Stats::GetBucketRange(size_t i) const {
267 void Stats::Snapshot(StatsHistogram::StatsSamples* samples) const {
298 int Stats::GetStatsBucket(int32 size) {
320 int Stats::GetRatio(Counters hit, Counters miss) const {