diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-29 18:06:13 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-29 18:06:13 +0000 |
commit | bd5a374c7af702ea50f03ed2db1eed512a49ecf3 (patch) | |
tree | 0c11db1e13c21c98b0df9bcbcff36d57c5bd6195 /base/test | |
parent | d389af4824d1709786e7135fc20df2a44a0a9f47 (diff) | |
download | chromium_src-bd5a374c7af702ea50f03ed2db1eed512a49ecf3.zip chromium_src-bd5a374c7af702ea50f03ed2db1eed512a49ecf3.tar.gz chromium_src-bd5a374c7af702ea50f03ed2db1eed512a49ecf3.tar.bz2 |
base: Move PerfTimer out of test/ directory.
Reason: PerfTimer is used by production code, so it doesn't make sense to have
it as test only.
- Rename it to ElapsedTimer.
- Move into base namespace.
- Move into timer/ directory.
BUG=None
TEST=None, no functional change
R=brettw@chromium.org
TBR=grt@chromium.org # for chrome_frame
Review URL: https://codereview.chromium.org/24265005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/test')
-rw-r--r-- | base/test/perf_time_logger.h | 4 | ||||
-rw-r--r-- | base/test/perftimer.cc | 45 | ||||
-rw-r--r-- | base/test/perftimer.h | 33 |
3 files changed, 2 insertions, 80 deletions
diff --git a/base/test/perf_time_logger.h b/base/test/perf_time_logger.h index f23c530..403b272 100644 --- a/base/test/perf_time_logger.h +++ b/base/test/perf_time_logger.h @@ -8,7 +8,7 @@ #include <string> #include "base/basictypes.h" -#include "base/test/perftimer.h" +#include "base/timer/elapsed_timer.h" namespace base { @@ -27,7 +27,7 @@ class PerfTimeLogger { private: bool logged_; std::string test_name_; - PerfTimer timer_; + ElapsedTimer timer_; DISALLOW_COPY_AND_ASSIGN(PerfTimeLogger); }; diff --git a/base/test/perftimer.cc b/base/test/perftimer.cc deleted file mode 100644 index 6815f0b..0000000 --- a/base/test/perftimer.cc +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/test/perftimer.h" - -#include <stdio.h> -#include <string> - -#include "base/basictypes.h" -#include "base/file_util.h" -#include "base/files/file_path.h" -#include "base/logging.h" - -static FILE* perf_log_file = NULL; - -bool InitPerfLog(const base::FilePath& log_file) { - if (perf_log_file) { - // trying to initialize twice - NOTREACHED(); - return false; - } - - perf_log_file = file_util::OpenFile(log_file, "w"); - return perf_log_file != NULL; -} - -void FinalizePerfLog() { - if (!perf_log_file) { - // trying to cleanup without initializing - NOTREACHED(); - return; - } - file_util::CloseFile(perf_log_file); -} - -void LogPerfResult(const char* test_name, double value, const char* units) { - if (!perf_log_file) { - NOTREACHED(); - return; - } - - fprintf(perf_log_file, "%s\t%g\t%s\n", test_name, value, units); - printf("%s\t%g\t%s\n", test_name, value, units); -} diff --git a/base/test/perftimer.h b/base/test/perftimer.h deleted file mode 100644 index 86ee126..0000000 --- a/base/test/perftimer.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_TEST_PERFTIMER_H_ -#define BASE_TEST_PERFTIMER_H_ - -#include "base/basictypes.h" -#include "base/time/time.h" - -namespace base { -class FilePath; -} - -// A simple wrapper around Now() -class PerfTimer { - public: - PerfTimer() { - begin_ = base::TimeTicks::Now(); - } - - // Returns the time elapsed since object construction - base::TimeDelta Elapsed() const { - return base::TimeTicks::Now() - begin_; - } - - private: - base::TimeTicks begin_; - - DISALLOW_COPY_AND_ASSIGN(PerfTimer); -}; - -#endif // BASE_TEST_PERFTIMER_H_ |