1 // Created on: 2002-05-15
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #ifndef QANCollection_PerfArrays_HeaderFile
23 #define QANCollection_PerfArrays_HeaderFile
25 #define PERF_ENABLE_METERS
26 #include <OSD_PerfMeter.hxx>
27 ////////////////////////////////#include <Perf_Meter.hxx>
28 #include <TColgp_Array1OfPnt.hxx>
29 #include <TColgp_Array2OfPnt.hxx>
31 // ===================== Test perform of Array1 type ==========================
32 void CompArray1 (const Standard_Integer theRep,
33 const Standard_Integer theSize)
37 ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array1 creation",0);
38 ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array1 creation",0);
39 ////////////////////////////////Perf_Meter aNFill ("NCollection_Array1 filling",0);
40 ////////////////////////////////Perf_Meter aTFill ("TCollection_Array1 filling",0);
41 ////////////////////////////////Perf_Meter aNFind ("NCollection_Array1 finding",0);
42 ////////////////////////////////Perf_Meter aTFind ("TCollection_Array1 finding",0);
43 ////////////////////////////////Perf_Meter aNOper ("NCollection_Array1 operator=",0);
44 ////////////////////////////////Perf_Meter aTOper ("TCollection_Array1 operator=",0);
45 ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array1 Assign",0);
46 for (i=0; i<theRep; i++)
48 ////////////////////////////////aNCrea.Start();
49 PERF_START_METER("NCollection_Array1 creation")
50 ////////////////////////////////QANCollection_Array1 a1(1,theSize), a2(1,theSize);
51 QANCollection_Array1Perf a1(1,theSize), a2(1,theSize);
52 ////////////////////////////////aNCrea.Stop();
53 PERF_STOP_METER("NCollection_Array1 creation")
54 ////////////////////////////////aNFill.Start();
55 PERF_START_METER("NCollection_Array1 filling")
56 for (j=1; j<=theSize; j++)
58 ////////////////////////////////aNFill.Stop();
59 PERF_STOP_METER("NCollection_Array1 filling")
60 ////////////////////////////////aNFind.Start();
61 PERF_START_METER("NCollection_Array1 finding")
62 for (j=1; j<=theSize; j++)
64 Standard_Integer iIndex;
65 Random(iIndex,theSize);
68 ////////////////////////////////aNFind.Stop();
69 PERF_STOP_METER("NCollection_Array1 finding")
70 ////////////////////////////////aNOper.Start();
71 PERF_START_METER("NCollection_Array1 operator=")
73 ////////////////////////////////aNOper.Stop();
74 PERF_STOP_METER("NCollection_Array1 operator=")
75 ////////////////////////////////aNAssi.Start();
76 PERF_START_METER("NCollection_Array1 Assign")
78 ////////////////////////////////aNAssi.Stop();
79 PERF_STOP_METER("NCollection_Array1 Assign")
82 for (i=0; i<theRep; i++)
84 ////////////////////////////////aTCrea.Start();
85 PERF_START_METER("TCollection_Array1 creation")
86 TColgp_Array1OfPnt a1(1,theSize), a2(1,theSize);
87 ////////////////////////////////aTCrea.Stop();
88 PERF_STOP_METER("TCollection_Array1 creation")
89 ////////////////////////////////aTFill.Start();
90 PERF_START_METER("TCollection_Array1 filling")
91 for (j=1; j<=theSize; j++)
93 ////////////////////////////////aTFill.Stop();
94 PERF_STOP_METER("TCollection_Array1 filling")
95 ////////////////////////////////aTFind.Start();
96 PERF_START_METER("TCollection_Array1 finding")
97 for (j=1; j<=theSize; j++)
99 Standard_Integer iIndex;
100 Random(iIndex,theSize);
103 ////////////////////////////////aTFind.Stop();
104 PERF_STOP_METER("TCollection_Array1 finding")
105 ////////////////////////////////aTOper.Start();
106 PERF_START_METER("TCollection_Array1 operator=")
108 ////////////////////////////////aTOper.Stop();
109 PERF_STOP_METER("TCollection_Array1 operator=")
114 // ===================== Test perform of Array2 type ==========================
115 void CompArray2 (const Standard_Integer theRep,
116 const Standard_Integer theSize)
118 Standard_Integer i,j,k;
120 ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array2 creation",0);
121 ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array2 creation",0);
122 ////////////////////////////////Perf_Meter aNFill ("NCollection_Array2 filling",0);
123 ////////////////////////////////Perf_Meter aTFill ("TCollection_Array2 filling",0);
124 ////////////////////////////////Perf_Meter aNFind ("NCollection_Array2 finding",0);
125 ////////////////////////////////Perf_Meter aTFind ("TCollection_Array2 finding",0);
126 ////////////////////////////////Perf_Meter aNOper ("NCollection_Array2 operator=",0);
127 ////////////////////////////////Perf_Meter aTOper ("TCollection_Array2 operator=",0);
128 ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array2 Assign",0);
129 for (i=0; i<theRep; i++)
131 ////////////////////////////////aNCrea.Start();
132 PERF_START_METER("NCollection_Array2 creation")
133 ////////////////////////////////QANCollection_Array2 a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
134 QANCollection_Array2Perf a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
135 ////////////////////////////////aNCrea.Stop();
136 PERF_STOP_METER("NCollection_Array2 creation")
137 ////////////////////////////////aNFill.Start();
138 PERF_START_METER("NCollection_Array2 filling")
139 for (j=1; j<=theSize; j++)
140 for (k=1; k<=theSize; k++)
142 ////////////////////////////////aNFill.Stop();
143 PERF_STOP_METER("NCollection_Array2 filling")
144 ////////////////////////////////aNFind.Start();
145 PERF_START_METER("NCollection_Array2 finding")
146 for (j=1; j<=theSize*theSize; j++)
148 Standard_Integer m,n;
153 ////////////////////////////////aNFind.Stop();
154 PERF_STOP_METER("NCollection_Array2 finding")
155 ////////////////////////////////aNOper.Start();
156 PERF_START_METER("NCollection_Array2 operator=")
158 ////////////////////////////////aNOper.Stop();
159 PERF_STOP_METER("NCollection_Array2 operator=")
160 ////////////////////////////////aNAssi.Start();
161 PERF_START_METER("NCollection_Array2 Assign")
163 ////////////////////////////////aNAssi.Stop();
164 PERF_STOP_METER("NCollection_Array2 Assign")
167 for (i=0; i<theRep; i++)
169 ////////////////////////////////aTCrea.Start();
170 PERF_START_METER("TCollection_Array2 creation")
171 TColgp_Array2OfPnt a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
172 ////////////////////////////////aTCrea.Stop();
173 PERF_STOP_METER("TCollection_Array2 creation")
174 ////////////////////////////////aTFill.Start();
175 PERF_START_METER("TCollection_Array2 filling")
176 for (j=1; j<=theSize; j++)
177 for (k=1; k<=theSize; k++)
179 ////////////////////////////////aTFill.Stop();
180 PERF_STOP_METER("TCollection_Array2 filling")
181 ////////////////////////////////aTFind.Start();
182 PERF_START_METER("TCollection_Array2 finding")
183 for (j=1; j<=theSize*theSize; j++)
185 Standard_Integer m,n;
190 ////////////////////////////////aTFind.Stop();
191 PERF_STOP_METER("TCollection_Array2 finding")
192 ////////////////////////////////aTOper.Start();
193 PERF_START_METER("TCollection_Array2 operator=")
195 ////////////////////////////////aTOper.Stop();
196 PERF_STOP_METER("TCollection_Array2 operator=")