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 <gflags/gflags.h> |
8 #include <sys/time.h> | 9 #include <sys/time.h> |
9 | 10 |
10 #ifdef USE_GLES | 11 #ifdef USE_GLES |
11 #include <EGL/egl.h> | 12 #include <EGL/egl.h> |
12 #include <GLES/gl.h> | 13 #include <GLES/gl.h> |
13 #else | 14 #else |
14 #include <GL/gl.h> | 15 #include <GL/gl.h> |
15 #include <GL/glx.h> | 16 #include <GL/glx.h> |
16 | 17 |
17 #define LIST_PROC_FUNCTIONS(F) \ | 18 #define LIST_PROC_FUNCTIONS(F) \ |
(...skipping 27 matching lines...) Expand all Loading... |
45 | 46 |
46 inline uint64_t GetUTime() { | 47 inline uint64_t GetUTime() { |
47 struct timeval tv; | 48 struct timeval tv; |
48 gettimeofday(&tv, NULL); | 49 gettimeofday(&tv, NULL); |
49 return static_cast<uint64_t>(tv.tv_usec) + | 50 return static_cast<uint64_t>(tv.tv_usec) + |
50 1000000ULL*static_cast<uint64_t>(tv.tv_sec); | 51 1000000ULL*static_cast<uint64_t>(tv.tv_sec); |
51 } | 52 } |
52 | 53 |
53 extern GLint g_width; | 54 extern GLint g_width; |
54 extern GLint g_height; | 55 extern GLint g_height; |
55 extern bool g_override_redirect; | 56 DECLARE_bool(override_redirect); |
56 | 57 |
57 bool Init(); | 58 bool Init(); |
58 bool InitContext(); | 59 bool InitContext(); |
59 void DestroyContext(); | 60 void DestroyContext(); |
60 void SwapBuffers(); | 61 void SwapBuffers(); |
61 bool SwapInterval(int interval); | 62 bool SwapInterval(int interval); |
62 | 63 |
63 // BenchFunc functions are assumed to execute an operation iter times. See | 64 // BenchFunc functions are assumed to execute an operation iter times. See |
64 // Bench for a detailed explanation. | 65 // Bench for a detailed explanation. |
65 typedef void (*BenchFunc)(int iter); | 66 typedef void (*BenchFunc)(int iter); |
(...skipping 11 matching lines...) Expand all Loading... |
77 // that: | 78 // that: |
78 // time it took to run x iterations = slope * x + bias | 79 // time it took to run x iterations = slope * x + bias |
79 // Returns false if one iteration of the test takes longer than | 80 // Returns false if one iteration of the test takes longer than |
80 // MAX_ITERATION_LENGTH_MS. The test is then assumed too slow to provide | 81 // MAX_ITERATION_LENGTH_MS. The test is then assumed too slow to provide |
81 // meaningful results. | 82 // meaningful results. |
82 bool Bench(BenchFunc func, float *slope, int64_t *bias); | 83 bool Bench(BenchFunc func, float *slope, int64_t *bias); |
83 | 84 |
84 void *MmapFile(const char *name, size_t *length); | 85 void *MmapFile(const char *name, size_t *length); |
85 | 86 |
86 #endif // BENCH_GL_MAIN_H_ | 87 #endif // BENCH_GL_MAIN_H_ |
OLD | NEW |