< prev index next >

src/share/vm/runtime/safepoint.cpp

Print this page




1251 
1252 void SafepointSynchronize::print_statistics() {
1253   for (int index = 0; index <= _cur_stat_index; index++) {
1254     if (index % 30 == 0) {
1255       print_header();
1256     }
1257     SafepointStats* sstats = &_safepoint_stats[index];
1258     tty->print("%8.3f: ", sstats->_time_stamp);
1259     tty->print("%-30s  [          "
1260                INT32_FORMAT_W(8) " " INT32_FORMAT_W(17) " " INT32_FORMAT_W(13) " "
1261                "]",
1262                (sstats->_vmop_type == -1 ? "no vm operation" : VM_Operation::name(sstats->_vmop_type)),
1263                sstats->_nof_total_threads,
1264                sstats->_nof_initial_running_threads,
1265                sstats->_nof_threads_wait_to_block);
1266     // "/ MICROUNITS " is to convert the unit from nanos to millis.
1267     tty->print("[       "
1268                INT64_FORMAT_W(7) " " INT64_FORMAT_W(7) " "
1269                INT64_FORMAT_W(7) " " INT64_FORMAT_W(7) " "
1270                INT64_FORMAT_W(7) " ] ",
1271                sstats->_time_to_spin / MICROUNITS,
1272                sstats->_time_to_wait_to_block / MICROUNITS,
1273                sstats->_time_to_sync / MICROUNITS,
1274                sstats->_time_to_do_cleanups / MICROUNITS,
1275                sstats->_time_to_exec_vmop / MICROUNITS);
1276 
1277     if (need_to_track_page_armed_status) {
1278       tty->print(INT32_FORMAT_W(10) " ", sstats->_page_armed);
1279     }
1280     tty->print_cr(INT32_FORMAT_W(15) " ", sstats->_nof_threads_hit_page_trap);
1281   }
1282 }
1283 
1284 // This method will be called when VM exits. It will first call
1285 // print_statistics to print out the rest of the sampling.  Then
1286 // it tries to summarize the sampling.
1287 void SafepointSynchronize::print_stat_on_exit() {
1288   if (_safepoint_stats == NULL) return;
1289 
1290   SafepointStats *spstat = &_safepoint_stats[_cur_stat_index];
1291 
1292   // During VM exit, end_statistics may not get called and in that
1293   // case, if the sync time is less than PrintSafepointStatisticsTimeout,
1294   // don't print it out.
1295   // Approximate the vm op time.


1303   tty->cr();
1304 
1305   // Print out polling page sampling status.
1306   if (!need_to_track_page_armed_status) {
1307     tty->print_cr("Polling page always armed");
1308   } else {
1309     tty->print_cr("Defer polling page loop count = " INTX_FORMAT "\n",
1310                   DeferPollingPageLoopCount);
1311   }
1312 
1313   for (int index = 0; index < VM_Operation::VMOp_Terminating; index++) {
1314     if (_safepoint_reasons[index] != 0) {
1315       tty->print_cr("%-26s" UINT64_FORMAT_W(10), VM_Operation::name(index),
1316                     _safepoint_reasons[index]);
1317     }
1318   }
1319 
1320   tty->print_cr(UINT64_FORMAT_W(5) " VM operations coalesced during safepoint",
1321                 _coalesced_vmop_count);
1322   tty->print_cr("Maximum sync time  " INT64_FORMAT_W(5) " ms",
1323                 _max_sync_time / MICROUNITS);
1324   tty->print_cr("Maximum vm operation time (except for Exit VM operation)  "
1325                 INT64_FORMAT_W(5) " ms",
1326                 _max_vmop_time / MICROUNITS);
1327 }
1328 
1329 // ------------------------------------------------------------------------------------------------
1330 // Non-product code
1331 
1332 #ifndef PRODUCT
1333 
1334 void SafepointSynchronize::print_state() {
1335   if (_state == _not_synchronized) {
1336     tty->print_cr("not synchronized");
1337   } else if (_state == _synchronizing || _state == _synchronized) {
1338     tty->print_cr("State: %s", (_state == _synchronizing) ? "synchronizing" :
1339                   "synchronized");
1340 
1341     for(JavaThread *cur = Threads::first(); cur; cur = cur->next()) {
1342        cur->safepoint_state()->print();
1343     }
1344   }
1345 }
1346 


