| OLD | NEW |
| 1 // Copyright 2014 The Native Client Authors. All rights reserved. | 1 // Copyright 2014 The Native Client 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| 11 #include <stdlib.h> | 11 #include <stdlib.h> |
| 12 #include <sys/time.h> | 12 #include <sys/time.h> |
| 13 | 13 |
| 14 // @EXEMPTION[include] | 14 #include "native_client/tests/benchmark/framework.h" |
| 15 #include "./framework.h" | |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 timeval start_tv; | 18 timeval start_tv; |
| 20 int start_tv_retv = gettimeofday(&start_tv, NULL); | 19 int start_tv_retv = gettimeofday(&start_tv, NULL); |
| 21 | 20 |
| 22 // Timer helper for benchmarking. | 21 // Timer helper for benchmarking. |
| 23 double getseconds() { | 22 double getseconds() { |
| 24 const double usec_to_sec = 0.000001; | 23 const double usec_to_sec = 0.000001; |
| 25 timeval tv; | 24 timeval tv; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 printf("RESULT Benchmark%s: %s= {%.6f, %.6f} seconds\n", | 67 printf("RESULT Benchmark%s: %s= {%.6f, %.6f} seconds\n", |
| 69 name.c_str(), description, median, range); | 68 name.c_str(), description, median, range); |
| 70 printf("---------------------------------------------------------------\n"); | 69 printf("---------------------------------------------------------------\n"); |
| 71 // Invoke an optional callback on each benchmark. | 70 // Invoke an optional callback on each benchmark. |
| 72 if (callback) | 71 if (callback) |
| 73 callback(Benchmarks()[i], median, range, data); | 72 callback(Benchmarks()[i], median, range, data); |
| 74 } | 73 } |
| 75 printf("Done running benchmark suite.\n"); | 74 printf("Done running benchmark suite.\n"); |
| 76 return ret; | 75 return ret; |
| 77 } | 76 } |
| OLD | NEW |