Source Code Cross Referenced for ProfilerEngineSettings.java in  » IDE-Netbeans » cvsclient » org » netbeans » lib » 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 Netbeans » cvsclient » org.netbeans.lib.profiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         * The Original Software is NetBeans. The Initial Developer of the Original
026:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
027:         * Microsystems, Inc. All Rights Reserved.
028:         *
029:         * If you wish your version of this file to be governed by only the CDDL
030:         * or only the GPL Version 2, indicate your decision by adding
031:         * "[Contributor] elects to include this software in this distribution
032:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
033:         * single choice of license, a recipient has the option to distribute
034:         * your version of this file under either the CDDL, the GPL Version 2 or
035:         * to extend the choice of license to its licensees as provided above.
036:         * However, if you add GPL Version 2 code and therefore, elected the GPL
037:         * Version 2 license, then the option applies only if the new code is
038:         * made subject to such option by the copyright holder.
039:         */
040:
041:        package org.netbeans.lib.profiler;
042:
043:        import org.netbeans.lib.profiler.client.ClientUtils;
044:        import org.netbeans.lib.profiler.client.RuntimeProfilingPoint;
045:        import org.netbeans.lib.profiler.global.CommonConstants;
046:        import org.netbeans.lib.profiler.global.InstrumentationFilter;
047:        import org.netbeans.lib.profiler.global.Platform;
048:        import org.netbeans.lib.profiler.marker.Marker;
049:        import org.netbeans.lib.profiler.utils.MiscUtils;
050:        import org.netbeans.lib.profiler.utils.StringUtils;
051:        import java.io.File;
052:        import java.io.IOException;
053:
054:        /**
055:         * Global profiler session and engine settings, that are used in various parts of the system.
056:         *
057:         * @author Misha Dmitriev
058:         * @author Ian Formanek
059:         */
060:        public final class ProfilerEngineSettings implements  CommonConstants,
061:                Cloneable {
062:            //~ Instance fields ----------------------------------------------------------------------------------------------------------
063:
064:            private InstrumentationFilter instrumentationFilter = InstrumentationFilter
065:                    .getDefault();
066:            private Marker methodMarker = Marker.DEFAULT;
067:            private String jFluidRootDirName;
068:            private String jvmArgs; // the arguments for JVM running the TA
069:            private String mainArgs; // the TA arguments
070:            private String mainClassName; // the TA main class name
071:
072:            // Target application setup-specific settings
073:            private String mainClassPath = ""; // NOI18N           // the classpath for starting TA
074:            private String remoteHost = ""; // NOI18N                  // Remote host name in case of remote profiling, "" for local profiling
075:            private String targetJDKVersion = Platform.JDK_15_STRING; // the target JVM version string: see Platform.JDK_xx_STRING constants
076:            private String targetJVMExeFile; // the JVM executable to run the TA
077:            private String targetJVMStartupDirName; // the working directory for TA we are attaching to
078:            private String workingDir = System.getProperty("user.dir"); // NOI18N // the TA working directory
079:            private ClientUtils.SourceCodeSelection[] instrumentationRootMethods = new ClientUtils.SourceCodeSelection[0];
080:            private RuntimeProfilingPoint[] profilingPoints = new RuntimeProfilingPoint[0];
081:
082:            // THE FOLLOWING DATA IS REGENERATED ON EACH NEW JFLUID RUN AND/OR PROFILING SESSION WITHIN ONE RUN
083:            private String[] vmClassPaths = new String[3]; // Target VM's java.class.path, java.ext.dirs and sun.boot.class.path
084:            private boolean absoluteTimerOn = true;
085:            private boolean dontShowZeroLiveObjAllocPaths = true;
086:            private boolean excludeWaitTime = true;
087:            private boolean instrumentEmptyMethods = false;
088:
089:            // JFluid and instrumentation-specific settings
090:            private boolean instrumentGetterSetterMethods = false;
091:            private boolean instrumentMethodInvoke = true;
092:            private boolean instrumentSpawnedThreads = false;
093:            private boolean runGCOnGetResultsInMemoryProfiling = false;
094:
095:            // If false, the exec command is issued so that there is no visible console for the TA
096:            private boolean separateConsole = true;
097:            private boolean sortResultsByThreadCPUTime = false;
098:            private boolean suspendTargetApp = false;
099:            private boolean targetWindowRemains = false;
100:            private boolean threadCPUTimerOn = false;
101:            private int allocStackTraceLimit = -5; // Negative number means full (unlimited) depth actually used, although the limit is preserved
102:            private int allocTrackEvery = 10;
103:            private int architecture; // system architecture 32bit/64bit
104:            private int codeRegionCPUResBufSize = 1000;
105:            private int cpuProfilingType = CPU_INSTR_FULL;
106:            private int instrScheme = INSTRSCHEME_LAZY; // See CommonConstants for definitions
107:            private int nProfiledThreadsLimit = 32;
108:            private int portNo = 5140;
109:            private int samplingInterval = 10;
110:
111:            //~ Methods ------------------------------------------------------------------------------------------------------------------
112:
113:            public void setAbsoluteTimerOn(boolean v) {
114:                absoluteTimerOn = v;
115:            }
116:
117:            public boolean getAbsoluteTimerOn() {
118:                return absoluteTimerOn;
119:            }
120:
121:            public void setAllocStackTraceLimit(int depth) {
122:                allocStackTraceLimit = depth;
123:            }
124:
125:            public int getAllocStackTraceLimit() {
126:                return allocStackTraceLimit;
127:            }
128:
129:            public void setAllocTrackEvery(int interval) {
130:                if (interval < 1) {
131:                    interval = 1;
132:                }
133:
134:                allocTrackEvery = interval;
135:            }
136:
137:            public int getAllocTrackEvery() {
138:                return allocTrackEvery;
139:            }
140:
141:            public void setCPUProfilingType(int v) {
142:                cpuProfilingType = v;
143:            }
144:
145:            public int getCPUProfilingType() {
146:                return cpuProfilingType;
147:            }
148:
149:            public void setCodeRegionCPUResBufSize(int size) {
150:                codeRegionCPUResBufSize = size;
151:            }
152:
153:            public int getCodeRegionCPUResBufSize() {
154:                return codeRegionCPUResBufSize;
155:            }
156:
157:            public void setDontShowZeroLiveObjAllocPaths(boolean v) {
158:                dontShowZeroLiveObjAllocPaths = v;
159:            } // TODO CHECK: unused method
160:
161:            public boolean getDontShowZeroLiveObjAllocPaths() {
162:                return dontShowZeroLiveObjAllocPaths;
163:            } // TODO CHECK: unused method
164:
165:            public void setExcludeWaitTime(boolean b) {
166:                excludeWaitTime = b;
167:            }
168:
169:            public boolean getExcludeWaitTime() {
170:                return excludeWaitTime;
171:            }
172:
173:            public void setInstrScheme(int scheme) {
174:                instrScheme = scheme;
175:            }
176:
177:            public int getInstrScheme() {
178:                return instrScheme;
179:            }
180:
181:            public void setInstrumentEmptyMethods(boolean b) {
182:                instrumentEmptyMethods = b;
183:            }
184:
185:            public boolean getInstrumentEmptyMethods() {
186:                return instrumentEmptyMethods;
187:            }
188:
189:            public void setInstrumentGetterSetterMethods(boolean b) {
190:                instrumentGetterSetterMethods = b;
191:            }
192:
193:            public boolean getInstrumentGetterSetterMethods() {
194:                return instrumentGetterSetterMethods;
195:            }
196:
197:            public void setInstrumentMethodInvoke(boolean b) {
198:                instrumentMethodInvoke = b;
199:            }
200:
201:            public boolean getInstrumentMethodInvoke() {
202:                return instrumentMethodInvoke;
203:            }
204:
205:            public void setInstrumentSpawnedThreads(boolean b) {
206:                instrumentSpawnedThreads = b;
207:            }
208:
209:            public boolean getInstrumentSpawnedThreads() {
210:                return instrumentSpawnedThreads;
211:            }
212:
213:            public void setInstrumentationFilter(InstrumentationFilter f) {
214:                instrumentationFilter = f;
215:            }
216:
217:            public InstrumentationFilter getInstrumentationFilter() {
218:                return instrumentationFilter;
219:            }
220:
221:            public void setInstrumentationRootMethods(
222:                    ClientUtils.SourceCodeSelection[] methods) {
223:                instrumentationRootMethods = methods;
224:            }
225:
226:            public ClientUtils.SourceCodeSelection[] getInstrumentationRootMethods() {
227:                return instrumentationRootMethods;
228:            }
229:
230:            public String getJFluidRootDirName() {
231:                return jFluidRootDirName;
232:            } // TODO: move elsewhere
233:
234:            public void setJVMArgs(String args) {
235:                jvmArgs = args;
236:            }
237:
238:            public String[] getJVMArgs() {
239:                return StringUtils.parseArgsString(jvmArgs);
240:            }
241:
242:            public String getJVMArgsAsSingleString() {
243:                return jvmArgs;
244:            }
245:
246:            public void setMainArgs(String args) {
247:                mainArgs = args;
248:            }
249:
250:            public String[] getMainArgs() {
251:                return StringUtils.parseArgsString(mainArgs);
252:            }
253:
254:            public String getMainArgsAsSingleString() {
255:                return mainArgs;
256:            }
257:
258:            public void setMainClass(String name) {
259:                mainClassName = name;
260:            }
261:
262:            public String getMainClassName() {
263:                return mainClassName;
264:            }
265:
266:            public void setMainClassPath(String cp) {
267:                mainClassPath = cp;
268:            }
269:
270:            public String getMainClassPath() {
271:                return mainClassPath;
272:            }
273:
274:            public void setMethodMarker(Marker marker) {
275:                methodMarker = marker;
276:            }
277:
278:            public Marker getMethodMarker() {
279:                return methodMarker;
280:            }
281:
282:            public void setNProfiledThreadsLimit(int num) {
283:                nProfiledThreadsLimit = num;
284:            }
285:
286:            public int getNProfiledThreadsLimit() {
287:                return nProfiledThreadsLimit;
288:            }
289:
290:            public void setPortNo(int pNo) {
291:                portNo = pNo;
292:            }
293:
294:            public int getPortNo() {
295:                return portNo;
296:            }
297:
298:            public void setRemoteHost(String host) {
299:                remoteHost = host;
300:            }
301:
302:            public String getRemoteHost() {
303:                return remoteHost;
304:            }
305:
306:            public void setRunGCOnGetResultsInMemoryProfiling(boolean v) {
307:                runGCOnGetResultsInMemoryProfiling = v;
308:            }
309:
310:            public boolean getRunGCOnGetResultsInMemoryProfiling() {
311:                return runGCOnGetResultsInMemoryProfiling;
312:            }
313:
314:            public void setRuntimeProfilingPoints(
315:                    RuntimeProfilingPoint[] profilingPoints) {
316:                this .profilingPoints = profilingPoints;
317:            }
318:
319:            public RuntimeProfilingPoint[] getRuntimeProfilingPoints() {
320:                return profilingPoints;
321:            }
322:
323:            public void setSamplingInterval(int num) {
324:                samplingInterval = num;
325:            }
326:
327:            public int getSamplingInterval() {
328:                return samplingInterval;
329:            }
330:
331:            public void setSeparateConsole(boolean separateConsole) {
332:                this .separateConsole = separateConsole;
333:            }
334:
335:            public boolean getSeparateConsole() {
336:                return separateConsole;
337:            }
338:
339:            public void setSortResultsByThreadCPUTime(boolean v) {
340:                sortResultsByThreadCPUTime = v;
341:            }
342:
343:            public boolean getSortResultsByThreadCPUTime() {
344:                return sortResultsByThreadCPUTime;
345:            }
346:
347:            public void setSuspendTargetApp(boolean b) {
348:                suspendTargetApp = b;
349:            } // TODO CHECK: unused method
350:
351:            public boolean getSuspendTargetApp() {
352:                return suspendTargetApp;
353:            } // TODO CHECK: unused method
354:
355:            public void setSystemArchitecture(int arch) {
356:                architecture = arch;
357:            }
358:
359:            public int getSystemArchitecture() {
360:                return architecture;
361:            }
362:
363:            public void setTargetJDKVersionString(String ver) {
364:                targetJDKVersion = ver;
365:            }
366:
367:            public String getTargetJDKVersionString() {
368:                return targetJDKVersion;
369:            }
370:
371:            public void setTargetJVMExeFile(String name) {
372:                targetJVMExeFile = name;
373:            }
374:
375:            public String getTargetJVMExeFile() {
376:                return targetJVMExeFile;
377:            }
378:
379:            public void setTargetJVMStartupDirName(String dir) {
380:                targetJVMStartupDirName = dir;
381:            } // TODO CHECK: unused method
382:
383:            public String getTargetJVMStartupDirName() {
384:                return targetJVMStartupDirName;
385:            } // TODO CHECK: unused method
386:
387:            public void setTargetWindowRemains(boolean b) {
388:                targetWindowRemains = b;
389:            }
390:
391:            public boolean getTargetWindowRemains() {
392:                return targetWindowRemains;
393:            }
394:
395:            public void setThreadCPUTimerOn(boolean v) {
396:                threadCPUTimerOn = v;
397:            }
398:
399:            public boolean getThreadCPUTimerOn() {
400:                return threadCPUTimerOn;
401:            }
402:
403:            public void setVMClassPaths(String javaClassPath,
404:                    String javaExtDirs, String bootClassPath) {
405:                vmClassPaths[0] = MiscUtils.getLiveClassPathSubset(
406:                        javaClassPath, getWorkingDir());
407:                vmClassPaths[1] = javaExtDirs;
408:                vmClassPaths[2] = bootClassPath;
409:
410:                // Now set the JFluid class path to match that in the target JVM
411:                try {
412:                    setMainClassPath(vmClassPaths[0]);
413:                } catch (Exception ex) {
414:                    throw new InternalError("Should not happen");
415:                } // NOI18N
416:            }
417:
418:            public String[] getVMClassPaths() {
419:                // Make sure that updates to the main class path work both ways
420:                vmClassPaths[0] = getMainClassPath();
421:
422:                return vmClassPaths;
423:            }
424:
425:            public void setWorkingDir(String name) {
426:                workingDir = name;
427:
428:                if ((workingDir == null) || "".equals(workingDir)) {
429:                    workingDir = System.getProperty("user.dir");
430:                }
431:            } // NOI18N
432:
433:            public String getWorkingDir() {
434:                return workingDir;
435:            }
436:
437:            public Object clone() {
438:                ProfilerEngineSettings clone = null;
439:
440:                try {
441:                    clone = (ProfilerEngineSettings) super .clone();
442:
443:                    // clone array of instrumentatio root methods one by one
444:                    clone.instrumentationRootMethods = new ClientUtils.SourceCodeSelection[instrumentationRootMethods.length];
445:
446:                    for (int i = 0; i < instrumentationRootMethods.length; i++) {
447:                        clone.instrumentationRootMethods[i] = (ClientUtils.SourceCodeSelection) instrumentationRootMethods[i]
448:                                .clone();
449:                    }
450:
451:                    // clone instrumentation filter
452:                    clone.instrumentationFilter = (InstrumentationFilter) instrumentationFilter
453:                            .clone();
454:
455:                    return clone;
456:                } catch (CloneNotSupportedException e) {
457:                    throw new InternalError(
458:                            "Should never happen: ProfilerEngineSettings.clone"); // NOI18N
459:                }
460:            }
461:
462:            public void initialize(String rootDirName) throws RuntimeException,
463:                    IOException {
464:                String jFluidNativeLibFullName = Platform
465:                        .getAgentNativeLibFullName(rootDirName, false, null, -1);
466:
467:                String jFluidNativeLibDirName = jFluidNativeLibFullName
468:                        .substring(0, jFluidNativeLibFullName.lastIndexOf('/')); // NOI18N
469:
470:                String checkedPath = ""; // NOI18N   // Needed only for error reporting
471:
472:                try {
473:                    File rootDir = MiscUtils
474:                            .checkDirForName(checkedPath = rootDirName);
475:                    MiscUtils
476:                            .checkDirForName(checkedPath = jFluidNativeLibDirName);
477:                    MiscUtils.checkFile(new File(
478:                            checkedPath = jFluidNativeLibFullName), false);
479:
480:                    jFluidRootDirName = rootDir.getCanonicalPath();
481:                } catch (IOException e) {
482:                    throw new IOException(
483:                            "Problem with a required JFluid installation directory or file "
484:                                    + checkedPath + "\nOriginal message: "
485:                                    + e.getMessage()); // NOI18N
486:                }
487:            }
488:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.