29#include <qtextstream.h>
35#include "opencv2/opencv.hpp"
37#include "DataObject\dataobj.h"
38#include "common/typeDefs.h"
39#include "common/color.h"
44 double freq = cv::getTickFrequency();
50 start = cv::getTickCount();
53 for(
int i=0;i<size;i++)
59 end = cv::getTickCount();
60 qDebug() <<
"time: " << (end-start)/freq;
62 start = cv::getTickCount();
63 int* a2 =
new int[size];
64 for(
int i=0;i<size;i++)
70 end = cv::getTickCount();
71 qDebug() <<
"time: " << (end-start)/freq;
76 qDebug(
"benchmarkTest2");
78 double freq = cv::getTickFrequency();
82 int *test = (
int*)(
new cv::Mat());
86 start = cv::getTickCount();
87 for(
int i=0;i<size;i++)
90 end = cv::getTickCount();
91 qDebug() <<
"time: " << (end-start)/freq;
93 start = cv::getTickCount();
94 for(
int i=0;i<size;i++)
98 end = cv::getTickCount();
99 qDebug() <<
"time: " << (end-start)/freq;
101 start = cv::getTickCount();
102 for(
int i=0;i<size;i++)
104 ptr =
reinterpret_cast<cv::Mat*
>(test);
106 end = cv::getTickCount();
107 qDebug() <<
"time: " << (end-start)/freq;
117 qDebug(
"benchmarkTest3");
119 double freq = cv::getTickFrequency();
121 start = cv::getTickCount();
123 end = cv::getTickCount();
124 qDebug() <<
"time: " << (end-start)/freq;
126 start = cv::getTickCount();
128 end = cv::getTickCount();
129 qDebug() <<
"time: " << (end-start)/freq;
131 start = cv::getTickCount();
133 end = cv::getTickCount();
134 qDebug() <<
"time: " << (end-start)/freq;
136 start = cv::getTickCount();
138 end = cv::getTickCount();
139 qDebug() <<
"time: " << (end-start)/freq;
147 double freq = cv::getTickFrequency();
148 QString str1 =
"guten tag kih ihiu oiuziuzt iztfzutfu iztuztriuz iuztiuztiuztzutut";
149 QString str2 =
"guten tag kih ihiu oiuziuzt iztfzutfu iztuztriuz iuztiuztiuztzutut";
150 QByteArray ba1 = str1.toLatin1();
151 QByteArray ba2 = str2.toLatin1();
152 char *c1 = ba1.data();
153 char *c2 = ba2.data();
156 size_t size =
sizeof(char) * std::min( strlen(c1),strlen(c2));
158 qDebug() <<
"benchmarkTest4: " << num;
160 start = cv::getTickCount();
161 for(
int i = 0; i< num;i++)
163 if(str1 == str2) {c++;}
else{c--;}
165 end = cv::getTickCount();
166 qDebug() <<
"time: " << (end-start)/freq <<
" result: " << c;
168 start = cv::getTickCount();
169 for(
int i = 0; i< num;i++)
171 if(ba1 == ba2) {c++;}
else{c--;}
173 end = cv::getTickCount();
174 qDebug() <<
"time: " << (end-start)/freq <<
" result: " << c;
176 start = cv::getTickCount();
177 for(
int i = 0; i< num;i++)
179 if(strcmp(c1,c2)) {c++;}
else{c--;}
181 end = cv::getTickCount();
182 qDebug() <<
"time: " << (end-start)/freq <<
" result: " << c;
184 start = cv::getTickCount();
185 for(
int i = 0; i< num;i++)
187 if(memcmp(c1,c2,size)) {c++;}
else{c--;}
189 end = cv::getTickCount();
190 qDebug() <<
"time: " << (end-start)/freq <<
" result: " << c;
200 qDebug(
"benchmarkTest5");
202 double freq = cv::getTickFrequency();
205 start = cv::getTickCount();
206 for (
size_t i = 0 ; i < 1000000; i++)
210 end = cv::getTickCount();
211 qDebug() <<
"time: " << (end-start)/freq;
214 start = cv::getTickCount();
215 for (
size_t i = 0 ; i < 1000000; ++i)
219 end = cv::getTickCount();
220 qDebug() <<
"time: " << (end-start)/freq;
244void benchmarkTestColor()
247 double freq = cv::getTickFrequency();
252 start = cv::getTickCount();
253 for (
size_t i = 0 ; i < 1000000; i++)
257 end = cv::getTickCount();
258 qDebug() <<
"time: " << (end-start)/freq;
260 start = cv::getTickCount();
261 for (
size_t i = 0 ; i < 1000000; i++)
265 end = cv::getTickCount();
266 qDebug() <<
"time: " << (end-start)/freq;
268 start = cv::getTickCount();
269 for (
size_t i = 0 ; i < 1000000; i++)
273 end = cv::getTickCount();
274 qDebug() <<
"time: " << (end-start)/freq;
276 for (
size_t i = 0 ; i < 1000000; i++)
278 unsigned int argb = c2.
argb();
281 end = cv::getTickCount();
282 qDebug() <<
"time: " << (end-start)/freq;
286 start = cv::getTickCount();
287 for (
size_t i = 0 ; i < 1000000; i++)
291 end = cv::getTickCount();
292 qDebug() <<
"time: " << (end-start)/freq;
295 start = cv::getTickCount();
296 for (
size_t i = 0 ; i < 1000000; i++)
303 end = cv::getTickCount();
304 qDebug() <<
"time: " << (end-start)/freq;
306 start = cv::getTickCount();
308 for (
size_t i = 0 ; i < 1000000; i++)
312 end = cv::getTickCount();
313 qDebug() <<
"time: " << (end-start)/freq;
315 start = cv::getTickCount();
316 for (
size_t i = 0 ; i < 1000000; i++)
318 unsigned int argb = d2.rgba;
321 end = cv::getTickCount();
322 qDebug() <<
"time: " << (end-start)/freq;
325 qDebug() <<
"array construction";
326 start = cv::getTickCount();
328 end = cv::getTickCount();
329 qDebug() <<
"time: " << (end-start)/freq;
331 start = cv::getTickCount();
333 end = cv::getTickCount();
334 qDebug() <<
"time: " << (end-start)/freq;
336 start = cv::getTickCount();
337 ito::uint32 h3[100000];
338 end = cv::getTickCount();
339 qDebug() <<
"time: " << (end-start)/freq;
342void dataObjectDStackMemoryLeak()
344 for (
int i = 0; i < 100; ++i)
346 qDebug() <<
"round " << i;
349 for (
int i = 0; i < n; ++i)
361 qDebug() <<
"round " << i <<
" finished";
367void startBenchmarks()
374 benchmarkTestColor();
dataObject contains a n-dimensional matrix
Definition dataobj.h:591
static DataObject stack(const DataObject *mats, int num, unsigned int axis=0)
returns a stack of multiple dataObjects (number is equal to num) along the given axis (default: 0).
Definition dataobj.cpp:10245
This class implements basic functionality for color handling in itom. \detail This class implements A...
Definition color.h:47
uint32 & argb()
Definition color.h:250
@ tFloat32
Definition typeDefs.h:95
@ tFloat64
Definition typeDefs.h:96
Definition benchmarks.h:224