diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-10 16:35:47 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-10 16:35:47 +0000 |
commit | 85632fab9c8f30b4651f06fd75e1ba5881226e6c (patch) | |
tree | 45e5c31224f7b5951fbefb387da4f3fbf7acbd85 /chrome | |
parent | 99aae10b7b9cd4c1e08bb4e978c822483864e331 (diff) | |
download | chromium_src-85632fab9c8f30b4651f06fd75e1ba5881226e6c.zip chromium_src-85632fab9c8f30b4651f06fd75e1ba5881226e6c.tar.gz chromium_src-85632fab9c8f30b4651f06fd75e1ba5881226e6c.tar.bz2 |
Switch to using TimeTicks for profiling and histograms
Avoid using wall clock time, which can be changed by the user,
or impacted by Daylight Savings transitions etc.
BUG=14193
r=eroman
Review URL: http://codereview.chromium.org/1253005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46821 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_database.cc | 10 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_database_bloom.cc | 4 | ||||
-rw-r--r-- | chrome/test/chrome_process_util.cc | 8 |
3 files changed, 11 insertions, 11 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc index aa6a97a..3237b30 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database.cc @@ -9,7 +9,7 @@ #include "chrome/browser/safe_browsing/bloom_filter.h" #include "chrome/browser/safe_browsing/safe_browsing_database_bloom.h" -using base::Time; +using base::TimeTicks; // Filename suffix for the bloom filter. static const FilePath::CharType kBloomFilterFile[] = @@ -47,10 +47,10 @@ void SafeBrowsingDatabase::LoadBloomFilter() { } // We have a bloom filter file, so use that as our filter. - Time before = Time::Now(); + TimeTicks before = TimeTicks::Now(); bloom_filter_ = BloomFilter::LoadFile(bloom_filter_filename_); SB_DLOG(INFO) << "SafeBrowsingDatabase read bloom filter in " - << (Time::Now() - before).InMilliseconds() << " ms"; + << (TimeTicks::Now() - before).InMilliseconds() << " ms"; if (!bloom_filter_.get()) UMA_HISTOGRAM_COUNTS("SB2.FilterReadFail", 1); @@ -64,10 +64,10 @@ void SafeBrowsingDatabase::WriteBloomFilter() { if (!bloom_filter_.get()) return; - Time before = Time::Now(); + TimeTicks before = TimeTicks::Now(); bool write_ok = bloom_filter_->WriteFile(bloom_filter_filename_); SB_DLOG(INFO) << "SafeBrowsingDatabase wrote bloom filter in " << - (Time::Now() - before).InMilliseconds() << " ms"; + (TimeTicks::Now() - before).InMilliseconds() << " ms"; if (!write_ok) UMA_HISTOGRAM_COUNTS("SB2.FilterWriteFail", 1); diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc index 6951e41..8acda7c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc @@ -157,7 +157,7 @@ void SafeBrowsingDatabaseBloom::InsertChunks(const std::string& list_name, if (chunks.empty()) return; - base::Time insert_start = base::Time::Now(); + base::TimeTicks insert_start = base::TimeTicks::Now(); int list_id = safe_browsing_util::GetListId(list_name); ChunkType chunk_type = chunks.front().is_add ? ADD_CHUNK : SUB_CHUNK; @@ -190,7 +190,7 @@ void SafeBrowsingDatabaseBloom::InsertChunks(const std::string& list_name, } } - UMA_HISTOGRAM_TIMES("SB2.ChunkInsert", base::Time::Now() - insert_start); + UMA_HISTOGRAM_TIMES("SB2.ChunkInsert", base::TimeTicks::Now() - insert_start); } void SafeBrowsingDatabaseBloom::DeleteChunks( diff --git a/chrome/test/chrome_process_util.cc b/chrome/test/chrome_process_util.cc index 8e86e60..a3c4d6f 100644 --- a/chrome/test/chrome_process_util.cc +++ b/chrome/test/chrome_process_util.cc @@ -12,8 +12,8 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/result_codes.h" -using base::Time; using base::TimeDelta; +using base::TimeTicks; void TerminateAllChromeProcesses(base::ProcessId browser_pid) { // Total time the function will wait for chrome processes @@ -38,11 +38,11 @@ void TerminateAllChromeProcesses(base::ProcessId browser_pid) { for (it = handles.begin(); it != handles.end(); ++it) base::KillProcess(*it, ResultCodes::TASKMAN_KILL, false); - const Time start = Time::Now(); + const TimeTicks start = TimeTicks::Now(); for (it = handles.begin(); - it != handles.end() && Time::Now() - start < kExitTimeout; + it != handles.end() && TimeTicks::Now() - start < kExitTimeout; ++it) { - int64 wait_time_ms = (Time::Now() - start).InMilliseconds(); + int64 wait_time_ms = (TimeTicks::Now() - start).InMilliseconds(); base::WaitForSingleProcess(*it, wait_time_ms); } |