103 extern const char PERFDATA_NAME[];
104
105 // UINT_CHARS contains the number of characters holding a process id
106 // (i.e. pid). pid is defined as unsigned "int" so the maximum possible pid value
107 // would be 2^32 - 1 (4294967295) which can be represented as a 10 characters
108 // string.
109 static const size_t UINT_CHARS = 10;
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 friend class PerfMemoryTest;
117 private:
118 static char* _start;
119 static char* _end;
120 static char* _top;
121 static size_t _capacity;
122 static PerfDataPrologue* _prologue;
123 static jint _initialized;
124 static bool _destroyed;
125
126 static void create_memory_region(size_t sizep);
127 static void delete_memory_region();
128
129 public:
130 enum PerfMemoryMode {
131 PERF_MODE_RO = 0,
132 PERF_MODE_RW = 1
133 };
134
135 static char* alloc(size_t size);
136 static char* start() { return _start; }
137 static char* end() { return _end; }
138 static size_t used() { return (size_t) (_top - _start); }
139 static size_t capacity() { return _capacity; }
140 static bool is_initialized();
141 static bool is_destroyed() { return _destroyed; }
142 static bool is_usable() { return is_initialized() && !is_destroyed(); }
143 static bool contains(char* addr) {
|
103 extern const char PERFDATA_NAME[];
104
105 // UINT_CHARS contains the number of characters holding a process id
106 // (i.e. pid). pid is defined as unsigned "int" so the maximum possible pid value
107 // would be 2^32 - 1 (4294967295) which can be represented as a 10 characters
108 // string.
109 static const size_t UINT_CHARS = 10;
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 friend class PerfMemoryTest;
117 private:
118 static char* _start;
119 static char* _end;
120 static char* _top;
121 static size_t _capacity;
122 static PerfDataPrologue* _prologue;
123 static int _initialized;
124 static bool _destroyed;
125
126 static void create_memory_region(size_t sizep);
127 static void delete_memory_region();
128
129 public:
130 enum PerfMemoryMode {
131 PERF_MODE_RO = 0,
132 PERF_MODE_RW = 1
133 };
134
135 static char* alloc(size_t size);
136 static char* start() { return _start; }
137 static char* end() { return _end; }
138 static size_t used() { return (size_t) (_top - _start); }
139 static size_t capacity() { return _capacity; }
140 static bool is_initialized();
141 static bool is_destroyed() { return _destroyed; }
142 static bool is_usable() { return is_initialized() && !is_destroyed(); }
143 static bool contains(char* addr) {
|