139 assert(_prologue != NULL, "prologue pointer must be initialized");
140
141 #ifdef VM_LITTLE_ENDIAN
142 _prologue->magic = (jint)0xc0c0feca;
143 _prologue->byte_order = PERFDATA_LITTLE_ENDIAN;
144 #else
145 _prologue->magic = (jint)0xcafec0c0;
146 _prologue->byte_order = PERFDATA_BIG_ENDIAN;
147 #endif
148
149 _prologue->major_version = PERFDATA_MAJOR_VERSION;
150 _prologue->minor_version = PERFDATA_MINOR_VERSION;
151 _prologue->accessible = 0;
152
153 _prologue->entry_offset = sizeof(PerfDataPrologue);
154 _prologue->num_entries = 0;
155 _prologue->used = 0;
156 _prologue->overflow = 0;
157 _prologue->mod_time_stamp = 0;
158
159 OrderAccess::release_store(&_initialized, 1);
160 }
161
162 void PerfMemory::destroy() {
163
164 if (!is_usable()) return;
165
166 if (_start != NULL && _prologue->overflow != 0) {
167
168 // This state indicates that the contiguous memory region exists and
169 // that it wasn't large enough to hold all the counters. In this case,
170 // we output a warning message to the user on exit if the -XX:+Verbose
171 // flag is set (a debug only flag). External monitoring tools can detect
172 // this condition by monitoring the _prologue->overflow word.
173 //
174 // There are two tunables that can help resolve this issue:
175 // - increase the size of the PerfMemory with -XX:PerfDataMemorySize=<n>
176 // - decrease the maximum string constant length with
177 // -XX:PerfMaxStringConstLength=<n>
178 //
179 if (PrintMiscellaneous && Verbose) {
252 if(!Arguments::copy_expand_pid(PerfDataSaveFile, strlen(PerfDataSaveFile),
253 dest_file, JVM_MAXPATHLEN)) {
254 FREE_C_HEAP_ARRAY(char, dest_file);
255 if (PrintMiscellaneous && Verbose) {
256 warning("Invalid performance data file path name specified, "\
257 "fall back to a default name");
258 }
259 } else {
260 return dest_file;
261 }
262 }
263 // create the name of the file for retaining the instrumentation memory.
264 dest_file = NEW_C_HEAP_ARRAY(char, PERFDATA_FILENAME_LEN, mtInternal);
265 jio_snprintf(dest_file, PERFDATA_FILENAME_LEN,
266 "%s_%d", PERFDATA_NAME, os::current_process_id());
267
268 return dest_file;
269 }
270
271 bool PerfMemory::is_initialized() {
272 return OrderAccess::load_acquire(&_initialized) != 0;
273 }
|
139 assert(_prologue != NULL, "prologue pointer must be initialized");
140
141 #ifdef VM_LITTLE_ENDIAN
142 _prologue->magic = (jint)0xc0c0feca;
143 _prologue->byte_order = PERFDATA_LITTLE_ENDIAN;
144 #else
145 _prologue->magic = (jint)0xcafec0c0;
146 _prologue->byte_order = PERFDATA_BIG_ENDIAN;
147 #endif
148
149 _prologue->major_version = PERFDATA_MAJOR_VERSION;
150 _prologue->minor_version = PERFDATA_MINOR_VERSION;
151 _prologue->accessible = 0;
152
153 _prologue->entry_offset = sizeof(PerfDataPrologue);
154 _prologue->num_entries = 0;
155 _prologue->used = 0;
156 _prologue->overflow = 0;
157 _prologue->mod_time_stamp = 0;
158
159 Atomic::release_store(&_initialized, 1);
160 }
161
162 void PerfMemory::destroy() {
163
164 if (!is_usable()) return;
165
166 if (_start != NULL && _prologue->overflow != 0) {
167
168 // This state indicates that the contiguous memory region exists and
169 // that it wasn't large enough to hold all the counters. In this case,
170 // we output a warning message to the user on exit if the -XX:+Verbose
171 // flag is set (a debug only flag). External monitoring tools can detect
172 // this condition by monitoring the _prologue->overflow word.
173 //
174 // There are two tunables that can help resolve this issue:
175 // - increase the size of the PerfMemory with -XX:PerfDataMemorySize=<n>
176 // - decrease the maximum string constant length with
177 // -XX:PerfMaxStringConstLength=<n>
178 //
179 if (PrintMiscellaneous && Verbose) {
252 if(!Arguments::copy_expand_pid(PerfDataSaveFile, strlen(PerfDataSaveFile),
253 dest_file, JVM_MAXPATHLEN)) {
254 FREE_C_HEAP_ARRAY(char, dest_file);
255 if (PrintMiscellaneous && Verbose) {
256 warning("Invalid performance data file path name specified, "\
257 "fall back to a default name");
258 }
259 } else {
260 return dest_file;
261 }
262 }
263 // create the name of the file for retaining the instrumentation memory.
264 dest_file = NEW_C_HEAP_ARRAY(char, PERFDATA_FILENAME_LEN, mtInternal);
265 jio_snprintf(dest_file, PERFDATA_FILENAME_LEN,
266 "%s_%d", PERFDATA_NAME, os::current_process_id());
267
268 return dest_file;
269 }
270
271 bool PerfMemory::is_initialized() {
272 return Atomic::load_acquire(&_initialized) != 0;
273 }
|