summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authordsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-24 19:08:23 +0000
committerdsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-24 19:08:23 +0000
commit553dba6dd707ee02e609910462d2b7977f284af2 (patch)
treec38ea1fbfb3a1d387134541faa9bdfc0720234cf /net/disk_cache
parent0e7fe5cab991f8751ecaa6cd43ff7e51d9647dde (diff)
downloadchromium_src-553dba6dd707ee02e609910462d2b7977f284af2.zip
chromium_src-553dba6dd707ee02e609910462d2b7977f284af2.tar.gz
chromium_src-553dba6dd707ee02e609910462d2b7977f284af2.tar.bz2
Use string for Histogram names since these are all ASCII anyway.
Wide-character literals cause problems between platforms. Review URL: http://codereview.chromium.org/28046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/backend_impl.cc12
-rw-r--r--net/disk_cache/block_files.cc6
-rw-r--r--net/disk_cache/entry_impl.cc11
-rw-r--r--net/disk_cache/eviction.cc6
-rw-r--r--net/disk_cache/rankings.cc4
-rw-r--r--net/disk_cache/stats.cc3
-rw-r--r--net/disk_cache/stats_histogram.h3
7 files changed, 21 insertions, 24 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index a078bc4..52d8f65 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -276,7 +276,7 @@ bool BackendImpl::OpenEntry(const std::string& key, Entry** entry) {
DCHECK(entry);
*entry = cache_entry;
- UMA_HISTOGRAM_TIMES(L"DiskCache.OpenTime", Time::Now() - start);
+ UMA_HISTOGRAM_TIMES("DiskCache.OpenTime", Time::Now() - start);
stats_.OnEvent(Stats::OPEN_HIT);
return true;
}
@@ -349,7 +349,7 @@ bool BackendImpl::CreateEntry(const std::string& key, Entry** entry) {
*entry = NULL;
cache_entry.swap(reinterpret_cast<EntryImpl**>(entry));
- UMA_HISTOGRAM_TIMES(L"DiskCache.CreateTime", Time::Now() - start);
+ UMA_HISTOGRAM_TIMES("DiskCache.CreateTime", Time::Now() - start);
stats_.OnEvent(Stats::CREATE_HIT);
Trace("create entry hit ");
return true;
@@ -651,7 +651,7 @@ void BackendImpl::CriticalError(int error) {
}
void BackendImpl::ReportError(int error) {
- static LinearHistogram counter(L"DiskCache.Error", 0, 49, 50);
+ static LinearHistogram counter("DiskCache.Error", 0, 49, 50);
counter.SetFlags(kUmaTargetedHistogramFlag);
// We transmit positive numbers, instead of direct error codes.
@@ -679,9 +679,9 @@ void BackendImpl::OnStatsTimer() {
if (first_time) {
first_time = false;
int experiment = data_->header.experiment;
- std::wstring entries(StringPrintf(L"DiskCache.Entries_%d", experiment));
- std::wstring size(StringPrintf(L"DiskCache.Size_%d", experiment));
- std::wstring max_size(StringPrintf(L"DiskCache.MaxSize_%d", experiment));
+ std::string entries(StringPrintf("DiskCache.Entries_%d", experiment));
+ std::string size(StringPrintf("DiskCache.Size_%d", experiment));
+ std::string max_size(StringPrintf("DiskCache.MaxSize_%d", experiment));
UMA_HISTOGRAM_COUNTS(entries.c_str(), data_->header.num_entries);
UMA_HISTOGRAM_COUNTS(size.c_str(), data_->header.num_bytes / (1024 * 1024));
UMA_HISTOGRAM_COUNTS(max_size.c_str(), max_size_ / (1024 * 1024));
diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc
index 84c03b9..63a7c2e 100644
--- a/net/disk_cache/block_files.cc
+++ b/net/disk_cache/block_files.cc
@@ -66,7 +66,7 @@ bool CreateMapBlock(int target, int size, disk_cache::BlockFileHeader* header,
if (target != size) {
header->empty[target - size - 1]++;
}
- HISTOGRAM_TIMES(L"DiskCache.CreateBlock", Time::Now() - start);
+ HISTOGRAM_TIMES("DiskCache.CreateBlock", Time::Now() - start);
return true;
}
}
@@ -114,7 +114,7 @@ void DeleteMapBlock(int index, int size, disk_cache::BlockFileHeader* header) {
}
header->num_entries--;
DCHECK(header->num_entries >= 0);
- HISTOGRAM_TIMES(L"DiskCache.DeleteBlock", Time::Now() - start);
+ HISTOGRAM_TIMES("DiskCache.DeleteBlock", Time::Now() - start);
}
// Restores the "empty counters" and allocation hints.
@@ -323,7 +323,7 @@ MappedFile* BlockFiles::FileForNewBlock(FileType block_type, int block_count) {
return NULL;
break;
}
- HISTOGRAM_TIMES(L"DiskCache.GetFileForNewBlock", Time::Now() - start);
+ HISTOGRAM_TIMES("DiskCache.GetFileForNewBlock", Time::Now() - start);
return file;
}
diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc
index a8f9ad1..b64073a 100644
--- a/net/disk_cache/entry_impl.cc
+++ b/net/disk_cache/entry_impl.cc
@@ -90,8 +90,8 @@ EntryImpl::EntryImpl(BackendImpl* backend, Addr address)
// written before).
EntryImpl::~EntryImpl() {
if (doomed_) {
- UMA_HISTOGRAM_COUNTS(L"DiskCache.DeleteHeader", GetDataSize(0));
- UMA_HISTOGRAM_COUNTS(L"DiskCache.DeleteData", GetDataSize(1));
+ UMA_HISTOGRAM_COUNTS("DiskCache.DeleteHeader", GetDataSize(0));
+ UMA_HISTOGRAM_COUNTS("DiskCache.DeleteData", GetDataSize(1));
for (int index = 0; index < NUM_STREAMS; index++) {
Addr address(entry_.Data()->data_addr[index]);
if (address.is_initialized()) {
@@ -211,7 +211,7 @@ int EntryImpl::ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
return net::ERR_INVALID_ARGUMENT;
Time start = Time::Now();
- static Histogram stats(L"DiskCache.ReadTime", TimeDelta::FromMilliseconds(1),
+ static Histogram stats("DiskCache.ReadTime", TimeDelta::FromMilliseconds(1),
TimeDelta::FromSeconds(10), 50);
stats.SetFlags(kUmaTargetedHistogramFlag);
@@ -285,7 +285,7 @@ int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
}
Time start = Time::Now();
- static Histogram stats(L"DiskCache.WriteTime", TimeDelta::FromMilliseconds(1),
+ static Histogram stats("DiskCache.WriteTime", TimeDelta::FromMilliseconds(1),
TimeDelta::FromSeconds(10), 50);
stats.SetFlags(kUmaTargetedHistogramFlag);
@@ -557,7 +557,7 @@ void EntryImpl::DeleteData(Addr address, int index) {
files_[index] = NULL; // Releases the object.
if (!DeleteCacheFile(backend_->GetFileName(address))) {
- UMA_HISTOGRAM_COUNTS(L"DiskCache.DeleteFailed", 1);
+ UMA_HISTOGRAM_COUNTS("DiskCache.DeleteFailed", 1);
LOG(ERROR) << "Failed to delete " << backend_->GetFileName(address) <<
" from the cache.";
}
@@ -785,4 +785,3 @@ void EntryImpl::Log(const char* msg) {
}
} // namespace disk_cache
-
diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc
index 11ff969..11bce72 100644
--- a/net/disk_cache/eviction.cc
+++ b/net/disk_cache/eviction.cc
@@ -80,7 +80,7 @@ void Eviction::TrimCache(bool empty) {
}
}
- UMA_HISTOGRAM_TIMES(L"DiskCache.TotalTrimTime", Time::Now() - start);
+ UMA_HISTOGRAM_TIMES("DiskCache.TotalTrimTime", Time::Now() - start);
Trace("*** Trim Cache end ***");
return;
}
@@ -107,8 +107,8 @@ void Eviction::ReportTrimTimes(EntryImpl* entry) {
static bool first_time = true;
if (first_time) {
first_time = false;
- std::wstring name(StringPrintf(L"DiskCache.TrimAge_%d",
- header_->experiment));
+ std::string name(StringPrintf("DiskCache.TrimAge_%d",
+ header_->experiment));
static Histogram counter(name.c_str(), 1, 10000, 50);
counter.SetFlags(kUmaTargetedHistogramFlag);
counter.Add((Time::Now() - entry->GetLastUsed()).InHours());
diff --git a/net/disk_cache/rankings.cc b/net/disk_cache/rankings.cc
index d786077..01a7222 100644
--- a/net/disk_cache/rankings.cc
+++ b/net/disk_cache/rankings.cc
@@ -234,7 +234,7 @@ bool Rankings::GetRanking(CacheRankingsBlock* rankings) {
EntryImpl* cache_entry =
reinterpret_cast<EntryImpl*>(rankings->Data()->pointer);
rankings->SetData(cache_entry->rankings()->Data());
- UMA_HISTOGRAM_TIMES(L"DiskCache.GetRankings", Time::Now() - start);
+ UMA_HISTOGRAM_TIMES("DiskCache.GetRankings", Time::Now() - start);
return true;
}
@@ -389,7 +389,7 @@ void Rankings::UpdateRank(CacheRankingsBlock* node, bool modified, List list) {
Time start = Time::Now();
Remove(node, list);
Insert(node, modified, list);
- UMA_HISTOGRAM_TIMES(L"DiskCache.UpdateRank", Time::Now() - start);
+ UMA_HISTOGRAM_TIMES("DiskCache.UpdateRank", Time::Now() - start);
}
void Rankings::CompleteTransaction() {
diff --git a/net/disk_cache/stats.cc b/net/disk_cache/stats.cc
index 7c49e5c..a6733cb 100644
--- a/net/disk_cache/stats.cc
+++ b/net/disk_cache/stats.cc
@@ -123,7 +123,7 @@ bool Stats::Init(BackendImpl* backend, uint32* storage_addr) {
if (!size_histogram_.get()) {
// Stats may be reused when the cache is re-created, but we want only one
// histogram at any given time.
- size_histogram_.reset(new StatsHistogram(L"DiskCache.SizeStats"));
+ size_histogram_.reset(new StatsHistogram("DiskCache.SizeStats"));
size_histogram_->Init(this);
}
@@ -267,4 +267,3 @@ void Stats::GetItems(StatsItems* items) {
}
} // namespace disk_cache
-
diff --git a/net/disk_cache/stats_histogram.h b/net/disk_cache/stats_histogram.h
index 4dd76cc..8db3bb3 100644
--- a/net/disk_cache/stats_histogram.h
+++ b/net/disk_cache/stats_histogram.h
@@ -23,7 +23,7 @@ class StatsHistogram : public Histogram {
}
};
- explicit StatsHistogram(const wchar_t* name)
+ explicit StatsHistogram(const char* name)
: Histogram(name, 1, 1, 2), init_(false) {}
~StatsHistogram();
@@ -43,4 +43,3 @@ class StatsHistogram : public Histogram {
} // namespace disk_cache
#endif // NET_DISK_CACHE_STATS_HISTOGRAM_H_
-