| 131 | //------------------------------------------------------------------------------------------------- |
| 132 | template<class BenchableType> |
| 133 | void runbench(const char* szBenchname, BenchableType& cBenchable) |
| 134 | { |
| 135 | Libraries Libs[Libraries::NbLibs]; |
| 136 | |
| 137 | Libs[Libraries::CL].Available = true && cBenchable.HasCLTest(); |
| 138 | Libs[Libraries::NPP].Available = NPP_AVAILABLE && cBenchable.HasNPPTest(); |
| 139 | Libs[Libraries::IPP].Available = IPP_AVAILABLE; |
| 140 | Libs[Libraries::CV].Available = CV_AVAILABLE && cBenchable.HasCVTest(); |
| 141 | |
| 142 | for (int i = 0; i < Libraries::NbLibs; i++) |
| 143 | Libs[i].ID = (Libraries::ELibs) i; |
| 144 | |
| 145 | #ifndef FULL_TESTS |
| 146 | printf("%s", szBenchname); |
| 147 | for (int i = 0; i < Libraries::NbLibs; i++) |
| 148 | if (Libs[i].Available) |
| 149 | printf("\t%s\t", Libs[i].Name()); |
| 150 | |
| 151 | printf("\tComparison\n"); |
| 152 | #endif // FULL_TESTS |
| 153 | |
| 154 | for(uint i = 0; i < BENCH_COUNT; i++) |
| 155 | { |
| 156 | CTimer Timer; |
| 157 | |
| 158 | //Alloc the images and prepare the images |
| 159 | cBenchable.Create(BENCH_WIDTH[i], BENCH_HEIGHT[i]); |
| 160 | |
| 161 | if (Libs[Libraries::IPP].Available) |
| 162 | { |
| 163 | //Warm up the cache |
| 164 | cBenchable.RunIPP(); |
| 165 | |
| 166 | //Run a few times to bench |
| 167 | Timer.Start(); |
| 168 | for(uint j = 0; j < BENCH_ITERATIONS; j++) |
| 169 | { |
| 170 | cBenchable.RunIPP(); |
| 171 | } |
| 172 | Libs[Libraries::IPP].Time = Timer.Readms() / BENCH_ITERATIONS; |
| 173 | |
| 174 | Libs[Libraries::IPP].Success = true; // IPP is the reference - always consider it successful |
| 175 | } |
| 176 | |
| 177 | std::string Result = "Success"; |
| 178 | |
| 179 | if (Libs[Libraries::CL].Available) |
| 180 | { |
| 181 | //Build the program |
| 182 | cBenchable.RunCL(); |
| 183 | |
| 184 | //Warm the cache |
| 185 | cBenchable.RunCL(); |
| 186 | |
| 187 | ocipFinish(); |
| 188 | |
| 189 | //Run a few times to bench |
| 190 | Timer.Start(); |
nothing calls this directly
no test coverage detected