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

Side by Side Diff: third_party/re2/util/benchmark.h

Issue 10575037: Include RE2 library (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Less intrusive fix for Android Created 8 years, 4 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 | « third_party/re2/util/atomicops.h ('k') | third_party/re2/util/benchmark.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2009 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #ifndef RE2_UTIL_BENCHMARK_H__
6 #define RE2_UTIL_BENCHMARK_H__
7
8 namespace testing {
9 struct Benchmark {
10 const char* name;
11 void (*fn)(int);
12 void (*fnr)(int, int);
13 int lo;
14 int hi;
15 int threadlo;
16 int threadhi;
17
18 void Register();
19 Benchmark(const char* name, void (*f)(int)) { Clear(name); fn = f; Register(); }
20 Benchmark(const char* name, void (*f)(int, int), int l, int h) { Clear(name); fnr = f; lo = l; hi = h; Register(); }
21 void Clear(const char* n) { name = n; fn = 0; fnr = 0; lo = 0; hi = 0; threadl o = 0; threadhi = 0; }
22 Benchmark* ThreadRange(int lo, int hi) { threadlo = lo; threadhi = hi; return this; }
23 };
24 } // namespace testing
25
26 void SetBenchmarkBytesProcessed(long long);
27 void StopBenchmarkTiming();
28 void StartBenchmarkTiming();
29 void BenchmarkMemoryUsage();
30 void SetBenchmarkItemsProcessed(int);
31
32 int NumCPUs();
33
34 #define BENCHMARK(f) \
35 ::testing::Benchmark* _benchmark_##f = (new ::testing::Benchmark(#f, f))
36
37 #define BENCHMARK_RANGE(f, lo, hi) \
38 ::testing::Benchmark* _benchmark_##f = \
39 (new ::testing::Benchmark(#f, f, lo, hi))
40
41 #endif // RE2_UTIL_BENCHMARK_H__
OLDNEW
« no previous file with comments | « third_party/re2/util/atomicops.h ('k') | third_party/re2/util/benchmark.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698