1251 
1252 void SafepointSynchronize::print_statistics() {
1253   for (int index = 0; index <= _cur_stat_index; index++) {
1254     if (index % 30 == 0) {
1255       print_header();
1256     }
1257     SafepointStats* sstats = &_safepoint_stats[index];
1258     tty->print("%8.3f: ", sstats->_time_stamp);
1259     tty->print("%-30s  [          "
1260                INT32_FORMAT_W(8) " " INT32_FORMAT_W(17) " " INT32_FORMAT_W(13) " "
1261                "]",
1262                (sstats->_vmop_type == -1 ? "no vm operation" : VM_Operation::name(sstats->_vmop_type)),
1263                sstats->_nof_total_threads,
1264                sstats->_nof_initial_running_threads,
1265                sstats->_nof_threads_wait_to_block);
1266     // "/ MICROUNITS " is to convert the unit from nanos to millis.
1267     tty->print("[       "
1268                INT64_FORMAT_W(7) " " INT64_FORMAT_W(7) " "
1269                INT64_FORMAT_W(7) " " INT64_FORMAT_W(7) " "
1270                INT64_FORMAT_W(7) " ] ",
1271                (int64_t)(sstats->_time_to_spin / MICROUNITS),
1272                (int64_t)(sstats->_time_to_wait_to_block / MICROUNITS),
1273                (int64_t)(sstats->_time_to_sync / MICROUNITS),
1274                (int64_t)(sstats->_time_to_do_cleanups / MICROUNITS),
1275                (int64_t)(sstats->_time_to_exec_vmop / MICROUNITS));
1276 
1277     if (need_to_track_page_armed_status) {
1278       tty->print(INT32_FORMAT_W(10) " ", sstats->_page_armed);
1279     }
1280     tty->print_cr(INT32_FORMAT_W(15) " ", sstats->_nof_threads_hit_page_trap);
1281   }
1282 }
1283 
1284 // This method will be called when VM exits. It will first call
1285 // print_statistics to print out the rest of the sampling.  Then
1286 // it tries to summarize the sampling.
1287 void SafepointSynchronize::print_stat_on_exit() {
1288   if (_safepoint_stats == NULL) return;
1289 
1290   SafepointStats *spstat = &_safepoint_stats[_cur_stat_index];
1291 
1292   // During VM exit, end_statistics may not get called and in that
1293   // case, if the sync time is less than PrintSafepointStatisticsTimeout,
1294   // don't print it out.
1295   // Approximate the vm op time.


1303   tty->cr();
1304 
1305   // Print out polling page sampling status.
1306   if (!need_to_track_page_armed_status) {
1307     tty->print_cr("Polling page always armed");
1308   } else {
1309     tty->print_cr("Defer polling page loop count = " INTX_FORMAT "\n",
1310                   DeferPollingPageLoopCount);
1311   }
1312 
1313   for (int index = 0; index < VM_Operation::VMOp_Terminating; index++) {
1314     if (_safepoint_reasons[index] != 0) {
1315       tty->print_cr("%-26s" UINT64_FORMAT_W(10), VM_Operation::name(index),
1316                     _safepoint_reasons[index]);
1317     }
1318   }
1319 
1320   tty->print_cr(UINT64_FORMAT_W(5) " VM operations coalesced during safepoint",
1321                 _coalesced_vmop_count);
1322   tty->print_cr("Maximum sync time  " INT64_FORMAT_W(5) " ms",
1323                 (int64_t)(_max_sync_time / MICROUNITS));
1324   tty->print_cr("Maximum vm operation time (except for Exit VM operation)  "
1325                 INT64_FORMAT_W(5) " ms",
1326                 (int64_t)(_max_vmop_time / MICROUNITS));
1327 }
1328 
1329 // ------------------------------------------------------------------------------------------------
1330 // Non-product code
1331 
1332 #ifndef PRODUCT
1333 
1334 void SafepointSynchronize::print_state() {
1335   if (_state == _not_synchronized) {
1336     tty->print_cr("not synchronized");
1337   } else if (_state == _synchronizing || _state == _synchronized) {
1338     tty->print_cr("State: %s", (_state == _synchronizing) ? "synchronizing" :
1339                   "synchronized");
1340 
1341     for(JavaThread *cur = Threads::first(); cur; cur = cur->next()) {
1342        cur->safepoint_state()->print();
1343     }
1344   }
1345 }
1346 
< prev index next >