diff options
author | Elliott Hughes <enh@google.com> | 2014-06-11 23:34:40 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-10 22:15:14 +0000 |
commit | 2c02d0057c93bfa6db4b30d8646baeb55d076062 (patch) | |
tree | aeb8ab061f8c6ab737bc1fc07a2aebf55b4ef900 /benchmarks | |
parent | ab66d360bc6f543b6c26400067e50db3134798e1 (diff) | |
parent | b27a840f4b520bfa095db99b0a2e5205634b0003 (diff) | |
download | android_bionic-2c02d0057c93bfa6db4b30d8646baeb55d076062.tar.gz android_bionic-2c02d0057c93bfa6db4b30d8646baeb55d076062.tar.bz2 android_bionic-2c02d0057c93bfa6db4b30d8646baeb55d076062.zip |
Merge "Add __pure2 to a few more functions, most notably gettid and pthread_self."
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/pthread_benchmark.cpp | 5 | ||||
-rw-r--r-- | benchmarks/unistd_benchmark.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/benchmarks/pthread_benchmark.cpp b/benchmarks/pthread_benchmark.cpp index 621fcb624..c010dd2c0 100644 --- a/benchmarks/pthread_benchmark.cpp +++ b/benchmarks/pthread_benchmark.cpp @@ -18,11 +18,14 @@ #include <pthread.h> +// Stop GCC optimizing out our pure function. +/* Must not be static! */ pthread_t (*pthread_self_fp)() = pthread_self; + static void BM_pthread_self(int iters) { StartBenchmarkTiming(); for (int i = 0; i < iters; ++i) { - pthread_self(); + pthread_self_fp(); } StopBenchmarkTiming(); diff --git a/benchmarks/unistd_benchmark.cpp b/benchmarks/unistd_benchmark.cpp index f2c9d73cf..c35e7c369 100644 --- a/benchmarks/unistd_benchmark.cpp +++ b/benchmarks/unistd_benchmark.cpp @@ -30,11 +30,14 @@ static void BM_unistd_getpid(int iters) { } BENCHMARK(BM_unistd_getpid); +// Stop GCC optimizing out our pure function. +/* Must not be static! */ pid_t (*gettid_fp)() = gettid; + static void BM_unistd_gettid(int iters) { StartBenchmarkTiming(); for (int i = 0; i < iters; ++i) { - gettid(); + gettid_fp(); } StopBenchmarkTiming(); |