OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include <time.h> | 8 #include <time.h> |
9 #include <dirent.h> | 9 #include <dirent.h> |
10 #include <glob.h> | 10 #include <glob.h> |
11 #include "SkOSFile.h" | 11 #include "SkOSFile.h" |
12 #include "skpdiff_util.h" | 12 #include "skpdiff_util.h" |
13 | 13 |
| 14 #if SK_SUPPORT_OPENCL |
14 const char* cl_error_to_string(cl_int err) { | 15 const char* cl_error_to_string(cl_int err) { |
15 switch (err) { | 16 switch (err) { |
16 case CL_SUCCESS: return "CL_SUCCESS"; | 17 case CL_SUCCESS: return "CL_SUCCESS"; |
17 case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND"; | 18 case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND"; |
18 case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE
"; | 19 case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE
"; |
19 case CL_COMPILER_NOT_AVAILABLE: return "CL_COMPILER_NOT_AVAILAB
LE"; | 20 case CL_COMPILER_NOT_AVAILABLE: return "CL_COMPILER_NOT_AVAILAB
LE"; |
20 case CL_MEM_OBJECT_ALLOCATION_FAILURE: return "CL_MEM_OBJECT_ALLOCATIO
N_FAILURE"; | 21 case CL_MEM_OBJECT_ALLOCATION_FAILURE: return "CL_MEM_OBJECT_ALLOCATIO
N_FAILURE"; |
21 case CL_OUT_OF_RESOURCES: return "CL_OUT_OF_RESOURCES"; | 22 case CL_OUT_OF_RESOURCES: return "CL_OUT_OF_RESOURCES"; |
22 case CL_OUT_OF_HOST_MEMORY: return "CL_OUT_OF_HOST_MEMORY"; | 23 case CL_OUT_OF_HOST_MEMORY: return "CL_OUT_OF_HOST_MEMORY"; |
23 case CL_PROFILING_INFO_NOT_AVAILABLE: return "CL_PROFILING_INFO_NOT_A
VAILABLE"; | 24 case CL_PROFILING_INFO_NOT_AVAILABLE: return "CL_PROFILING_INFO_NOT_A
VAILABLE"; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 case CL_INVALID_EVENT_WAIT_LIST: return "CL_INVALID_EVENT_WAIT_L
IST"; | 57 case CL_INVALID_EVENT_WAIT_LIST: return "CL_INVALID_EVENT_WAIT_L
IST"; |
57 case CL_INVALID_EVENT: return "CL_INVALID_EVENT"; | 58 case CL_INVALID_EVENT: return "CL_INVALID_EVENT"; |
58 case CL_INVALID_OPERATION: return "CL_INVALID_OPERATION"; | 59 case CL_INVALID_OPERATION: return "CL_INVALID_OPERATION"; |
59 case CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT"; | 60 case CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT"; |
60 case CL_INVALID_BUFFER_SIZE: return "CL_INVALID_BUFFER_SIZE"
; | 61 case CL_INVALID_BUFFER_SIZE: return "CL_INVALID_BUFFER_SIZE"
; |
61 case CL_INVALID_MIP_LEVEL: return "CL_INVALID_MIP_LEVEL"; | 62 case CL_INVALID_MIP_LEVEL: return "CL_INVALID_MIP_LEVEL"; |
62 default: return "UNKNOWN"; | 63 default: return "UNKNOWN"; |
63 } | 64 } |
64 return "UNKNOWN"; | 65 return "UNKNOWN"; |
65 } | 66 } |
| 67 #endif |
66 | 68 |
67 | 69 |
68 double get_seconds() { | 70 double get_seconds() { |
69 struct timespec currentTime; | 71 struct timespec currentTime; |
70 clock_gettime(CLOCK_REALTIME, ¤tTime); | 72 clock_gettime(CLOCK_REALTIME, ¤tTime); |
71 return currentTime.tv_sec + (double)currentTime.tv_nsec / 1e9; | 73 return currentTime.tv_sec + (double)currentTime.tv_nsec / 1e9; |
72 } | 74 } |
73 | 75 |
74 bool get_directory(const char path[], SkTArray<SkString>* entries) { | 76 bool get_directory(const char path[], SkTArray<SkString>* entries) { |
75 // Open the directory and check for success | 77 // Open the directory and check for success |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 char** paths = globBuffer.gl_pathv; | 110 char** paths = globBuffer.gl_pathv; |
109 while(NULL != *paths) { | 111 while(NULL != *paths) { |
110 entries->push_back(SkString(*paths)); | 112 entries->push_back(SkString(*paths)); |
111 paths++; | 113 paths++; |
112 } | 114 } |
113 | 115 |
114 globfree(&globBuffer); | 116 globfree(&globBuffer); |
115 | 117 |
116 return true; | 118 return true; |
117 } | 119 } |
OLD | NEW |