Source Code Cross Referenced for PerformanceTester.java in  » IDE-Eclipse » ui » org » eclipse » ui » tests » performance » 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 Eclipse » ui » org.eclipse.ui.tests.performance 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.tests.performance;
011:
012:        import junit.framework.TestCase;
013:
014:        import org.eclipse.test.performance.Dimension;
015:        import org.eclipse.test.performance.Performance;
016:        import org.eclipse.test.performance.PerformanceMeter;
017:
018:        /**
019:         * @since 3.1
020:         */
021:        final class PerformanceTester {
022:
023:            protected PerformanceMeter fPerformanceMeter;
024:
025:            /**
026:             * @param testCase
027:             */
028:            public PerformanceTester(TestCase testCase) {
029:                Performance performance = Performance.getDefault();
030:                fPerformanceMeter = performance
031:                        .createPerformanceMeter(performance
032:                                .getDefaultScenarioId(testCase));
033:            }
034:
035:            /**
036:             * Asserts default properties of the measurements captured for this test
037:             * case.
038:             * 
039:             * @throws RuntimeException if the properties do not hold
040:             */
041:            public void assertPerformance() {
042:                Performance.getDefault().assertPerformance(fPerformanceMeter);
043:            }
044:
045:            /**
046:             * Asserts that the measurement specified by the given dimension is within a
047:             * certain range with respect to some reference value. If the specified
048:             * dimension isn't available, the call has no effect.
049:             * 
050:             * @param dim
051:             *            the Dimension to check
052:             * @param lowerPercentage
053:             *            a negative number indicating the percentage the measured value
054:             *            is allowed to be smaller than some reference value
055:             * @param upperPercentage
056:             *            a positive number indicating the percentage the measured value
057:             *            is allowed to be greater than some reference value
058:             * @throws RuntimeException
059:             *            if the properties do not hold
060:             */
061:            public void assertPerformanceInRelativeBand(Dimension dim,
062:                    int lowerPercentage, int upperPercentage) {
063:                Performance.getDefault().assertPerformanceInRelativeBand(
064:                        fPerformanceMeter, dim, lowerPercentage,
065:                        upperPercentage);
066:            }
067:
068:            public void commitMeasurements() {
069:                fPerformanceMeter.commit();
070:            }
071:
072:            public void dispose() {
073:                fPerformanceMeter.dispose();
074:            }
075:
076:            /**
077:             * Called from within a test case immediately before the code to measure is
078:             * run. It starts capturing of performance data. Must be followed by a call
079:             * to {@link PerformanceTestCase#stopMeasuring()}before subsequent calls to
080:             * this method or {@link PerformanceTestCase#commitMeasurements()}.
081:             */
082:            public void startMeasuring() {
083:                fPerformanceMeter.start();
084:            }
085:
086:            public void stopMeasuring() {
087:                fPerformanceMeter.stop();
088:            }
089:
090:            /**
091:             * Mark the scenario of this test case to be included both into the global
092:             * and the local (component) performance summary. The summary shows the given dimension of the
093:             * scenario and labels the scenario with the short name.
094:             * 
095:             * @param shortName
096:             *            a short (shorter than 40 characters) descritive name of the scenario
097:             * @param dimension
098:             *            the dimension to show in the summary
099:             */
100:            public void tagAsGlobalSummary(String shortName, Dimension dimension) {
101:                Performance.getDefault().tagAsGlobalSummary(fPerformanceMeter,
102:                        shortName, new Dimension[] { dimension });
103:            }
104:
105:            /**
106:             * Mark the scenario represented by the given PerformanceMeter to be
107:             * included into the global and the local (component) performance summary. The summary shows the given
108:             * dimensions of the scenario and labels the scenario with the short name.
109:             * 
110:             * @param shortName
111:             *            a short (shorter than 40 characters) descritive name of the scenario
112:             * @param dimensions
113:             *            an array of dimensions to show in the summary
114:             */
115:            public void tagAsGlobalSummary(String shortName,
116:                    Dimension[] dimensions) {
117:                Performance.getDefault().tagAsGlobalSummary(fPerformanceMeter,
118:                        shortName, dimensions);
119:            }
120:
121:            /**
122:             * Mark the scenario of this test case to be included into the local (component)
123:             * performance summary. The summary shows the given dimension of the
124:             * scenario and labels the scenario with the short name.
125:             * 
126:             * @param shortName
127:             *            a short (shorter than 40 characters) descriptive name of the scenario
128:             * @param dimension
129:             *            the dimension to show in the summary
130:             */
131:            public void tagAsSummary(String shortName, Dimension dimension) {
132:                Performance.getDefault().tagAsSummary(fPerformanceMeter,
133:                        shortName, new Dimension[] { dimension });
134:            }
135:
136:            /**
137:             * Mark the scenario represented by the given PerformanceMeter to be
138:             * included into the local (component) performance summary. The summary shows the given
139:             * dimensions of the scenario and labels the scenario with the short name.
140:             * 
141:             * @param shortName
142:             *            a short (shorter than 40 characters) descriptive name of the scenario
143:             * @param dimensions
144:             *            an array of dimensions to show in the summary
145:             */
146:            public void tagAsSummary(String shortName, Dimension[] dimensions) {
147:                Performance.getDefault().tagAsSummary(fPerformanceMeter,
148:                        shortName, dimensions);
149:            }
150:
151:            /**
152:             * Set a degradation comment for the current meter.
153:             * @param string
154:             */
155:            public void setDegradationComment(String string) {
156:                Performance.getDefault().setComment(fPerformanceMeter,
157:                        Performance.EXPLAINS_DEGRADATION_COMMENT, string);
158:
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.