summaryrefslogtreecommitdiffstats
path: root/base/vlog_unittest.cc
diff options
context:
space:
mode:
authorglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 10:59:27 +0000
committerglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 10:59:27 +0000
commit5456e9104948d93a9fa112765fd3ad294927481f (patch)
treec5537ad1f1e94d41f15beca93fdca1c26b1216fb /base/vlog_unittest.cc
parent2737a57f9361dfc4b3613a253aa677b40d16bb2e (diff)
downloadchromium_src-5456e9104948d93a9fa112765fd3ad294927481f.zip
chromium_src-5456e9104948d93a9fa112765fd3ad294927481f.tar.gz
chromium_src-5456e9104948d93a9fa112765fd3ad294927481f.tar.bz2
If VlogTest.Perf is ran under Valgrind, decrease the number of benchmark
iterations. Otherwise the test may time out due to slowdown. TBR=akalin Review URL: http://codereview.chromium.org/3578004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/vlog_unittest.cc')
-rw-r--r--base/vlog_unittest.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/base/vlog_unittest.cc b/base/vlog_unittest.cc
index bb48724..95aa1b9a 100644
--- a/base/vlog_unittest.cc
+++ b/base/vlog_unittest.cc
@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -68,11 +69,12 @@ TEST_F(VlogTest, Perf) {
"/path/to/another-not-matched.mm",
};
const int kVlogCount = arraysize(kVlogs);
+ const int kBenchmarkIterations = RunningOnValgrind() ? 30000 : 10000000;
base::TimeDelta null_elapsed;
{
VlogInfo null_vlog_info("", "");
- BENCHMARK(10000000, null_elapsed, {
+ BENCHMARK(kBenchmarkIterations, null_elapsed, {
EXPECT_NE(-1, null_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount]));
});
}
@@ -80,7 +82,7 @@ TEST_F(VlogTest, Perf) {
{
VlogInfo small_vlog_info("0", "foo=1,bar=2,baz=3,qux=4,quux=5");
base::TimeDelta elapsed;
- BENCHMARK(10000000, elapsed, {
+ BENCHMARK(kBenchmarkIterations, elapsed, {
EXPECT_NE(-1, small_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount]));
});
LOG(INFO) << "slowdown = " << GetSlowdown(null_elapsed, elapsed)
@@ -90,7 +92,7 @@ TEST_F(VlogTest, Perf) {
{
VlogInfo pattern_vlog_info("0", "fo*=1,ba?=2,b*?z=3,*ux=4,?uux=5");
base::TimeDelta elapsed;
- BENCHMARK(10000000, elapsed, {
+ BENCHMARK(kBenchmarkIterations, elapsed, {
EXPECT_NE(-1, pattern_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount]));
});
LOG(INFO) << "slowdown = " << GetSlowdown(null_elapsed, elapsed)