1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
package net.sf.infrared.web.report; |
23 |
|
|
24 |
|
import org.apache.poi.hssf.usermodel.*; |
25 |
|
import org.apache.poi.hssf.util.HSSFColor; |
26 |
|
import net.sf.infrared.base.model.AggregateExecutionTime; |
27 |
|
import net.sf.infrared.web.util.PerformanceDataSnapshot; |
28 |
|
import net.sf.infrared.base.model.LayerTime; |
29 |
|
import net.sf.infrared.web.util.SqlStatistics; |
30 |
|
import net.sf.infrared.web.util.ViewUtil; |
31 |
|
|
32 |
|
import java.io.FileOutputStream; |
33 |
|
import java.io.IOException; |
34 |
|
import java.io.OutputStream; |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
public class ExcelSummaryReport implements SummaryReport { |
41 |
0 |
private HSSFWorkbook wb = null; |
42 |
|
|
43 |
0 |
private HSSFCellStyle defaultStyleForDouble = null; |
44 |
|
|
45 |
0 |
private HSSFCellStyle mainHeadingStyle = null; |
46 |
|
|
47 |
0 |
private HSSFCellStyle subHeadingStyle = null; |
48 |
|
|
49 |
0 |
private HSSFCellStyle columnHeadingStyle = null; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
0 |
public ExcelSummaryReport() { |
55 |
0 |
wb = new HSSFWorkbook(); |
56 |
0 |
setupStyles(); |
57 |
0 |
} |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
public void addSnapShot(PerformanceDataSnapshot snapShot) { |
64 |
|
|
65 |
0 |
System.out.println("\n\nThe Excel Report call..."); |
66 |
0 |
HSSFSheet sheet1 = wb.createSheet(); |
67 |
0 |
int currentRow = 0; |
68 |
0 |
currentRow = addJDBCSummary(sheet1, currentRow, snapShot); |
69 |
|
|
70 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 3); |
71 |
|
|
72 |
0 |
currentRow = addAPISummaryForAbsoluteLayers(sheet1, currentRow, snapShot, true); |
73 |
|
|
74 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 3); |
75 |
|
|
76 |
0 |
currentRow = addAPISummaryForAbsoluteLayers(sheet1, currentRow, snapShot, false); |
77 |
|
|
78 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 3); |
79 |
|
|
80 |
0 |
currentRow = addAPISummary(sheet1, currentRow, snapShot, true); |
81 |
|
|
82 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 3); |
83 |
|
|
84 |
0 |
currentRow = addAPISummary(sheet1, currentRow, snapShot, false); |
85 |
|
|
86 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 3); |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
0 |
} |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
public void save(String fileName) throws IOException { |
99 |
0 |
FileOutputStream fileOut = new FileOutputStream(fileName); |
100 |
0 |
save(fileOut); |
101 |
0 |
fileOut.close(); |
102 |
0 |
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
public void save(OutputStream os) throws IOException { |
110 |
0 |
wb.write(os); |
111 |
0 |
} |
112 |
|
|
113 |
|
|
114 |
|
private int addAPISummary(HSSFSheet sheet1, class="keyword">int currentRow, |
115 |
|
PerformanceDataSnapshot snapShot, boolean exclusive) { |
116 |
0 |
AggregateExecutionTime[] apis = null; |
117 |
|
|
118 |
0 |
currentRow = addMainHeading(sheet1, currentRow, "Operation Summary ( " |
119 |
|
+ getModeAsString(exclusive) + " ) for Hierarchical Layers"); |
120 |
|
|
121 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 1); |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
0 |
String[] layerz = snapShot.getStats().getHierarchicalLayers(); |
126 |
0 |
LayerTime[] layers = new LayerTime[layerz.length]; |
127 |
0 |
for (int j = 0; j < layerz.length; j++) { |
128 |
0 |
String aLayer = layerz[j]; |
129 |
0 |
long itsTime = snapShot.getStats().getTimeInHierarchicalLayer(aLayer); |
130 |
0 |
LayerTime lt = new LayerTime(aLayer); |
131 |
0 |
lt.setTime(itsTime); |
132 |
0 |
layers[j] = lt; |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
0 |
for (int i = 0; i < layers.length; i++) { |
137 |
0 |
LayerTime layer = layers[i]; |
138 |
|
|
139 |
0 |
if (layer.getLayer().endsWith("JDBC")) |
140 |
0 |
continue; |
141 |
|
|
142 |
0 |
apis = ViewUtil.getSummaryForALayer(snapShot, layer.getLayer()); |
143 |
0 |
currentRow = addSummaryForALayer(sheet1, currentRow, apis, layer.getLayer(), |
144 |
|
exclusive); |
145 |
|
} |
146 |
|
|
147 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 1); |
148 |
|
|
149 |
0 |
return currentRow; |
150 |
|
} |
151 |
|
|
152 |
|
|
153 |
|
private int addAPISummaryForAbsoluteLayers(HSSFSheet sheet1, class="keyword">int currentRow, |
154 |
|
PerformanceDataSnapshot snapShot, boolean exclusive) { |
155 |
0 |
AggregateExecutionTime[] apis = null; |
156 |
|
|
157 |
0 |
currentRow = addMainHeading(sheet1, currentRow, "Operation Summary ( " |
158 |
|
+ getModeAsString(exclusive) + " ) for Absolute Layers"); |
159 |
|
|
160 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 1); |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
0 |
String[] layerz = snapShot.getStats().getAbsoluteLayers(); |
165 |
0 |
LayerTime[] layers = new LayerTime[layerz.length]; |
166 |
0 |
for (int j = 0; j < layerz.length; j++) { |
167 |
0 |
String aLayer = layerz[j]; |
168 |
0 |
long itsTime = snapShot.getStats().getTimeInAbsoluteLayer(aLayer); |
169 |
0 |
LayerTime lt = new LayerTime(aLayer); |
170 |
0 |
lt.setTime(itsTime); |
171 |
0 |
layers[j] = lt; |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
0 |
for (int i = 0; i < layers.length; i++) { |
176 |
0 |
LayerTime layer = layers[i]; |
177 |
|
|
178 |
0 |
if (layer.getLayer().endsWith("JDBC")) |
179 |
0 |
continue; |
180 |
|
|
181 |
0 |
apis = ViewUtil.getSummaryForAbsoluteLayer(snapShot, layer.getLayer()); |
182 |
0 |
currentRow = addSummaryForALayer(sheet1, currentRow, apis, layer.getLayer(), |
183 |
|
exclusive); |
184 |
|
|
185 |
|
} |
186 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 1); |
187 |
|
|
188 |
0 |
return currentRow; |
189 |
|
} |
190 |
|
|
191 |
|
|
192 |
|
private int addSummaryForALayer(HSSFSheet sheet1, class="keyword">int currentRow, |
193 |
|
AggregateExecutionTime[] apis, String layerName, boolean exclusive) { |
194 |
0 |
addSubHeading(sheet1, currentRow++, "Summary for Layer : " + layerName); |
195 |
|
|
196 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 1); |
197 |
0 |
currentRow = addTopNApiByExecutionTime(sheet1, currentRow, apis,exclusive); |
198 |
|
|
199 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 2); |
200 |
|
|
201 |
0 |
currentRow = addTopNApiByCount(sheet1, currentRow, apis, exclusive); |
202 |
|
|
203 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 2); |
204 |
|
|
205 |
0 |
currentRow = addTopNApiByTotalTime(sheet1, currentRow, apis, exclusive); |
206 |
|
|
207 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 1); |
208 |
0 |
return currentRow; |
209 |
|
} |
210 |
|
|
211 |
|
private String getModeAsString(boolean exclusiveMode) { |
212 |
0 |
if (exclusiveMode) |
213 |
0 |
return "Exclusive"; |
214 |
|
else |
215 |
0 |
return "Inclusive"; |
216 |
|
} |
217 |
|
|
218 |
|
private int addTopNApiByTotalTime(HSSFSheet sheet1, class="keyword">int currentRow, |
219 |
|
AggregateExecutionTime[] apis, boolean exclusiveMode) { |
220 |
|
|
221 |
0 |
currentRow = addSubHeading(sheet1, currentRow, "Top 10 Operations by Total time"); |
222 |
|
|
223 |
0 |
writeAPISummaryHeader(sheet1.createRow(currentRow++), exclusiveMode); |
224 |
0 |
ViewUtil.sort(exclusiveMode ? "totalTimeExclusive" : "totalTime", false, apis); |
225 |
0 |
currentRow = writeApiSummary(apis, sheet1, currentRow, exclusiveMode); |
226 |
0 |
return currentRow; |
227 |
|
} |
228 |
|
|
229 |
|
private int addTopNApiByCount(HSSFSheet sheet1, class="keyword">int currentRow,AggregateExecutionTime[] apis, |
230 |
|
boolean exclusiveMode) { |
231 |
0 |
currentRow = addSubHeading(sheet1, currentRow, "Top 10 Operations by count"); |
232 |
0 |
writeAPISummaryHeader(sheet1.createRow(currentRow++), exclusiveMode); |
233 |
0 |
ViewUtil.sort("count", false, apis); |
234 |
0 |
currentRow = writeApiSummary(apis, sheet1, currentRow, exclusiveMode); |
235 |
0 |
return currentRow; |
236 |
|
} |
237 |
|
|
238 |
|
private int addTopNApiByExecutionTime(HSSFSheet sheet1, class="keyword">int currentRow, |
239 |
|
AggregateExecutionTime[] apis, boolean exclusiveMode) { |
240 |
|
|
241 |
0 |
currentRow = addSubHeading(sheet1, currentRow,"Top 10 Operations by execution time"); |
242 |
0 |
writeAPISummaryHeader(sheet1.createRow(currentRow++), exclusiveMode); |
243 |
0 |
ViewUtil.sort(exclusiveMode ? "adjAvgExclusive" : "adjAvg", |
244 |
|
false, apis); |
245 |
0 |
currentRow = writeApiSummary(apis, sheet1, currentRow, exclusiveMode); |
246 |
0 |
return currentRow; |
247 |
|
} |
248 |
|
|
249 |
|
private int addJDBCSummary(HSSFSheet sheet1, class="keyword">int currentRow, PerformanceDataSnapshot snapShot) { |
250 |
0 |
currentRow = addMainHeading(sheet1, currentRow, "JDBC Summary"); |
251 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 1); |
252 |
0 |
SqlStatistics[] sqlStatistics = snapShot.getSqlStatistics(); |
253 |
0 |
currentRow = addTopNSqlQueriesByExecutionTime(sheet1, currentRow,sqlStatistics, snapShot); |
254 |
0 |
currentRow = insertBlankRow(sheet1, currentRow, 1); |
255 |
0 |
currentRow = addTopNSqlQueriesByCount(sheet1, currentRow,sqlStatistics, snapShot); |
256 |
0 |
return currentRow; |
257 |
|
} |
258 |
|
|
259 |
|
private int addTopNSqlQueriesByCount(HSSFSheet sheet1, class="keyword">int currentRow, |
260 |
|
SqlStatistics[] sqlStatistics, PerformanceDataSnapshot snapShot) { |
261 |
|
|
262 |
0 |
currentRow = addSubHeading(sheet1, currentRow, "Top 10 queries by count"); |
263 |
0 |
writeJDBCHeader(sheet1.createRow(currentRow++)); |
264 |
0 |
currentRow = writeSQLStatistics(ViewUtil.getTopNQueriesByCount(sqlStatistics, 10), |
265 |
|
sheet1, currentRow, snapShot); |
266 |
0 |
return currentRow; |
267 |
|
} |
268 |
|
|
269 |
|
private int addTopNSqlQueriesByExecutionTime(HSSFSheet sheet1, class="keyword">int currentRow, |
270 |
|
SqlStatistics[] sqlStatistics, PerformanceDataSnapshot snapShot) { |
271 |
|
|
272 |
0 |
currentRow = addSubHeading(sheet1, currentRow, "Top 10 queries by execution time"); |
273 |
|
|
274 |
0 |
ViewUtil.getTopNQueriesByCount(sqlStatistics, 10); |
275 |
0 |
writeJDBCHeader(sheet1.createRow(currentRow++)); |
276 |
0 |
currentRow = writeSQLStatistics(ViewUtil.getTopNQueriesByExecutionTime(sqlStatistics, 10), |
277 |
|
sheet1, currentRow, snapShot); |
278 |
0 |
return currentRow; |
279 |
|
} |
280 |
|
|
281 |
|
private int insertBlankRow(HSSFSheet sheet1, class="keyword">int currentRow, class="keyword">int noOfRows) { |
282 |
0 |
while (noOfRows-- > 0) { |
283 |
0 |
sheet1.createRow(currentRow++); |
284 |
|
} |
285 |
0 |
return currentRow; |
286 |
|
} |
287 |
|
|
288 |
|
private void setupStyles() { |
289 |
0 |
setUpDoubleCellStyle(); |
290 |
0 |
setUpMainHeadingStyle(); |
291 |
0 |
setUpSubHeadingStyle(); |
292 |
0 |
setUpColumnHeadingStyle(); |
293 |
0 |
} |
294 |
|
|
295 |
|
private void setUpColumnHeadingStyle() { |
296 |
0 |
columnHeadingStyle = wb.createCellStyle(); |
297 |
0 |
HSSFFont columnHeadingFont = wb.createFont(); |
298 |
0 |
columnHeadingFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); |
299 |
0 |
columnHeadingFont.setFontHeightInPoints((short) 10); |
300 |
0 |
columnHeadingStyle.setFont(columnHeadingFont); |
301 |
0 |
columnHeadingStyle.setWrapText(true); |
302 |
0 |
columnHeadingStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); |
303 |
0 |
columnHeadingStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); |
304 |
0 |
columnHeadingStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); |
305 |
0 |
columnHeadingStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); |
306 |
0 |
columnHeadingStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); |
307 |
0 |
columnHeadingStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); |
308 |
0 |
columnHeadingStyle.setFillPattern(HSSFCellStyle.NO_FILL); |
309 |
0 |
columnHeadingStyle.setFillBackgroundColor(HSSFColor.GREY_25_PERCENT.index); |
310 |
0 |
} |
311 |
|
|
312 |
|
private void setUpSubHeadingStyle() { |
313 |
0 |
subHeadingStyle = wb.createCellStyle(); |
314 |
0 |
HSSFFont subHeadingFont = wb.createFont(); |
315 |
0 |
subHeadingFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); |
316 |
0 |
subHeadingFont.setFontHeightInPoints((short) 12); |
317 |
0 |
subHeadingStyle.setFont(subHeadingFont); |
318 |
0 |
} |
319 |
|
|
320 |
|
private void setUpMainHeadingStyle() { |
321 |
0 |
mainHeadingStyle = wb.createCellStyle(); |
322 |
0 |
HSSFFont mainHeadingFont = wb.createFont(); |
323 |
0 |
mainHeadingFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); |
324 |
0 |
mainHeadingFont.setFontHeightInPoints((short) 14); |
325 |
0 |
mainHeadingStyle.setFont(mainHeadingFont); |
326 |
0 |
} |
327 |
|
|
328 |
|
private void setUpDoubleCellStyle() { |
329 |
0 |
defaultStyleForDouble = wb.createCellStyle(); |
330 |
0 |
defaultStyleForDouble.setAlignment(HSSFCellStyle.ALIGN_RIGHT); |
331 |
0 |
defaultStyleForDouble.setDataFormat(wb.createDataFormat().getFormat("######0.00")); |
332 |
0 |
} |
333 |
|
|
334 |
|
private int addSubHeading(HSSFSheet sheet1, class="keyword">int currentRow, String headingText) { |
335 |
0 |
HSSFCell headingCell = sheet1.createRow(currentRow++).createCell((short) 0); |
336 |
0 |
headingCell.setCellStyle(subHeadingStyle); |
337 |
0 |
headingCell.setCellValue(headingText); |
338 |
0 |
return currentRow; |
339 |
|
} |
340 |
|
|
341 |
|
private int addMainHeading(HSSFSheet sheet1, class="keyword">int currentRow, String headingText) { |
342 |
0 |
HSSFCell headingCell = sheet1.createRow(currentRow++).createCell((short) 0); |
343 |
0 |
headingCell.setCellValue(headingText); |
344 |
0 |
headingCell.setCellStyle(mainHeadingStyle); |
345 |
0 |
return currentRow; |
346 |
|
} |
347 |
|
|
348 |
|
private int writeApiSummary(AggregateExecutionTime[] apis, HSSFSheet sheet1, class="keyword">int currentRow, |
349 |
|
boolean exclusiveMode) { |
350 |
0 |
for (int i = 0; i < apis.length && i < 10; i++) { |
351 |
0 |
writeApiSummaryData(sheet1.createRow(currentRow++), apis[i], i + 1, exclusiveMode); |
352 |
|
} |
353 |
0 |
return currentRow; |
354 |
|
} |
355 |
|
|
356 |
|
private void writeApiSummaryData(HSSFRow row, AggregateExecutionTime apiTime,int rowNo, |
357 |
|
boolean exclusiveMode) { |
358 |
0 |
short currentCell = 0; |
359 |
0 |
row.createCell(currentCell++).setCellValue(rowNo); |
360 |
|
|
361 |
0 |
row.createCell(currentCell++).setCellValue(apiTime.getContext().getName()); |
362 |
0 |
row.createCell(currentCell++).setCellValue(apiTime.getExecutionCount()); |
363 |
0 |
currentCell = addDoubleCell(row, currentCell, exclusiveMode ? |
364 |
|
apiTime.getTotalExclusiveTime() : apiTime.getTotalInclusiveTime()); |
365 |
0 |
currentCell = addDoubleCell(row, currentCell, exclusiveMode ? |
366 |
|
apiTime.getAverageExclusiveTime() : |
367 |
|
apiTime.getAverageInclusiveTime()); |
368 |
0 |
currentCell = addDoubleCell(row, currentCell, exclusiveMode ? |
369 |
|
apiTime.getAdjAverageExclusiveTime() : |
370 |
|
apiTime.getAdjAverageInclusiveTime()); |
371 |
0 |
row.createCell(currentCell++).setCellValue(exclusiveMode ? |
372 |
|
apiTime.getMaxExclusiveTime() : apiTime.getMaxInclusiveTime()); |
373 |
0 |
row.createCell(currentCell++).setCellValue(exclusiveMode ? apiTime.getMinExclusiveTime() : |
374 |
|
apiTime.getMinInclusiveTime()); |
375 |
0 |
row.createCell(currentCell++).setCellValue(exclusiveMode ? |
376 |
|
apiTime.getExclusiveFirstExecutionTime(): |
377 |
|
apiTime.getInclusiveFirstExecutionTime()); |
378 |
0 |
row.createCell(currentCell++).setCellValue(exclusiveMode ? |
379 |
|
apiTime.getExclusiveLastExecutionTime(): |
380 |
|
apiTime.getInclusiveLastExecutionTime()); |
381 |
0 |
} |
382 |
|
|
383 |
|
private short addDoubleCell(HSSFRow row, class="keyword">short currentCell, double value) { |
384 |
0 |
HSSFCell cell = row.createCell(currentCell++); |
385 |
0 |
cell.setCellValue(value); |
386 |
0 |
cell.setCellStyle(defaultStyleForDouble); |
387 |
0 |
return currentCell; |
388 |
|
} |
389 |
|
|
390 |
|
private void writeAPISummaryHeader(HSSFRow row, boolean exclusive) { |
391 |
0 |
short currentCell = 0; |
392 |
0 |
addColumnHeadingCell(row, currentCell++, "Sl. No"); |
393 |
0 |
addColumnHeadingCell(row, currentCell++, "Operation Name"); |
394 |
0 |
addColumnHeadingCell(row, currentCell++, "Count"); |
395 |
0 |
addColumnHeadingCell(row, currentCell++, "Total Time"); |
396 |
0 |
addColumnHeadingCell(row, currentCell++, "Avg."); |
397 |
0 |
addColumnHeadingCell(row, currentCell++, "Adj. Avg."); |
398 |
0 |
addColumnHeadingCell(row, currentCell++, "Max"); |
399 |
0 |
addColumnHeadingCell(row, currentCell++, "Min"); |
400 |
0 |
addColumnHeadingCell(row, currentCell++, "First"); |
401 |
0 |
addColumnHeadingCell(row, currentCell++, "Last"); |
402 |
0 |
} |
403 |
|
|
404 |
|
private HSSFCell addColumnHeadingCell(HSSFRow row, short currentCell, String headingText) { |
405 |
0 |
HSSFCell headingCell = row.createCell(currentCell++); |
406 |
0 |
headingCell.setCellValue(headingText); |
407 |
0 |
headingCell.setCellStyle(columnHeadingStyle); |
408 |
0 |
return headingCell; |
409 |
|
} |
410 |
|
|
411 |
|
private int writeSQLStatistics(SqlStatistics[] sqlStatistics, HSSFSheet sheet1, |
412 |
|
int currentRow, PerformanceDataSnapshot snapShot) { |
413 |
0 |
for (int i = 0; i < sqlStatistics.length; i++) { |
414 |
0 |
writeJDBCDataRow(sheet1.createRow(currentRow++), sqlStatistics[i], |
415 |
|
i + 1, snapShot); |
416 |
|
} |
417 |
0 |
return currentRow; |
418 |
|
} |
419 |
|
|
420 |
|
private void writeJDBCDataRow(HSSFRow sqlStatisticsRow, SqlStatistics sqlStatistic, int rowNo, |
421 |
|
PerformanceDataSnapshot snapShot) { |
422 |
0 |
short currentCell = 0; |
423 |
0 |
sqlStatisticsRow.createCell(currentCell++).setCellValue(rowNo); |
424 |
0 |
addSqlCell(sqlStatisticsRow, currentCell++, sqlStatistic.getSql()); |
425 |
0 |
currentCell = addDoubleCell(sqlStatisticsRow, currentCell, |
426 |
|
sqlStatistic.getAvgExecuteTime()); |
427 |
0 |
currentCell = addDoubleCell(sqlStatisticsRow, currentCell, |
428 |
|
sqlStatistic.getAvgPrepareTime()); |
429 |
|
|
430 |
|
|
431 |
0 |
sqlStatisticsRow.createCell(currentCell++).setCellValue(sqlStatistic.getNoOfExecutes()); |
432 |
0 |
sqlStatisticsRow.createCell(currentCell++).setCellValue(sqlStatistic.getMaxExecuteTime()); |
433 |
0 |
sqlStatisticsRow.createCell(currentCell++).setCellValue(sqlStatistic.getMinExecuteTime()); |
434 |
0 |
sqlStatisticsRow.createCell(currentCell++).setCellValue(sqlStatistic.getFirstExecuteTime()); |
435 |
0 |
sqlStatisticsRow.createCell(currentCell++).setCellValue(sqlStatistic.getLastExecuteTime()); |
436 |
|
|
437 |
|
|
438 |
|
|
439 |
|
|
440 |
0 |
} |
441 |
|
|
442 |
|
private HSSFCell addSqlCell(HSSFRow row, short currentCell, String sql) { |
443 |
0 |
HSSFCell sqlCell = row.createCell(currentCell); |
444 |
0 |
sqlCell.setCellValue(sql); |
445 |
0 |
return sqlCell; |
446 |
|
} |
447 |
|
|
448 |
|
private void writeJDBCHeader(HSSFRow headingRow) { |
449 |
0 |
short currentCell = 0; |
450 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "Sl. No"); |
451 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "SQL Query"); |
452 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "Avg. Exec Time"); |
453 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "Avg. Prepare Time"); |
454 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "Count"); |
455 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "Max"); |
456 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "Min"); |
457 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "First"); |
458 |
0 |
addColumnHeadingCell(headingRow, currentCell++, "Last"); |
459 |
0 |
} |
460 |
|
} |