| 135 | } |
| 136 | |
| 137 | template <typename M> void |
| 138 | ImagesClass<M>::images() |
| 139 | { |
| 140 | cl_int err; |
| 141 | int i= 6; |
| 142 | int iMax = 30; |
| 143 | nano_time_t maxTime = 1000; |
| 144 | nano_time_t minTime = 100; |
| 145 | bool next = true; |
| 146 | |
| 147 | do { |
| 148 | nano_time_t time; |
| 149 | |
| 150 | metod.initDefault(256*i, 1); |
| 151 | bool b = generateData(); |
| 152 | ASSERT_EQ(b, true) << "generateData()"; |
| 153 | setImplementation(I_BUFERS); |
| 154 | metod.initOutEvent(); |
| 155 | time = runRepeat(2, &err); |
| 156 | ASSERT_EQ(err, CL_SUCCESS) << "clFinish()"; |
| 157 | //std::cerr << "size = " << 256*i << "/" << i << " time = " << conv2millisec(time) << std::endl; |
| 158 | if (conv2millisec(time) < minTime) { |
| 159 | i += (((int)minTime - (int)conv2millisec(time)) /20) + 1; |
| 160 | metod.destroy(); |
| 161 | continue; |
| 162 | } |
| 163 | if (conv2millisec(time) > maxTime) { |
| 164 | i = iMax; |
| 165 | metod.destroy(); |
| 166 | continue; |
| 167 | } |
| 168 | next = false; |
| 169 | |
| 170 | nano_time_t time1 = runRepeat(5, &err); |
| 171 | ASSERT_EQ(err, CL_SUCCESS) << "clFinish()"; |
| 172 | |
| 173 | setImplementation(I_IMAGES); |
| 174 | |
| 175 | nano_time_t time2 = runRepeat(5, &err); |
| 176 | ASSERT_EQ(err, CL_SUCCESS) << "clFinish()"; |
| 177 | |
| 178 | setImplementation(I_DEFAULT); |
| 179 | |
| 180 | //nano_time_t time3 = runRepeat(5, & err); |
| 181 | //ASSERT_EQ(err, CL_SUCCESS) << "clFinish()"; |
| 182 | |
| 183 | double d = (double)(time1) / time2; |
| 184 | std::cerr << "size = " << 256*i |
| 185 | << " timeBufer = " << conv2millisec(time1) |
| 186 | << " timeImage = " << conv2millisec(time2) |
| 187 | << " t1/t2 = " << d << std::endl; |
| 188 | |
| 189 | if (d < 1.2) { |
| 190 | next = true; |
| 191 | i++; |
| 192 | } |
| 193 | metod.destroy(); |
| 194 |
no test coverage detected