0
|
1 /*
|
|
2 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 *
|
|
5 * This code is free software; you can redistribute it and/or modify it
|
|
6 * under the terms of the GNU General Public License version 2 only, as
|
|
7 * published by the Free Software Foundation.
|
|
8 *
|
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 * version 2 for more details (a copy is included in the LICENSE file that
|
|
13 * accompanied this code).
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License version
|
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 *
|
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 * have any questions.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 package sun.jvm.hotspot.runtime;
|
|
26
|
|
27 import java.util.*;
|
|
28 import sun.jvm.hotspot.debugger.*;
|
|
29 import sun.jvm.hotspot.oops.*;
|
|
30 import sun.jvm.hotspot.types.*;
|
|
31
|
|
32 public class PerfDataPrologue extends VMObject {
|
|
33 private static JIntField magicField;
|
|
34 private static JByteField byteOrderField;
|
|
35 private static JByteField majorVersionField;
|
|
36 private static JByteField minorVersionField;
|
|
37 private static JByteField accessibleField;
|
|
38 private static JIntField usedField;
|
|
39 private static JIntField overflowField;
|
|
40 private static JLongField modTimeStampField;
|
|
41 private static JIntField entryOffsetField;
|
|
42 private static JIntField numEntriesField;
|
|
43
|
|
44 static {
|
|
45 VM.registerVMInitializedObserver(new Observer() {
|
|
46 public void update(Observable o, Object data) {
|
|
47 initialize(VM.getVM().getTypeDataBase());
|
|
48 }
|
|
49 });
|
|
50 }
|
|
51
|
|
52 private static synchronized void initialize(TypeDataBase db) {
|
|
53 Type type = db.lookupType("PerfDataPrologue");
|
|
54 magicField = type.getJIntField("magic");
|
|
55 byteOrderField = type.getJByteField("byte_order");
|
|
56 majorVersionField = type.getJByteField("major_version");
|
|
57 minorVersionField = type.getJByteField("minor_version");
|
|
58 accessibleField = type.getJByteField("accessible");
|
|
59 usedField = type.getJIntField("used");
|
|
60 overflowField = type.getJIntField("overflow");
|
|
61 modTimeStampField = type.getJLongField("mod_time_stamp");
|
|
62 entryOffsetField = type.getJIntField("entry_offset");
|
|
63 numEntriesField = type.getJIntField("num_entries");
|
|
64 }
|
|
65
|
|
66 public PerfDataPrologue(Address addr) {
|
|
67 super(addr);
|
|
68 }
|
|
69
|
|
70 // Accessors
|
|
71 public int magic() {
|
|
72 return (int) magicField.getValue(addr);
|
|
73 }
|
|
74
|
|
75 public byte byteOrder() {
|
|
76 return (byte) byteOrderField.getValue(addr);
|
|
77 }
|
|
78
|
|
79 public byte majorVersion() {
|
|
80 return (byte) majorVersionField.getValue(addr);
|
|
81 }
|
|
82
|
|
83 public boolean accessible() {
|
|
84 return ((byte) accessibleField.getValue(addr)) != (byte)0;
|
|
85 }
|
|
86
|
|
87 public int used() {
|
|
88 return (int) usedField.getValue(addr);
|
|
89 }
|
|
90
|
|
91 public int overflow() {
|
|
92 return (int) overflowField.getValue(addr);
|
|
93 }
|
|
94
|
|
95 public long modTimeStamp() {
|
|
96 return (long) modTimeStampField.getValue(addr);
|
|
97 }
|
|
98
|
|
99 public int entryOffset() {
|
|
100 return (int) entryOffsetField.getValue(addr);
|
|
101 }
|
|
102
|
|
103 public int numEntries() {
|
|
104 return (int) numEntriesField.getValue(addr);
|
|
105 }
|
|
106 }
|