Source Code Cross Referenced for ModelPanel.java in  » Profiler » gcviewer » com » tagtraum » perf » gcviewer » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Profiler » gcviewer » com.tagtraum.perf.gcviewer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.tagtraum.perf.gcviewer;
002:
003:        import com.tagtraum.perf.gcviewer.util.TimeFormat;
004:        import com.tagtraum.perf.gcviewer.util.MemoryFormat;
005:
006:        import javax.swing.*;
007:        import java.awt.*;
008:        import java.text.NumberFormat;
009:        import java.text.DateFormat;
010:        import java.util.ResourceBundle;
011:        import java.util.Date;
012:
013:        /**
014:         * Panel that contains characteristic data about about the gc file.
015:         *
016:         * Date: Feb 3, 2002
017:         * Time: 9:58:00 PM
018:         * @author <a href="mailto:hs@tagtraum.com">Hendrik Schreiber</a>
019:         * @version $Id: $
020:         */
021:        public class ModelPanel extends JTabbedPane {
022:
023:            private static ResourceBundle localStrings = ResourceBundle
024:                    .getBundle("com.tagtraum.perf.gcviewer.localStrings");
025:
026:            private NumberFormat pauseFormatter;
027:            private DateFormat totalTimeFormatter;
028:            private NumberFormat throughputFormatter;
029:            private NumberFormat footprintFormatter;
030:            private NumberFormat footprintSlopeFormatter;
031:            private NumberFormat freedMemoryPerMinFormatter;
032:            private NumberFormat sigmaFormatter;
033:            private NumberFormat percentFormatter;
034:            private NumberFormat gcTimeFormatter;
035:            private MemoryFormat sigmaMemoryFormatter;
036:            private SummaryTab summaryTab;
037:            private MemoryTab memoryTab;
038:            private PauseTab pauseTab;
039:
040:            public ModelPanel() {
041:                //setBorder(new TitledBorder(localStrings.getString("data_panel_title")));
042:                pauseFormatter = NumberFormat.getInstance();
043:                pauseFormatter.setMaximumFractionDigits(5);
044:
045:                totalTimeFormatter = new TimeFormat();
046:
047:                gcTimeFormatter = NumberFormat.getInstance();
048:                gcTimeFormatter.setMaximumFractionDigits(2);
049:
050:                throughputFormatter = NumberFormat.getInstance();
051:                throughputFormatter.setMaximumFractionDigits(2);
052:
053:                footprintFormatter = new MemoryFormat();
054:                //footprintFormatter.setMaximumFractionDigits(0);
055:
056:                sigmaFormatter = NumberFormat.getInstance();
057:                sigmaFormatter.setMaximumFractionDigits(0);
058:
059:                sigmaMemoryFormatter = new MemoryFormat();
060:
061:                footprintSlopeFormatter = new MemoryFormat();
062:
063:                freedMemoryPerMinFormatter = new MemoryFormat();
064:
065:                percentFormatter = NumberFormat.getInstance();
066:                percentFormatter.setMaximumFractionDigits(1);
067:                percentFormatter.setMinimumFractionDigits(1);
068:
069:                summaryTab = new SummaryTab();
070:                addTab(localStrings.getString("data_panel_tab_summary"),
071:                        summaryTab);
072:                memoryTab = new MemoryTab();
073:                addTab(localStrings.getString("data_panel_tab_memory"),
074:                        memoryTab);
075:                pauseTab = new PauseTab();
076:                addTab(localStrings.getString("data_panel_tab_pause"), pauseTab);
077:            }
078:
079:            private String sigmaMemoryFormat(double value) {
080:                if (Double.isNaN(value))
081:                    return "NaN";
082:                return sigmaMemoryFormatter.format(value);
083:            }
084:
085:            public void setModel(GCModel model) {
086:                memoryTab.setModel(model);
087:                pauseTab.setModel(model);
088:                summaryTab.setModel(model);
089:                repaint();
090:            }
091:
092:            private boolean isSignificant(final double average,
093:                    final double standardDeviation) {
094:                // at least 68.3% of all points are within 0.75 to 1.25 times the average value
095:                // Note: this may or may not be a good measure, but it at least helps to mark some bad data as such
096:                return average - standardDeviation > 0.75 * average;
097:            }
098:
099:            private class MemoryTab extends JPanel {
100:                private JLabel footprintAfterFullGCValue;
101:                private JLabel footprintAfterGCValue;
102:                private JLabel slopeAfterFullGCValue;
103:                private JLabel slopeAfterGCValue;
104:                private JLabel freedMemoryByFullGCValue;
105:                private JLabel avgFreedMemoryByFullGCValue;
106:                private JLabel freedMemoryByGCValue;
107:                private JLabel avgFreedMemoryByGCValue;
108:                private JLabel avgRelativePostGCIncValue;
109:                private JLabel avgRelativePostFullGCIncValue;
110:                private JLabel footprintValue;
111:                private JLabel freedMemoryValue;
112:
113:                public MemoryTab() {
114:                    GridBagLayout layout = new GridBagLayout();
115:                    GridBagConstraints constraints = new GridBagConstraints();
116:                    constraints.anchor = GridBagConstraints.WEST;
117:                    constraints.fill = GridBagConstraints.HORIZONTAL;
118:                    constraints.weightx = 1.0;
119:                    constraints.weighty = 1.0;
120:                    constraints.insets = new Insets(0, 3, 0, 3);
121:                    constraints.gridy = -1;
122:                    setLayout(layout);
123:
124:                    // footprint
125:                    JLabel footprintLabel = new JLabel(localStrings
126:                            .getString("data_panel_footprint"));
127:                    constraints.gridy++;
128:                    constraints.gridx = 0;
129:                    layout.setConstraints(footprintLabel, constraints);
130:                    add(footprintLabel);
131:                    footprintValue = new JLabel("", JLabel.RIGHT);
132:                    constraints.gridx = 1;
133:                    layout.setConstraints(footprintValue, constraints);
134:                    add(footprintValue);
135:
136:                    // footprint after full gc
137:                    JLabel footprintAfterFullGCLabel = new JLabel(localStrings
138:                            .getString("data_panel_footprintafterfullgc"));
139:                    constraints.gridy++;
140:                    constraints.gridx = 0;
141:                    layout.setConstraints(footprintAfterFullGCLabel,
142:                            constraints);
143:                    add(footprintAfterFullGCLabel);
144:                    footprintAfterFullGCValue = new JLabel("", JLabel.RIGHT);
145:                    constraints.gridx = 1;
146:                    layout.setConstraints(footprintAfterFullGCValue,
147:                            constraints);
148:                    add(footprintAfterFullGCValue);
149:
150:                    // footprint after (small) gc
151:                    JLabel footprintAfterGCLabel = new JLabel(localStrings
152:                            .getString("data_panel_footprintaftergc"));
153:                    constraints.gridy++;
154:                    constraints.gridx = 0;
155:                    layout.setConstraints(footprintAfterGCLabel, constraints);
156:                    add(footprintAfterGCLabel);
157:                    footprintAfterGCValue = new JLabel("", JLabel.RIGHT);
158:                    constraints.gridx = 1;
159:                    layout.setConstraints(footprintAfterGCValue, constraints);
160:                    add(footprintAfterGCValue);
161:
162:                    // freed memory
163:                    JLabel freedMemoryLabel = new JLabel(localStrings
164:                            .getString("data_panel_freedmemory"));
165:                    constraints.gridy++;
166:                    constraints.gridx = 0;
167:                    layout.setConstraints(freedMemoryLabel, constraints);
168:                    add(freedMemoryLabel);
169:                    freedMemoryValue = new JLabel("", JLabel.RIGHT);
170:                    constraints.gridx = 1;
171:                    layout.setConstraints(freedMemoryValue, constraints);
172:                    add(freedMemoryValue);
173:
174:                    // memory freed by full gc
175:                    JLabel freedMemoryByFullGCLabel = new JLabel(localStrings
176:                            .getString("data_panel_freedmemorybyfullgc"));
177:                    constraints.gridy++;
178:                    constraints.gridx = 0;
179:                    layout
180:                            .setConstraints(freedMemoryByFullGCLabel,
181:                                    constraints);
182:                    add(freedMemoryByFullGCLabel);
183:                    freedMemoryByFullGCValue = new JLabel("", JLabel.RIGHT);
184:                    constraints.gridx = 1;
185:                    layout
186:                            .setConstraints(freedMemoryByFullGCValue,
187:                                    constraints);
188:                    add(freedMemoryByFullGCValue);
189:
190:                    // memory freed by gc
191:                    JLabel freedMemoryByGCLabel = new JLabel(localStrings
192:                            .getString("data_panel_freedmemorybygc"));
193:                    constraints.gridy++;
194:                    constraints.gridx = 0;
195:                    layout.setConstraints(freedMemoryByGCLabel, constraints);
196:                    add(freedMemoryByGCLabel);
197:                    freedMemoryByGCValue = new JLabel("", JLabel.RIGHT);
198:                    constraints.gridx = 1;
199:                    layout.setConstraints(freedMemoryByGCValue, constraints);
200:                    add(freedMemoryByGCValue);
201:
202:                    // avg memory freed by full gc
203:                    JLabel avgFreedMemoryByFullGCLabel = new JLabel(
204:                            localStrings
205:                                    .getString("data_panel_avgfreedmemorybyfullgc"));
206:                    constraints.gridy++;
207:                    constraints.gridx = 0;
208:                    layout.setConstraints(avgFreedMemoryByFullGCLabel,
209:                            constraints);
210:                    add(avgFreedMemoryByFullGCLabel);
211:                    avgFreedMemoryByFullGCValue = new JLabel("", JLabel.RIGHT);
212:                    constraints.gridx = 1;
213:                    layout.setConstraints(avgFreedMemoryByFullGCValue,
214:                            constraints);
215:                    add(avgFreedMemoryByFullGCValue);
216:
217:                    // avg memory freed by gc
218:                    JLabel avgFreedMemoryByGCLabel = new JLabel(localStrings
219:                            .getString("data_panel_avgfreedmemorybygc"));
220:                    constraints.gridy++;
221:                    constraints.gridx = 0;
222:                    layout.setConstraints(avgFreedMemoryByGCLabel, constraints);
223:                    add(avgFreedMemoryByGCLabel);
224:                    avgFreedMemoryByGCValue = new JLabel("", JLabel.RIGHT);
225:                    constraints.gridx = 1;
226:                    layout.setConstraints(avgFreedMemoryByGCValue, constraints);
227:                    add(avgFreedMemoryByGCValue);
228:
229:                    // avg increase in memory consumption in comparison to foorprint after the last full GC
230:                    JLabel avgRelativePostFullGCIncLabel = new JLabel(
231:                            localStrings
232:                                    .getString("data_panel_avgrelativepostfullgcincrease"));
233:                    constraints.gridy++;
234:                    constraints.gridx = 0;
235:                    layout.setConstraints(avgRelativePostFullGCIncLabel,
236:                            constraints);
237:                    add(avgRelativePostFullGCIncLabel);
238:                    avgRelativePostFullGCIncValue = new JLabel("", JLabel.RIGHT);
239:                    constraints.gridx = 1;
240:                    layout.setConstraints(avgRelativePostFullGCIncValue,
241:                            constraints);
242:                    add(avgRelativePostFullGCIncValue);
243:
244:                    // avg increase in memory consumption in comparison to foorprint after the last GC
245:                    JLabel avgRelativepostGCIncLabel = new JLabel(localStrings
246:                            .getString("data_panel_avgrelativepostgcincrease"));
247:                    constraints.gridy++;
248:                    constraints.gridx = 0;
249:                    layout.setConstraints(avgRelativepostGCIncLabel,
250:                            constraints);
251:                    add(avgRelativepostGCIncLabel);
252:                    avgRelativePostGCIncValue = new JLabel("", JLabel.RIGHT);
253:                    constraints.gridx = 1;
254:                    layout.setConstraints(avgRelativePostGCIncValue,
255:                            constraints);
256:                    add(avgRelativePostGCIncValue);
257:
258:                    // slope of footprint after full gc
259:                    JLabel slopeAfterFullGCLabel = new JLabel(localStrings
260:                            .getString("data_panel_slopeafterfullgc"));
261:                    constraints.gridy++;
262:                    constraints.gridx = 0;
263:                    layout.setConstraints(slopeAfterFullGCLabel, constraints);
264:                    add(slopeAfterFullGCLabel);
265:                    slopeAfterFullGCValue = new JLabel("", JLabel.RIGHT);
266:                    constraints.gridx = 1;
267:                    layout.setConstraints(slopeAfterFullGCValue, constraints);
268:                    add(slopeAfterFullGCValue);
269:
270:                    // weighted slope of footprint after (small) gc
271:                    JLabel slopeAfterGCLabel = new JLabel(localStrings
272:                            .getString("data_panel_slopeaftergc"));
273:                    constraints.gridy++;
274:                    constraints.gridx = 0;
275:                    layout.setConstraints(slopeAfterGCLabel, constraints);
276:                    add(slopeAfterGCLabel);
277:                    slopeAfterGCValue = new JLabel("", JLabel.RIGHT);
278:                    constraints.gridx = 1;
279:                    layout.setConstraints(slopeAfterGCValue, constraints);
280:                    add(slopeAfterGCValue);
281:
282:                }
283:
284:                public void setModel(GCModel model) {
285:                    footprintValue.setText(footprintFormatter.format(model
286:                            .getFootprint()));
287:                    // check whether we have full gc data at all
288:                    final boolean fullGCDataVailable = model
289:                            .getFootprintAfterFullGC().getN() != 0;
290:                    final boolean fullGCSlopeDataVailable = model
291:                            .getFootprintAfterFullGC().getN() > 1;
292:                    footprintAfterFullGCValue.setEnabled(fullGCDataVailable);
293:                    slopeAfterFullGCValue.setEnabled(fullGCDataVailable);
294:                    freedMemoryByFullGCValue.setEnabled(fullGCDataVailable);
295:                    avgFreedMemoryByFullGCValue.setEnabled(fullGCDataVailable);
296:                    avgRelativePostFullGCIncValue
297:                            .setEnabled(fullGCDataVailable);
298:                    if (!fullGCDataVailable) {
299:                        footprintAfterFullGCValue.setText("n.a.");
300:                        slopeAfterFullGCValue.setText("n.a.");
301:                        freedMemoryByFullGCValue.setText("n.a.");
302:                        avgFreedMemoryByFullGCValue.setText("n.a.");
303:                    } else {
304:                        footprintAfterFullGCValue.setText(footprintFormatter
305:                                .format(model.getFootprintAfterFullGC()
306:                                        .average())
307:                                + " (\u03c3="
308:                                + sigmaMemoryFormat(model
309:                                        .getFootprintAfterFullGC()
310:                                        .standardDeviation()) + ")");
311:                        footprintAfterFullGCValue.setEnabled(isSignificant(
312:                                model.getFootprintAfterFullGC().average(),
313:                                model.getFootprintAfterFullGC()
314:                                        .standardDeviation()));
315:                        freedMemoryByFullGCValue
316:                                .setText(footprintFormatter.format(model
317:                                        .getFreedMemoryByFullGC().getSum())
318:                                        + " ("
319:                                        + percentFormatter.format(model
320:                                                .getFreedMemoryByFullGC()
321:                                                .getSum()
322:                                                * 100.0
323:                                                / model.getFreedMemory())
324:                                        + "%)");
325:                        avgFreedMemoryByFullGCValue.setText(footprintFormatter
326:                                .format(model.getFreedMemoryByFullGC()
327:                                        .average())
328:                                + "/coll (\u03c3="
329:                                + sigmaMemoryFormat(model
330:                                        .getFreedMemoryByFullGC()
331:                                        .standardDeviation()) + ")");
332:                        avgFreedMemoryByFullGCValue.setEnabled(isSignificant(
333:                                model.getFreedMemoryByFullGC().average(), model
334:                                        .getFreedMemoryByFullGC()
335:                                        .standardDeviation()));
336:                        if (fullGCSlopeDataVailable) {
337:                            slopeAfterFullGCValue
338:                                    .setText(footprintSlopeFormatter
339:                                            .format(model.getPostFullGCSlope()
340:                                                    .slope())
341:                                            + "/s");
342:                            avgRelativePostFullGCIncValue
343:                                    .setText(footprintSlopeFormatter
344:                                            .format(model
345:                                                    .getRelativePostFullGCIncrease()
346:                                                    .slope())
347:                                            + "/coll");
348:                        } else {
349:                            slopeAfterFullGCValue.setText("n.a.");
350:                            avgRelativePostFullGCIncValue.setText("n.a.");
351:                        }
352:                    }
353:                    // check whether we have gc data at all (or only full gc)
354:                    final boolean gcDataAvailable = model.getFootprintAfterGC()
355:                            .getN() != 0;
356:                    footprintAfterGCValue.setEnabled(gcDataAvailable);
357:                    slopeAfterGCValue.setEnabled(gcDataAvailable
358:                            && fullGCDataVailable);
359:                    freedMemoryByGCValue.setEnabled(gcDataAvailable);
360:                    avgFreedMemoryByGCValue.setEnabled(gcDataAvailable);
361:                    avgRelativePostGCIncValue.setEnabled(gcDataAvailable
362:                            && fullGCDataVailable);
363:                    if (!gcDataAvailable) {
364:                        footprintAfterGCValue.setText("n.a.");
365:                        slopeAfterGCValue.setText("n.a.");
366:                        freedMemoryByGCValue.setText("n.a.");
367:                        avgFreedMemoryByGCValue.setText("n.a.");
368:                        avgRelativePostGCIncValue.setText("n.a.");
369:                    } else {
370:                        footprintAfterGCValue.setText(footprintFormatter
371:                                .format(model.getFootprintAfterGC().average())
372:                                + " (\u03c3="
373:                                + sigmaMemoryFormat(model.getFootprintAfterGC()
374:                                        .standardDeviation()) + ")");
375:                        footprintAfterGCValue.setEnabled(isSignificant(model
376:                                .getFootprintAfterGC().average(), model
377:                                .getFootprintAfterGC().standardDeviation()));
378:                        if (fullGCDataVailable
379:                                && model.getRelativePostGCIncrease().getN() != 0) {
380:                            slopeAfterGCValue.setText(footprintSlopeFormatter
381:                                    .format(model.getPostGCSlope())
382:                                    + "/s");
383:                            avgRelativePostGCIncValue
384:                                    .setText(footprintSlopeFormatter
385:                                            .format(model
386:                                                    .getRelativePostGCIncrease()
387:                                                    .average())
388:                                            + "/coll");
389:                        } else {
390:                            slopeAfterGCValue.setText("n.a.");
391:                            avgRelativePostGCIncValue.setText("n.a.");
392:                            slopeAfterGCValue.setEnabled(false);
393:                            avgRelativePostGCIncValue.setEnabled(false);
394:                        }
395:                        freedMemoryByGCValue.setText(footprintFormatter
396:                                .format(model.getFreedMemoryByGC().getSum())
397:                                + " ("
398:                                + percentFormatter.format(model
399:                                        .getFreedMemoryByGC().getSum()
400:                                        * 100.0 / model.getFreedMemory())
401:                                + "%)");
402:                        avgFreedMemoryByGCValue.setText(footprintFormatter
403:                                .format(model.getFreedMemoryByGC().average())
404:                                + "/coll (\u03c3="
405:                                + sigmaMemoryFormat(model.getFreedMemoryByGC()
406:                                        .standardDeviation()) + ")");
407:                        avgFreedMemoryByGCValue.setEnabled(isSignificant(model
408:                                .getFreedMemoryByGC().average(), model
409:                                .getFreedMemoryByGC().standardDeviation()));
410:                    }
411:                    freedMemoryValue.setText(footprintFormatter.format(model
412:                            .getFreedMemory()));
413:                }
414:
415:            }
416:
417:            private class PauseTab extends JPanel {
418:                private JLabel fullGCPauseValue;
419:                private JLabel gcPauseValue;
420:                private JLabel avgFullGCPauseValue;
421:                private JLabel avgGCPauseValue;
422:                private JLabel avgPauseValue;
423:                private JLabel minPauseValue;
424:                private JLabel maxPauseValue;
425:                private JLabel accumPauseValue;
426:
427:                public PauseTab() {
428:                    GridBagLayout layout = new GridBagLayout();
429:                    GridBagConstraints constraints = new GridBagConstraints();
430:                    constraints.anchor = GridBagConstraints.WEST;
431:                    constraints.fill = GridBagConstraints.HORIZONTAL;
432:                    constraints.weightx = 1.0;
433:                    constraints.weighty = 1.0;
434:                    constraints.insets = new Insets(0, 3, 0, 3);
435:                    constraints.gridy = -1;
436:                    setLayout(layout);
437:
438:                    JLabel accumPauseLabel = new JLabel(localStrings
439:                            .getString("data_panel_acc_pauses"));
440:                    constraints.gridy++;
441:                    constraints.gridx = 0;
442:                    layout.setConstraints(accumPauseLabel, constraints);
443:                    add(accumPauseLabel);
444:                    accumPauseValue = new JLabel("", JLabel.RIGHT);
445:                    constraints.gridx = 1;
446:                    layout.setConstraints(accumPauseValue, constraints);
447:                    add(accumPauseValue);
448:
449:                    // full gc pauses
450:                    JLabel fullGCPauseLabel = new JLabel(localStrings
451:                            .getString("data_panel_acc_fullgcpauses"));
452:                    constraints.gridy++;
453:                    constraints.gridx = 0;
454:                    layout.setConstraints(fullGCPauseLabel, constraints);
455:                    add(fullGCPauseLabel);
456:                    fullGCPauseValue = new JLabel("", JLabel.RIGHT);
457:                    constraints.gridx = 1;
458:                    layout.setConstraints(fullGCPauseValue, constraints);
459:                    add(fullGCPauseValue);
460:
461:                    // gc pauses
462:                    JLabel gcPauseLabel = new JLabel(localStrings
463:                            .getString("data_panel_acc_gcpauses"));
464:                    constraints.gridy++;
465:                    constraints.gridx = 0;
466:                    layout.setConstraints(gcPauseLabel, constraints);
467:                    add(gcPauseLabel);
468:                    gcPauseValue = new JLabel("", JLabel.RIGHT);
469:                    constraints.gridx = 1;
470:                    layout.setConstraints(gcPauseValue, constraints);
471:                    add(gcPauseValue);
472:
473:                    JLabel minPauseLabel = new JLabel(localStrings
474:                            .getString("data_panel_min_pause"));
475:                    constraints.gridy++;
476:                    constraints.gridx = 0;
477:                    layout.setConstraints(minPauseLabel, constraints);
478:                    add(minPauseLabel);
479:                    minPauseValue = new JLabel("", JLabel.RIGHT);
480:                    constraints.gridx = 1;
481:                    layout.setConstraints(minPauseValue, constraints);
482:                    add(minPauseValue);
483:
484:                    JLabel maxPauseLabel = new JLabel(localStrings
485:                            .getString("data_panel_max_pause"));
486:                    constraints.gridy++;
487:                    constraints.gridx = 0;
488:                    layout.setConstraints(maxPauseLabel, constraints);
489:                    add(maxPauseLabel);
490:                    maxPauseValue = new JLabel("", JLabel.RIGHT);
491:                    constraints.gridx = 1;
492:                    layout.setConstraints(maxPauseValue, constraints);
493:                    add(maxPauseValue);
494:
495:                    JLabel avgPauseLabel = new JLabel(localStrings
496:                            .getString("data_panel_avg_pause"));
497:                    constraints.gridy++;
498:                    constraints.gridx = 0;
499:                    layout.setConstraints(avgPauseLabel, constraints);
500:                    add(avgPauseLabel);
501:                    avgPauseValue = new JLabel("", JLabel.RIGHT);
502:                    constraints.gridx = 1;
503:                    layout.setConstraints(avgPauseValue, constraints);
504:                    add(avgPauseValue);
505:
506:                    JLabel avgFullGCPauseLabel = new JLabel(localStrings
507:                            .getString("data_panel_avg_fullgcpause"));
508:                    constraints.gridy++;
509:                    constraints.gridx = 0;
510:                    layout.setConstraints(avgFullGCPauseLabel, constraints);
511:                    add(avgFullGCPauseLabel);
512:                    avgFullGCPauseValue = new JLabel("", JLabel.RIGHT);
513:                    constraints.gridx = 1;
514:                    layout.setConstraints(avgFullGCPauseValue, constraints);
515:                    add(avgFullGCPauseValue);
516:
517:                    JLabel avgGCPauseLabel = new JLabel(localStrings
518:                            .getString("data_panel_avg_gcpause"));
519:                    constraints.gridy++;
520:                    constraints.gridx = 0;
521:                    layout.setConstraints(avgGCPauseLabel, constraints);
522:                    add(avgGCPauseLabel);
523:                    avgGCPauseValue = new JLabel("", JLabel.RIGHT);
524:                    constraints.gridx = 1;
525:                    layout.setConstraints(avgGCPauseValue, constraints);
526:                    add(avgGCPauseValue);
527:
528:                }
529:
530:                public void setModel(GCModel model) {
531:                    final boolean pauseDataAvailable = model.getPause().getN() != 0;
532:                    final boolean gcDataAvailable = model.getGCPause().getN() > 0;
533:                    final boolean fullGCDataAvailable = model.getFullGCPause()
534:                            .getN() > 0;
535:                    avgPauseValue.setEnabled(pauseDataAvailable);
536:                    minPauseValue.setEnabled(pauseDataAvailable);
537:                    maxPauseValue.setEnabled(pauseDataAvailable);
538:                    avgGCPauseValue.setEnabled(pauseDataAvailable);
539:                    avgFullGCPauseValue.setEnabled(pauseDataAvailable);
540:                    if (pauseDataAvailable) {
541:                        avgPauseValue.setEnabled(isSignificant(model.getPause()
542:                                .average(), model.getPause()
543:                                .standardDeviation()));
544:                        avgPauseValue.setText(pauseFormatter.format(model
545:                                .getPause().average())
546:                                + "s (\u03c3="
547:                                + pauseFormatter.format(model.getPause()
548:                                        .standardDeviation()) + ")");
549:                        minPauseValue.setText(pauseFormatter.format(model
550:                                .getPause().getMin())
551:                                + "s");
552:                        maxPauseValue.setText(pauseFormatter.format(model
553:                                .getPause().getMax())
554:                                + "s");
555:
556:                        avgGCPauseValue.setEnabled(gcDataAvailable);
557:                        if (gcDataAvailable) {
558:                            avgGCPauseValue.setEnabled(isSignificant(model
559:                                    .getGCPause().average(), model.getGCPause()
560:                                    .standardDeviation()));
561:                            avgGCPauseValue.setText(pauseFormatter.format(model
562:                                    .getGCPause().average())
563:                                    + "s (\u03c3="
564:                                    + pauseFormatter.format(model.getGCPause()
565:                                            .standardDeviation()) + ")");
566:                        } else {
567:                            avgGCPauseValue.setText("n.a.");
568:                        }
569:                        avgFullGCPauseValue.setEnabled(fullGCDataAvailable);
570:                        if (fullGCDataAvailable) {
571:                            avgFullGCPauseValue.setEnabled(isSignificant(model
572:                                    .getFullGCPause().average(), model
573:                                    .getPause().standardDeviation()));
574:                            avgFullGCPauseValue.setText(pauseFormatter
575:                                    .format(model.getFullGCPause().average())
576:                                    + "s (\u03c3="
577:                                    + pauseFormatter.format(model
578:                                            .getFullGCPause()
579:                                            .standardDeviation()) + ")");
580:                        } else {
581:                            avgFullGCPauseValue.setText("n.a.");
582:                        }
583:                    } else {
584:                        avgPauseValue.setText("n.a.");
585:                        minPauseValue.setText("n.a.");
586:                        maxPauseValue.setText("n.a.");
587:                        avgGCPauseValue.setText("n.a.");
588:                        avgFullGCPauseValue.setText("n.a.");
589:                    }
590:                    accumPauseValue.setText(gcTimeFormatter.format(model
591:                            .getPause().getSum())
592:                            + "s");
593:                    fullGCPauseValue
594:                            .setText(gcTimeFormatter.format(model
595:                                    .getFullGCPause().getSum())
596:                                    + "s ("
597:                                    + percentFormatter
598:                                            .format(model.getFullGCPause()
599:                                                    .getSum()
600:                                                    * 100.0
601:                                                    / model.getPause().getSum())
602:                                    + "%)");
603:                    gcPauseValue
604:                            .setText(gcTimeFormatter.format(model.getGCPause()
605:                                    .getSum())
606:                                    + "s ("
607:                                    + percentFormatter
608:                                            .format(model.getGCPause().getSum()
609:                                                    * 100.0
610:                                                    / model.getPause().getSum())
611:                                    + "%)");
612:                }
613:            }
614:
615:            private class SummaryTab extends JPanel {
616:                private JLabel footprintValue;
617:                private JLabel accumPauseValue;
618:                private JLabel throughputValue;
619:                private JLabel totalTimeValue;
620:                private JLabel freedMemoryPerMinValue;
621:                private JLabel freedMemoryValue;
622:                private JLabel fullGCPerformanceValue;
623:                private JLabel gcPerformanceValue;
624:
625:                public SummaryTab() {
626:                    GridBagLayout layout = new GridBagLayout();
627:                    GridBagConstraints constraints = new GridBagConstraints();
628:                    constraints.anchor = GridBagConstraints.WEST;
629:                    constraints.fill = GridBagConstraints.HORIZONTAL;
630:                    constraints.weightx = 1.0;
631:                    constraints.weighty = 1.0;
632:                    constraints.insets = new Insets(0, 3, 0, 3);
633:                    constraints.gridy = -1;
634:                    setLayout(layout);
635:
636:                    // footprint
637:                    JLabel footprintLabel = new JLabel(localStrings
638:                            .getString("data_panel_footprint"));
639:                    constraints.gridy++;
640:                    constraints.gridx = 0;
641:                    layout.setConstraints(footprintLabel, constraints);
642:                    add(footprintLabel);
643:                    footprintValue = new JLabel("", JLabel.RIGHT);
644:                    constraints.gridx = 1;
645:                    layout.setConstraints(footprintValue, constraints);
646:                    add(footprintValue);
647:
648:                    // freed memory
649:                    JLabel freedMemoryLabel = new JLabel(localStrings
650:                            .getString("data_panel_freedmemory"));
651:                    constraints.gridy++;
652:                    constraints.gridx = 0;
653:                    layout.setConstraints(freedMemoryLabel, constraints);
654:                    add(freedMemoryLabel);
655:                    freedMemoryValue = new JLabel("", JLabel.RIGHT);
656:                    constraints.gridx = 1;
657:                    layout.setConstraints(freedMemoryValue, constraints);
658:                    add(freedMemoryValue);
659:
660:                    JLabel freedMemoryPerMinLabel = new JLabel(localStrings
661:                            .getString("data_panel_freedmemorypermin"));
662:                    constraints.gridy++;
663:                    constraints.gridx = 0;
664:                    layout.setConstraints(freedMemoryPerMinLabel, constraints);
665:                    add(freedMemoryPerMinLabel);
666:                    freedMemoryPerMinValue = new JLabel("", JLabel.RIGHT);
667:                    constraints.gridx = 1;
668:                    layout.setConstraints(freedMemoryPerMinValue, constraints);
669:                    add(freedMemoryPerMinValue);
670:
671:                    JLabel totalTimeLabel = new JLabel(localStrings
672:                            .getString("data_panel_total_time"));
673:                    constraints.gridy++;
674:                    constraints.gridx = 0;
675:                    layout.setConstraints(totalTimeLabel, constraints);
676:                    add(totalTimeLabel);
677:                    totalTimeValue = new JLabel("", JLabel.RIGHT);
678:                    constraints.gridx = 1;
679:                    layout.setConstraints(totalTimeValue, constraints);
680:                    add(totalTimeValue);
681:
682:                    JLabel accumPauseLabel = new JLabel(localStrings
683:                            .getString("data_panel_acc_pauses"));
684:                    constraints.gridy++;
685:                    constraints.gridx = 0;
686:                    layout.setConstraints(accumPauseLabel, constraints);
687:                    add(accumPauseLabel);
688:                    accumPauseValue = new JLabel("", JLabel.RIGHT);
689:                    constraints.gridx = 1;
690:                    layout.setConstraints(accumPauseValue, constraints);
691:                    add(accumPauseValue);
692:
693:                    JLabel throughputLabel = new JLabel(localStrings
694:                            .getString("data_panel_throughput"));
695:                    constraints.gridy++;
696:                    constraints.gridx = 0;
697:                    layout.setConstraints(throughputLabel, constraints);
698:                    add(throughputLabel);
699:                    throughputValue = new JLabel("", JLabel.RIGHT);
700:                    constraints.gridx = 1;
701:                    layout.setConstraints(throughputValue, constraints);
702:                    add(throughputValue);
703:
704:                    // fullgc performance
705:                    JLabel fullGCPerformanceLabel = new JLabel(localStrings
706:                            .getString("data_panel_performance_fullgc"));
707:                    constraints.gridy++;
708:                    constraints.gridx = 0;
709:                    layout.setConstraints(fullGCPerformanceLabel, constraints);
710:                    add(fullGCPerformanceLabel);
711:                    fullGCPerformanceValue = new JLabel("", JLabel.RIGHT);
712:                    constraints.gridx = 1;
713:                    layout.setConstraints(fullGCPerformanceValue, constraints);
714:                    add(fullGCPerformanceValue);
715:
716:                    // gc performance
717:                    JLabel gcPerformanceLabel = new JLabel(localStrings
718:                            .getString("data_panel_performance_gc"));
719:                    constraints.gridy++;
720:                    constraints.gridx = 0;
721:                    layout.setConstraints(gcPerformanceLabel, constraints);
722:                    add(gcPerformanceLabel);
723:                    gcPerformanceValue = new JLabel("", JLabel.RIGHT);
724:                    constraints.gridx = 1;
725:                    layout.setConstraints(gcPerformanceValue, constraints);
726:                    add(gcPerformanceValue);
727:                }
728:
729:                public void setModel(GCModel model) {
730:                    accumPauseValue.setText(gcTimeFormatter.format(model
731:                            .getPause().getSum())
732:                            + "s");
733:                    footprintValue.setText(footprintFormatter.format(model
734:                            .getFootprint()));
735:                    freedMemoryValue.setText(footprintFormatter.format(model
736:                            .getFreedMemory()));
737:                    if (model.hasCorrectTimestamp()) {
738:                        throughputValue.setText(throughputFormatter
739:                                .format(model.getThroughput())
740:                                + "%");
741:                        totalTimeValue
742:                                .setText(totalTimeFormatter.format(new Date(
743:                                        (long) model.getRunningTime() * 1000l)));
744:                        freedMemoryPerMinValue
745:                                .setText(freedMemoryPerMinFormatter
746:                                        .format(model.getFreedMemory()
747:                                                / model.getRunningTime() * 60.0)
748:                                        + "/min");
749:                    } else {
750:                        throughputValue.setText("n.a.");
751:                        totalTimeValue.setText("n.a.");
752:                        freedMemoryPerMinValue.setText("n.a.");
753:                    }
754:                    final boolean gcDataAvailable = model.getGCPause().getN() > 0;
755:                    gcPerformanceValue.setEnabled(gcDataAvailable);
756:                    if (gcDataAvailable) {
757:                        gcPerformanceValue.setText(footprintFormatter
758:                                .format(model.getFreedMemoryByGC().getSum()
759:                                        / model.getGCPause().getSum())
760:                                + "/s");
761:                    } else {
762:                        gcPerformanceValue.setText("n.a.");
763:                    }
764:                    final boolean fullGCDataAvailable = model.getFullGCPause()
765:                            .getN() > 0;
766:                    fullGCPerformanceValue.setEnabled(fullGCDataAvailable);
767:                    if (fullGCDataAvailable) {
768:                        fullGCPerformanceValue.setText(footprintFormatter
769:                                .format(model.getFreedMemoryByFullGC().getSum()
770:                                        / model.getFullGCPause().getSum())
771:                                + "/s");
772:                    } else {
773:                        fullGCPerformanceValue.setText("n.a.");
774:                    }
775:                }
776:
777:            }
778:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.