Source Code Cross Referenced for PerfDataBufferPrologue.java in  » 6.0-JDK-Modules-sun » jvmstat » sun » jvmstat » perfdata » monitor » v1_0 » 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 » 6.0 JDK Modules sun » jvmstat » sun.jvmstat.perfdata.monitor.v1_0 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package sun.jvmstat.perfdata.monitor.v1_0;
027:
028:        import sun.jvmstat.monitor.*;
029:        import sun.jvmstat.perfdata.monitor.*;
030:        import java.nio.*;
031:
032:        /**
033:         * Class representing the 1.0 version of the HotSpot PerfData instrumentation
034:         * buffer header.
035:         * <p>
036:         * The PerfDataBufferPrologue2_0 class supports parsing of the version
037:         * specific portions of the PerfDataPrologue C structure:
038:         * <pre>
039:         * typedef struct {
040:         *   ...                      // handled by superclass
041:         *   jint used;               // number of PerfData memory bytes used
042:         *   jint overflow;           // number of bytes of overflow
043:         *   jlong mod_time_stamp;    // time stamp of the last structural modification
044:         * } PerfDataPrologue
045:         * </pre>
046:         *
047:         * @author Brian Doherty
048:         * @version 1.8, 05/05/07
049:         * @since 1.5
050:         */
051:        public class PerfDataBufferPrologue extends
052:                AbstractPerfDataBufferPrologue {
053:
054:            private static final int SUPPORTED_MAJOR_VERSION = 1;
055:            private static final int SUPPORTED_MINOR_VERSION = 0;
056:
057:            /*
058:             * the following constants must match the field offsets and sizes
059:             * in the PerfDataPrologue structure in perfMemory.hpp
060:             */
061:            final static int PERFDATA_PROLOG_USED_OFFSET = 8;
062:            final static int PERFDATA_PROLOG_USED_SIZE = 4; // sizeof(int)
063:            final static int PERFDATA_PROLOG_OVERFLOW_OFFSET = 12;
064:            final static int PERFDATA_PROLOG_OVERFLOW_SIZE = 4; // sizeof(int)
065:            final static int PERFDATA_PROLOG_MODTIMESTAMP_OFFSET = 16;
066:            final static int PERFDATA_PROLOG_MODTIMESTAMP_SIZE = 8; // sizeof(long)
067:            final static int PERFDATA_PROLOG_SIZE = 24; // sizeof(struct PerfDataProlog)
068:
069:            // counter names for prologue psuedo counters
070:            final static String PERFDATA_BUFFER_SIZE_NAME = "sun.perfdata.size";
071:            final static String PERFDATA_BUFFER_USED_NAME = "sun.perfdata.used";
072:            final static String PERFDATA_OVERFLOW_NAME = "sun.perfdata.overflow";
073:            final static String PERFDATA_MODTIMESTAMP_NAME = "sun.perfdata.timestamp";
074:
075:            /**
076:             * Create an instance of PerfDataBufferPrologue from the given
077:             * ByteBuffer object.
078:             *
079:             * @param byteBuffer the buffer containing the binary header data
080:             */
081:            public PerfDataBufferPrologue(ByteBuffer byteBuffer)
082:                    throws MonitorException {
083:                super (byteBuffer);
084:                assert ((getMajorVersion() == 1) && (getMinorVersion() == 0));
085:            }
086:
087:            /**
088:             * {@inheritDoc}
089:             */
090:            public boolean supportsAccessible() {
091:                return false;
092:            }
093:
094:            /**
095:             * {@inheritDoc}
096:             */
097:            public boolean isAccessible() {
098:                return true;
099:            }
100:
101:            /**
102:             * Get the utilization of the instrumentation memory buffer.
103:             *
104:             * @return int - the utilization of the buffer
105:             */
106:            public int getUsed() {
107:                byteBuffer.position(PERFDATA_PROLOG_USED_OFFSET);
108:                return byteBuffer.getInt();
109:            }
110:
111:            /**
112:             * Get the size of the instrumentation memory buffer.
113:             *
114:             * @return int - the size of the buffer
115:             */
116:            public int getBufferSize() {
117:                return byteBuffer.capacity();
118:            }
119:
120:            /**
121:             * Get the buffer overflow amount. This value is non-zero if the
122:             * HotSpot JVM has overflowed the instrumentation memory buffer.
123:             * The target JVM can be restarted with -XX:PerfDataMemSize=X to
124:             * create a larger memory buffer.
125:             *
126:             * @return int - the size of the buffer
127:             */
128:            public int getOverflow() {
129:                byteBuffer.position(PERFDATA_PROLOG_OVERFLOW_OFFSET);
130:                return byteBuffer.getInt();
131:            }
132:
133:            /**
134:             * Get the time of last modification for the instrumentation
135:             * memory buffer. This method returns the time, as ticks since the
136:             * start of the target JVM, of the last structural modification to
137:             * the instrumentation buffer. Structural modifications correspond to
138:             * the addition or deletion of instrumentation objects. Updates to
139:             * counter values are not structural modifications.
140:             */
141:            public long getModificationTimeStamp() {
142:                byteBuffer.position(PERFDATA_PROLOG_MODTIMESTAMP_OFFSET);
143:                return byteBuffer.getLong();
144:            }
145:
146:            /**
147:             * {@inheritDoc}
148:             */
149:            public int getSize() {
150:                return PERFDATA_PROLOG_SIZE; // sizeof(struct PerfDataProlog)
151:            }
152:
153:            /**
154:             * Return an IntBuffer that accesses the used value. This is used
155:             * to create a Monitor object for this value.
156:             *
157:             * @return IntBuffer - a ByteBuffer that accesses the used value
158:             *                     in the instrumentation buffer header.
159:             * @see #getUsed()
160:             */
161:            public IntBuffer usedBuffer() {
162:                byteBuffer.position(PERFDATA_PROLOG_USED_OFFSET);
163:                IntBuffer ib = byteBuffer.asIntBuffer();
164:                ib.limit(1);
165:                return ib;
166:            }
167:
168:            /**
169:             * Return an IntBuffer that accesses the size value. This is used
170:             * to create a Monitor object for this value.
171:             *
172:             * @return IntBuffer - a ByteBuffer that accesses the size value
173:             *                     in the instrumentation buffer header.
174:             * @see #getBufferSize()
175:             */
176:            public IntBuffer sizeBuffer() {
177:                IntBuffer ib = IntBuffer.allocate(1);
178:                ib.put(byteBuffer.capacity());
179:                return ib;
180:            }
181:
182:            /**
183:             * Return an IntBuffer that accesses the overflow value. This is used
184:             * to create a Monitor object for this value.
185:             *
186:             * @return IntBuffer - a ByteBuffer that accesses the overflow value
187:             *                     in the instrumentation buffer header.
188:             * @see #getOverflow()
189:             */
190:            public IntBuffer overflowBuffer() {
191:                byteBuffer.position(PERFDATA_PROLOG_OVERFLOW_OFFSET);
192:                IntBuffer ib = byteBuffer.asIntBuffer();
193:                ib.limit(1);
194:                return ib;
195:            }
196:
197:            /**
198:             * Return an LongBuffer that accesses the modification timestamp value.
199:             * This is used* to create a Monitor object for this value.
200:             *
201:             * @return LongBuffer - a ByteBuffer that accesses the modification time
202:             *                      stamp value in the instrumentation buffer header.
203:             * @see #getModificationTimeStamp()
204:             */
205:            public LongBuffer modificationTimeStampBuffer() {
206:                byteBuffer.position(PERFDATA_PROLOG_MODTIMESTAMP_OFFSET);
207:                LongBuffer lb = byteBuffer.asLongBuffer();
208:                lb.limit(1);
209:                return lb;
210:            }
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.