Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: base/vlog_unittest.cc

Issue 3578004: If VlogTest.Perf is ran under Valgrind, decrease the number of benchmark... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/vlog.h" 5 #include "base/vlog.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
9 #include "base/time.h" 10 #include "base/time.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace logging { 13 namespace logging {
13 14
14 namespace { 15 namespace {
15 16
16 class VlogTest : public testing::Test { 17 class VlogTest : public testing::Test {
17 }; 18 };
18 19
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 const char* kVlogs[] = { 62 const char* kVlogs[] = {
62 "/path/to/foo.cc", 63 "/path/to/foo.cc",
63 "C:\\path\\to\\bar.h", 64 "C:\\path\\to\\bar.h",
64 "/path/to/not-matched.mm", 65 "/path/to/not-matched.mm",
65 "C:\\path\\to\\baz-inl.mm", 66 "C:\\path\\to\\baz-inl.mm",
66 "C:\\path\\to\\qux.mm", 67 "C:\\path\\to\\qux.mm",
67 "/path/to/quux.mm", 68 "/path/to/quux.mm",
68 "/path/to/another-not-matched.mm", 69 "/path/to/another-not-matched.mm",
69 }; 70 };
70 const int kVlogCount = arraysize(kVlogs); 71 const int kVlogCount = arraysize(kVlogs);
72 const int kBenchmarkIterations = RunningOnValgrind() ? 30000 : 10000000;
71 73
72 base::TimeDelta null_elapsed; 74 base::TimeDelta null_elapsed;
73 { 75 {
74 VlogInfo null_vlog_info("", ""); 76 VlogInfo null_vlog_info("", "");
75 BENCHMARK(10000000, null_elapsed, { 77 BENCHMARK(kBenchmarkIterations, null_elapsed, {
76 EXPECT_NE(-1, null_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount])); 78 EXPECT_NE(-1, null_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount]));
77 }); 79 });
78 } 80 }
79 81
80 { 82 {
81 VlogInfo small_vlog_info("0", "foo=1,bar=2,baz=3,qux=4,quux=5"); 83 VlogInfo small_vlog_info("0", "foo=1,bar=2,baz=3,qux=4,quux=5");
82 base::TimeDelta elapsed; 84 base::TimeDelta elapsed;
83 BENCHMARK(10000000, elapsed, { 85 BENCHMARK(kBenchmarkIterations, elapsed, {
84 EXPECT_NE(-1, small_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount])); 86 EXPECT_NE(-1, small_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount]));
85 }); 87 });
86 LOG(INFO) << "slowdown = " << GetSlowdown(null_elapsed, elapsed) 88 LOG(INFO) << "slowdown = " << GetSlowdown(null_elapsed, elapsed)
87 << "x"; 89 << "x";
88 } 90 }
89 91
90 { 92 {
91 VlogInfo pattern_vlog_info("0", "fo*=1,ba?=2,b*?z=3,*ux=4,?uux=5"); 93 VlogInfo pattern_vlog_info("0", "fo*=1,ba?=2,b*?z=3,*ux=4,?uux=5");
92 base::TimeDelta elapsed; 94 base::TimeDelta elapsed;
93 BENCHMARK(10000000, elapsed, { 95 BENCHMARK(kBenchmarkIterations, elapsed, {
94 EXPECT_NE(-1, pattern_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount])); 96 EXPECT_NE(-1, pattern_vlog_info.GetVlogLevel(kVlogs[i % kVlogCount]));
95 }); 97 });
96 LOG(INFO) << "slowdown = " << GetSlowdown(null_elapsed, elapsed) 98 LOG(INFO) << "slowdown = " << GetSlowdown(null_elapsed, elapsed)
97 << "x"; 99 << "x";
98 } 100 }
99 } 101 }
100 102
101 #undef BENCHMARK 103 #undef BENCHMARK
102 104
103 } // namespace 105 } // namespace
104 106
105 } // namespace logging 107 } // namespace logging
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698