1 // Created on: 2002-05-15
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef QANCollection_PerfArrays_HeaderFile
17 #define QANCollection_PerfArrays_HeaderFile
19 #define PERF_ENABLE_METERS
20 #include <OSD_PerfMeter.hxx>
21 ////////////////////////////////#include <Perf_Meter.hxx>
22 #include <TColgp_Array1OfPnt.hxx>
23 #include <TColgp_Array2OfPnt.hxx>
25 // ===================== Test perform of Array1 type ==========================
26 void CompArray1 (const Standard_Integer theRep,
27 const Standard_Integer theSize)
31 ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array1 creation",0);
32 ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array1 creation",0);
33 ////////////////////////////////Perf_Meter aNFill ("NCollection_Array1 filling",0);
34 ////////////////////////////////Perf_Meter aTFill ("TCollection_Array1 filling",0);
35 ////////////////////////////////Perf_Meter aNFind ("NCollection_Array1 finding",0);
36 ////////////////////////////////Perf_Meter aTFind ("TCollection_Array1 finding",0);
37 ////////////////////////////////Perf_Meter aNOper ("NCollection_Array1 operator=",0);
38 ////////////////////////////////Perf_Meter aTOper ("TCollection_Array1 operator=",0);
39 ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array1 Assign",0);
40 for (i=0; i<theRep; i++)
42 ////////////////////////////////aNCrea.Start();
43 PERF_START_METER("NCollection_Array1 creation")
44 ////////////////////////////////QANCollection_Array1 a1(1,theSize), a2(1,theSize);
45 QANCollection_Array1Perf a1(1,theSize), a2(1,theSize);
46 ////////////////////////////////aNCrea.Stop();
47 PERF_STOP_METER("NCollection_Array1 creation")
48 ////////////////////////////////aNFill.Start();
49 PERF_START_METER("NCollection_Array1 filling")
50 for (j=1; j<=theSize; j++)
52 ////////////////////////////////aNFill.Stop();
53 PERF_STOP_METER("NCollection_Array1 filling")
54 ////////////////////////////////aNFind.Start();
55 PERF_START_METER("NCollection_Array1 finding")
56 for (j=1; j<=theSize; j++)
58 Standard_Integer iIndex;
59 Random(iIndex,theSize);
62 ////////////////////////////////aNFind.Stop();
63 PERF_STOP_METER("NCollection_Array1 finding")
64 ////////////////////////////////aNOper.Start();
65 PERF_START_METER("NCollection_Array1 operator=")
67 ////////////////////////////////aNOper.Stop();
68 PERF_STOP_METER("NCollection_Array1 operator=")
69 ////////////////////////////////aNAssi.Start();
70 PERF_START_METER("NCollection_Array1 Assign")
72 ////////////////////////////////aNAssi.Stop();
73 PERF_STOP_METER("NCollection_Array1 Assign")
76 for (i=0; i<theRep; i++)
78 ////////////////////////////////aTCrea.Start();
79 PERF_START_METER("TCollection_Array1 creation")
80 TColgp_Array1OfPnt a1(1,theSize), a2(1,theSize);
81 ////////////////////////////////aTCrea.Stop();
82 PERF_STOP_METER("TCollection_Array1 creation")
83 ////////////////////////////////aTFill.Start();
84 PERF_START_METER("TCollection_Array1 filling")
85 for (j=1; j<=theSize; j++)
87 ////////////////////////////////aTFill.Stop();
88 PERF_STOP_METER("TCollection_Array1 filling")
89 ////////////////////////////////aTFind.Start();
90 PERF_START_METER("TCollection_Array1 finding")
91 for (j=1; j<=theSize; j++)
93 Standard_Integer iIndex;
94 Random(iIndex,theSize);
97 ////////////////////////////////aTFind.Stop();
98 PERF_STOP_METER("TCollection_Array1 finding")
99 ////////////////////////////////aTOper.Start();
100 PERF_START_METER("TCollection_Array1 operator=")
102 ////////////////////////////////aTOper.Stop();
103 PERF_STOP_METER("TCollection_Array1 operator=")
108 // ===================== Test perform of Array2 type ==========================
109 void CompArray2 (const Standard_Integer theRep,
110 const Standard_Integer theSize)
112 Standard_Integer i,j,k;
114 ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array2 creation",0);
115 ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array2 creation",0);
116 ////////////////////////////////Perf_Meter aNFill ("NCollection_Array2 filling",0);
117 ////////////////////////////////Perf_Meter aTFill ("TCollection_Array2 filling",0);
118 ////////////////////////////////Perf_Meter aNFind ("NCollection_Array2 finding",0);
119 ////////////////////////////////Perf_Meter aTFind ("TCollection_Array2 finding",0);
120 ////////////////////////////////Perf_Meter aNOper ("NCollection_Array2 operator=",0);
121 ////////////////////////////////Perf_Meter aTOper ("TCollection_Array2 operator=",0);
122 ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array2 Assign",0);
123 for (i=0; i<theRep; i++)
125 ////////////////////////////////aNCrea.Start();
126 PERF_START_METER("NCollection_Array2 creation")
127 ////////////////////////////////QANCollection_Array2 a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
128 QANCollection_Array2Perf a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
129 ////////////////////////////////aNCrea.Stop();
130 PERF_STOP_METER("NCollection_Array2 creation")
131 ////////////////////////////////aNFill.Start();
132 PERF_START_METER("NCollection_Array2 filling")
133 for (j=1; j<=theSize; j++)
134 for (k=1; k<=theSize; k++)
136 ////////////////////////////////aNFill.Stop();
137 PERF_STOP_METER("NCollection_Array2 filling")
138 ////////////////////////////////aNFind.Start();
139 PERF_START_METER("NCollection_Array2 finding")
140 for (j=1; j<=theSize*theSize; j++)
142 Standard_Integer m,n;
147 ////////////////////////////////aNFind.Stop();
148 PERF_STOP_METER("NCollection_Array2 finding")
149 ////////////////////////////////aNOper.Start();
150 PERF_START_METER("NCollection_Array2 operator=")
152 ////////////////////////////////aNOper.Stop();
153 PERF_STOP_METER("NCollection_Array2 operator=")
154 ////////////////////////////////aNAssi.Start();
155 PERF_START_METER("NCollection_Array2 Assign")
157 ////////////////////////////////aNAssi.Stop();
158 PERF_STOP_METER("NCollection_Array2 Assign")
161 for (i=0; i<theRep; i++)
163 ////////////////////////////////aTCrea.Start();
164 PERF_START_METER("TCollection_Array2 creation")
165 TColgp_Array2OfPnt a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
166 ////////////////////////////////aTCrea.Stop();
167 PERF_STOP_METER("TCollection_Array2 creation")
168 ////////////////////////////////aTFill.Start();
169 PERF_START_METER("TCollection_Array2 filling")
170 for (j=1; j<=theSize; j++)
171 for (k=1; k<=theSize; k++)
173 ////////////////////////////////aTFill.Stop();
174 PERF_STOP_METER("TCollection_Array2 filling")
175 ////////////////////////////////aTFind.Start();
176 PERF_START_METER("TCollection_Array2 finding")
177 for (j=1; j<=theSize*theSize; j++)
179 Standard_Integer m,n;
184 ////////////////////////////////aTFind.Stop();
185 PERF_STOP_METER("TCollection_Array2 finding")
186 ////////////////////////////////aTOper.Start();
187 PERF_START_METER("TCollection_Array2 operator=")
189 ////////////////////////////////aTOper.Stop();
190 PERF_STOP_METER("TCollection_Array2 operator=")