Source Code Cross Referenced for ProfilerSettingsDialog.java in  » IDE » tIDE » tide » profiler » 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 » IDE » tIDE » tide.profiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package tide.profiler;
002:
003:        import tide.project.*;
004:        import tide.editor.*;
005:        import javax.swing.*;
006:        import java.awt.*;
007:        import java.awt.event.*;
008:        import javax.swing.border.*;
009:        import java.util.*;
010:        import java.io.*;
011:        import snow.utils.*;
012:        import snow.utils.storage.*;
013:        import snow.utils.gui.*;
014:
015:        /** Configures the internal HPROF profiler.
016:         */
017:        public final class ProfilerSettingsDialog extends JDialog {
018:            private JTextField stacktraceDepth = new JTextField(6);
019:            private JTextField samplingInterval = new JTextField(8);
020:            private JTextField cutoff = new JTextField(8);
021:            private JButton viewOpts = new JButton("View HPROF help", Icons
022:                    .createHelpIcon(16, true));
023:            private final ProjectSettings settings;
024:
025:            public ProfilerSettingsDialog(final JFrame parent,
026:                    final ProjectSettings settings) {
027:                super (parent, "JDK Profiler Settings", true);
028:                this .settings = settings;
029:
030:                JComponent ta = GUIUtils
031:                        .createReadOnlyDescriptionArea("Already since JDK1.2.2, java, javac and other JDK tools have an integrated profiler."
032:                                + "\nCPU and memory usage can be monitored. One can find out which methods takes "
033:                                + "\nmost CPU time or waste at most memory resoures."
034:                                + "\r\nCAUTION: HProf is not an official product or formal part of the JDK."
035:                                + "\n\nSampling modes leads to inacurate results but doesn't slow the running application."
036:                                + "\nThe standard profilers can be started from the sources tree context menu."
037:                                + "\nThe profiler outputs are in the folder \".tide/profile\" of the project folder."
038:                                + "\nAt application end, the new profiler results are automatically added in an output tab,"
039:                                + "\nexcept for heap dumps. Old profiler results can be reopened from the Project menu."
040:                                + "\n\njmap and jHAT (standard since JDK6+) can be used from the processes tab to create live dumps"
041:                                + "\nand differential heap dumps and browse them at http://localhost:7000"
042:                                + "\n\nOf course, you can start the profiler manually: just pass the command to the Runtime JVM"
043:                                + "\narguments, for example \"-agentlib:hprof=heap=sites\"."
044:                                + "\nYou can also profile the other jdk tools (as javac or javadoc!), pass them the command with a"
045:                                + "\nprefixed -J before the agentlib command."
046:                                + "\n\nAn excellent usage help is available at  http://java.sun.com/javase/6/webnotes/trouble/"
047:
048:                        );
049:
050:                //ta.setEditable(false);
051:                //ta.setBackground(getBackground());
052:                //ta.setBorder(BorderFactory.createEmptyBorder(5,10,10,5));
053:                add(ta, BorderLayout.NORTH);
054:
055:                JPanel inputPanel = new JPanel();
056:                add(inputPanel, BorderLayout.CENTER);
057:                GridLayout3 gl3 = new GridLayout3(2, inputPanel);
058:                gl3.addSeparator();
059:
060:                gl3.add(viewOpts);
061:                viewOpts.setMargin(new Insets(0, 2, 0, 2));
062:                gl3.add(""); //displays the command line help of HPROF");
063:                viewOpts.addActionListener(new ActionListener() {
064:                    public void actionPerformed(ActionEvent ae) {
065:                        displayOptions();
066:                    }
067:                });
068:                //viewOpts
069:
070:                gl3.add("Stacktrace depths");
071:                gl3.add(stacktraceDepth);
072:                try {
073:                    stacktraceDepth.setText(settings.getProperty(
074:                            "Profiler_stacktraceDepth", "5"));
075:                } catch (Exception e) {
076:                }
077:
078:                gl3.add("Sampling interval [ms]");
079:                gl3.add(samplingInterval);
080:                try {
081:                    samplingInterval.setText(settings.getProperty(
082:                            "Profiler_samplingInterval", "30"));
083:                } catch (Exception e) {
084:                }
085:
086:                gl3.add("Cutoff [ms]");
087:                gl3.add(cutoff);
088:                try {
089:                    cutoff.setText(settings.getProperty("Profiler_cutoff",
090:                            "0.0001"));
091:                } catch (Exception e) {
092:                }
093:
094:                //gl3.add("Hat tool [optional tool to analyse dumps]");
095:                //gl3.add(hatLoc);
096:                //    hatLoc.setComponentWidth(200);
097:                //    hatLoc.setPath( settings.getProperty("Profiler_hat_loc", "c:/java/hat/hat.jar"));
098:
099:                CloseControlPanel ccp = new CloseControlPanel(this , true, true,
100:                        "Ok");
101:                add(ccp, BorderLayout.SOUTH);
102:
103:                pack();
104:                this .setLocationRelativeTo(parent);
105:                this .setVisible(true); // MODAL => waits
106:
107:                if (ccp.getWasCancelled())
108:                    return;
109:
110:                // save settings
111:                settings.setProperty("Profiler_stacktraceDepth",
112:                        stacktraceDepth.getText());
113:                settings.setProperty("Profiler_samplingInterval",
114:                        samplingInterval.getText());
115:                settings.setProperty("Profiler_cutoff", cutoff.getText());
116:                //    settings.setProperty("Profiler_hat_loc", hatLoc.getPath().getAbsolutePath());
117:            }
118:
119:            private void displayOptions() {
120:                ProjectSettings actualProject = settings; //MainEditorFrame.instance.getActualProject();
121:                StringBuilder comp = new StringBuilder();
122:                try {
123:                    Vector<String> args = new Vector<String>();
124:                    args.add(actualProject.getJava_TOOL().getAbsolutePath());
125:                    args.add("-agentlib:hprof=help");
126:                    comp.append(ProcessUtils.readWholeProcessStack(args));
127:                } catch (Exception e) {
128:                    comp.append("\r\nError: " + e.getMessage());
129:                    e.printStackTrace();
130:                }
131:
132:                JDialog optionsDialog = new JDialog(this ,
133:                        "HPROF Help  (java -agentlib:hprof=help)", false);
134:                JTextPane tp = new JTextPane();
135:                tp.setFont(MainEditorFrame.fixedWidthFontForProcesses);
136:                tp.setText(comp.toString().trim());
137:                optionsDialog.add(new JScrollPane(tp), BorderLayout.CENTER);
138:                CloseControlPanel ccp = new CloseControlPanel(optionsDialog,
139:                        false, true, "Close");
140:                optionsDialog.add(ccp, BorderLayout.SOUTH);
141:                tp.setEditable(false);
142:                tp.setCaretPosition(0);
143:                optionsDialog.setSize(680, 700);
144:                optionsDialog.setLocationRelativeTo(viewOpts);
145:                optionsDialog.setVisible(true);
146:            }
147:
148:            /*test
149:             public static void main(String[] aa)
150:             {
151:             JFrame f = new JFrame("Test");
152:             f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
153:             ProjectSettings props = new ProjectSettings();
154:             props.setJava_Home(new File("c:/java/jdk1.6.0_05/"));
155:             new ProfilerSettingsDialog(f, props);
156:             System.exit(0);
157:             }*/
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.