/
construct.cpp
1 #include "benchmark.h"
2
3 #include <QObject>
4 #include <QVector>
5
6 static QVector<QObject*> a;
7
8 extern "C" {
9
10 CL_SMOKE_BENCHMARK_EXPORT void
11 cl_smoke_benchmark_construct_setup(size_t iterations)
12 {
13 a.resize(iterations);
14 }
15
16 CL_SMOKE_BENCHMARK_EXPORT char
17 cl_smoke_benchmark_construct(size_t iterations)
18 {
19 Q_ASSERT(a.size() == iterations);
20
21 for (size_t i=0; i<iterations; i++)
22 a[i] = new QObject();
23 }
24
25 CL_SMOKE_BENCHMARK_EXPORT void
26 cl_smoke_benchmark_construct_cleanup(size_t iterations)
27 {
28 Q_ASSERT(a.size() == iterations);
29
30 for (size_t i=0; i<iterations; i++)
31 delete a[i];
32
33 a.clear();
34 }
35
36 }