| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef BENCH_GL_MAIN_H_ | 5 #ifndef BENCH_GL_MAIN_H_ |
| 6 #define BENCH_GL_MAIN_H_ | 6 #define BENCH_GL_MAIN_H_ |
| 7 | 7 |
| 8 #include <sys/time.h> | 8 #include <sys/time.h> |
| 9 | 9 |
| 10 #ifdef USE_GLES | 10 #ifdef USE_GLES |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void DestroyContext(); | 59 void DestroyContext(); |
| 60 void SwapBuffers(); | 60 void SwapBuffers(); |
| 61 bool SwapInterval(int interval); | 61 bool SwapInterval(int interval); |
| 62 | 62 |
| 63 // BenchFunc functions are assumed to execute an operation iter times. See | 63 // BenchFunc functions are assumed to execute an operation iter times. See |
| 64 // Bench for a detailed explanation. | 64 // Bench for a detailed explanation. |
| 65 typedef void (*BenchFunc)(int iter); | 65 typedef void (*BenchFunc)(int iter); |
| 66 | 66 |
| 67 uint64_t TimeBench(BenchFunc func, int iter); | 67 uint64_t TimeBench(BenchFunc func, int iter); |
| 68 | 68 |
| 69 // This size is for a window that is very large but will fit on all |
| 70 // the displays we care about. |
| 71 #define WINDOW_WIDTH 512 |
| 72 #define WINDOW_HEIGHT 512 |
| 73 |
| 69 #define MAX_ITERATION_DURATION_MS 100000 | 74 #define MAX_ITERATION_DURATION_MS 100000 |
| 70 // Runs func passing it sequential powers of two (8, 16, 32,...) recording time | 75 // Runs func passing it sequential powers of two (8, 16, 32,...) recording time |
| 71 // it took. The data is then fitted linearly, obtaining slope and bias such | 76 // it took. The data is then fitted linearly, obtaining slope and bias such |
| 72 // that: | 77 // that: |
| 73 // time it took to run x iterations = slope * x + bias | 78 // time it took to run x iterations = slope * x + bias |
| 74 // Returns false if one iteration of the test takes longer than | 79 // Returns false if one iteration of the test takes longer than |
| 75 // MAX_ITERATION_LENGTH_MS. The test is then assumed too slow to provide | 80 // MAX_ITERATION_LENGTH_MS. The test is then assumed too slow to provide |
| 76 // meaningful results. | 81 // meaningful results. |
| 77 bool Bench(BenchFunc func, float *slope, int64_t *bias); | 82 bool Bench(BenchFunc func, float *slope, int64_t *bias); |
| 78 | 83 |
| 79 void *MmapFile(const char *name, size_t *length); | 84 void *MmapFile(const char *name, size_t *length); |
| 80 | 85 |
| 81 #endif // BENCH_GL_MAIN_H_ | 86 #endif // BENCH_GL_MAIN_H_ |
| OLD | NEW |