Source Code Cross Referenced for ProfilerResult.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » components » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.components.profiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.cocoon.components.profiler;
018:
019:        /**
020:         * A ProfilerResult stores a collection of the lastest n ProfilerDatas 
021:         * for one pipeline.
022:         *
023:         * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
024:         * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
025:         * @author <a href="mailto:bruno@outerthought.org">Bruno Dumon</a>
026:         * @version CVS $Id: ProfilerResult.java 433543 2006-08-22 06:22:54Z crossley $
027:         */
028:        public class ProfilerResult {
029:
030:            // URI of the request
031:            private String uri;
032:
033:            // Roles of the sitemap components
034:            private String[] roles;
035:
036:            // Sources of the sitemap components
037:            private String[] sources;
038:
039:            // Count of the ProfilerData entries
040:            private int count = 0;
041:
042:            // Environment information of each request.
043:            private EnvironmentInfo[] latestEnvironmentInfo;
044:
045:            // Total times of each request
046:            private long[] totalTime;
047:
048:            // Setup times of each component of the latest n-requests
049:            private long[][] latestSetupTimes;
050:
051:            // Processing times of each component of the latest n-requests
052:            private long[][] latestProcessingTimes;
053:
054:            // SAX fragments of eac component of the latest n-requests
055:            private Object[][] latestFragments;
056:
057:            public ProfilerResult(String uri, int latestResultsCount) {
058:                this .uri = uri;
059:                this .latestEnvironmentInfo = new EnvironmentInfo[(latestResultsCount > 0) ? latestResultsCount
060:                        : 5];
061:                this .latestSetupTimes = new long[(latestResultsCount > 0) ? latestResultsCount
062:                        : 5][];
063:                this .latestProcessingTimes = new long[(latestResultsCount > 0) ? latestResultsCount
064:                        : 5][];
065:                this .totalTime = new long[(latestResultsCount > 0) ? latestResultsCount
066:                        : 5];
067:                this .latestFragments = new Object[(latestResultsCount > 0) ? latestResultsCount
068:                        : 5][];
069:                this .count = 0;
070:            }
071:
072:            /**
073:             * Add a new profiler data from a request to the result.
074:             */
075:            public void addData(ProfilerData data) {
076:                ProfilerData.Entry[] entries = data.getEntries();
077:                synchronized (this ) {
078:                    if (roles == null || roles.length != entries.length) {
079:                        // Reinitialize arrays about the pipeline
080:                        roles = new String[entries.length];
081:                        sources = new String[entries.length];
082:                        for (int i = 0; i < entries.length; i++) {
083:                            roles[i] = entries[i].role;
084:                            sources[i] = entries[i].source;
085:                        }
086:
087:                        // Clear counter
088:                        this .count = 0;
089:                    }
090:
091:                    if (latestProcessingTimes != null) {
092:                        // move the current data 
093:                        for (int i = latestProcessingTimes.length - 1; i > 0; i--) {
094:                            latestEnvironmentInfo[i] = latestEnvironmentInfo[i - 1];
095:                            totalTime[i] = totalTime[i - 1];
096:                            latestSetupTimes[i] = latestSetupTimes[i - 1];
097:                            latestProcessingTimes[i] = latestProcessingTimes[i - 1];
098:                            latestFragments[i] = latestFragments[i - 1];
099:                        }
100:                        latestEnvironmentInfo[0] = data.getEnvironmentInfo();
101:                        totalTime[0] = data.getTotalTime();
102:
103:                        latestSetupTimes[0] = new long[entries.length];
104:                        for (int i = 0; i < entries.length; i++)
105:                            this .latestSetupTimes[0][i] = entries[i].setup;
106:
107:                        latestProcessingTimes[0] = new long[entries.length];
108:                        for (int i = 0; i < entries.length; i++)
109:                            this .latestProcessingTimes[0][i] = entries[i].time;
110:
111:                        latestFragments[0] = new Object[entries.length];
112:                        for (int i = 0; i < entries.length; i++)
113:                            latestFragments[0][i] = entries[i].fragment;
114:
115:                        if (count < latestProcessingTimes.length)
116:                            count++;
117:                    }
118:                }
119:            }
120:
121:            /**
122:             * The URI of the request.
123:             */
124:            public String getURI() {
125:                return uri;
126:            }
127:
128:            /**
129:             * Roles of the sitemap components.
130:             */
131:            public String[] getRoles() {
132:                return roles;
133:            }
134:
135:            /**
136:             * Sources of the sitemap components.
137:             */
138:            public String[] getSources() {
139:                return sources;
140:            }
141:
142:            /**
143:             * Count of the ProfilerData entries
144:             */
145:            public int getCount() {
146:                return count;
147:            }
148:
149:            /**
150:             * Environment infomation of the latest n-requests
151:             */
152:            public EnvironmentInfo[] getLatestEnvironmentInfos() {
153:                return latestEnvironmentInfo;
154:            }
155:
156:            /**
157:             * Total times of each request.
158:             */
159:            public long[] getTotalTime() {
160:                return totalTime;
161:            }
162:
163:            /**
164:             * Setup times of each component of the latest n-requests
165:             */
166:            public long[][] getSetupTimes() {
167:                return latestSetupTimes;
168:            }
169:
170:            /**
171:             * Processing times of each component of the latest n-requests
172:             */
173:            public long[][] getProcessingTimes() {
174:                return latestProcessingTimes;
175:            }
176:
177:            /**
178:             * SAX fragment of each component of the latest n-requests
179:             */
180:            public Object[][] getSAXFragments() {
181:                return latestFragments;
182:            }
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.