78 jint vector_length; // length of the vector. If 0, then scalar
79 jbyte data_type; // type of the data item -
80 // 'B','Z','J','I','S','C','D','F','V','L','['
81 jbyte flags; // flags indicating misc attributes
82 jbyte data_units; // unit of measure for the data type
83 jbyte data_variability; // variability classification of data type
84 jint data_offset; // offset of the data item
85
86 /*
87 body of PerfData memory entry is variable length
88
89 jbyte[name_length] data_name; // name of the data item
90 jbyte[pad_length] data_pad; // alignment of data item
91 j<data_type>[data_length] data_item; // array of appropriate types.
92 // data_length is > 1 only when the
93 // data_type is T_ARRAY.
94 */
95 } PerfDataEntry;
96
97 // Prefix of performance data file.
98 static const char PERFDATA_NAME[] = "hsperfdata";
99
100 // UINT_CHARS contains the number of characters holding a process id
101 // (i.e. pid). pid is defined as unsigned "int" so the maximum possible pid value
102 // would be 2^32 - 1 (4294967295) which can be represented as a 10 characters
103 // string.
104 static const size_t UINT_CHARS = 10;
105
106 // Add 1 for the '_' character between PERFDATA_NAME and pid. The '\0' terminating
107 // character will be included in the sizeof(PERFDATA_NAME) operation.
108 static const size_t PERFDATA_FILENAME_LEN = sizeof(PERFDATA_NAME) +
109 UINT_CHARS + 1;
110
111 /* the PerfMemory class manages creation, destruction,
112 * and allocation of the PerfData region.
113 */
114 class PerfMemory : AllStatic {
115 friend class VMStructs;
116 private:
117 static char* _start;
118 static char* _end;
119 static char* _top;
120 static size_t _capacity;
121 static PerfDataPrologue* _prologue;
122 static jint _initialized;
123
124 static void create_memory_region(size_t sizep);
125 static void delete_memory_region();
126
127 public:
128 enum PerfMemoryMode {
129 PERF_MODE_RO = 0,
130 PERF_MODE_RW = 1
|
78 jint vector_length; // length of the vector. If 0, then scalar
79 jbyte data_type; // type of the data item -
80 // 'B','Z','J','I','S','C','D','F','V','L','['
81 jbyte flags; // flags indicating misc attributes
82 jbyte data_units; // unit of measure for the data type
83 jbyte data_variability; // variability classification of data type
84 jint data_offset; // offset of the data item
85
86 /*
87 body of PerfData memory entry is variable length
88
89 jbyte[name_length] data_name; // name of the data item
90 jbyte[pad_length] data_pad; // alignment of data item
91 j<data_type>[data_length] data_item; // array of appropriate types.
92 // data_length is > 1 only when the
93 // data_type is T_ARRAY.
94 */
95 } PerfDataEntry;
96
97 // Prefix of performance data file.
98 extern const char PERFDATA_NAME[];
99
100 // UINT_CHARS contains the number of characters holding a process id
101 // (i.e. pid). pid is defined as unsigned "int" so the maximum possible pid value
102 // would be 2^32 - 1 (4294967295) which can be represented as a 10 characters
103 // string.
104 static const size_t UINT_CHARS = 10;
105
106 /* the PerfMemory class manages creation, destruction,
107 * and allocation of the PerfData region.
108 */
109 class PerfMemory : AllStatic {
110 friend class VMStructs;
111 private:
112 static char* _start;
113 static char* _end;
114 static char* _top;
115 static size_t _capacity;
116 static PerfDataPrologue* _prologue;
117 static jint _initialized;
118
119 static void create_memory_region(size_t sizep);
120 static void delete_memory_region();
121
122 public:
123 enum PerfMemoryMode {
124 PERF_MODE_RO = 0,
125 PERF_MODE_RW = 1
|