< prev index next >

src/share/vm/gc/shared/gcTraceSend.cpp

Print this page
rev 9733 : [mq]: webrev.00
rev 9734 : [mq]: webrev.01


 401   meta_sizes.set_used(sizes.used());
 402   meta_sizes.set_reserved(sizes.reserved());
 403 
 404   return meta_sizes;
 405 }
 406 
 407 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const {
 408   EventMetaspaceSummary e;
 409   if (e.should_commit()) {
 410     e.set_gcId(GCId::current());
 411     e.set_when((u1) when);
 412     e.set_gcThreshold(meta_space_summary.capacity_until_GC());
 413     e.set_metaspace(to_trace_struct(meta_space_summary.meta_space()));
 414     e.set_dataSpace(to_trace_struct(meta_space_summary.data_space()));
 415     e.set_classSpace(to_trace_struct(meta_space_summary.class_space()));
 416     e.commit();
 417   }
 418 }
 419 
 420 class PhaseSender : public PhaseVisitor {
 421  public:
 422   template<typename T>
 423   void send_phase(GCPhase* phase) {
 424     T event(UNTIMED);
 425     if (event.should_commit()) {
 426       event.set_gcId(GCId::current());
 427       event.set_name(phase->name());
 428       event.set_starttime(phase->start());
 429       event.set_endtime(phase->end());
 430       event.commit();
 431     }
 432   }
 433 
 434   void visit(GCPhase* phase) {
 435     switch (phase->type()) {
 436       case GCPhase::PausePhaseType:
 437         assert(phase->level() < PhasesStack::PHASE_LEVELS, "Need more event types for PausePhase");
 438 
 439         switch (phase->level()) {
 440           case 0: send_phase<EventGCPhasePause>(phase); break;
 441           case 1: send_phase<EventGCPhasePauseLevel1>(phase); break;
 442           case 2: send_phase<EventGCPhasePauseLevel2>(phase); break;
 443           case 3: send_phase<EventGCPhasePauseLevel3>(phase); break;
 444           default: /* Ignore sending this phase */ break;
 445         }
 446         break;
 447 
 448       case GCPhase::ConcurrentPhaseType:
 449         assert(phase->level() < 1, "There's only one level for ConcurrentPhase");
 450 
 451         switch (phase->level()) {
 452           case 0: send_phase<EventGCPhaseConcurrent>(phase); break;
 453           default: /* Ignore sending this phase */ break;
 454         }
 455         break;




















 456     }
 457   }
 458 };
 459 
 460 void GCTracer::send_phase_events(TimePartitions* time_partitions) const {
 461   PhaseSender phase_reporter;
 462 
 463   TimePartitionPhasesIterator iter(time_partitions);
 464   while (iter.has_next()) {
 465     GCPhase* phase = iter.next();
 466     phase->accept(&phase_reporter);
 467   }
 468 }


 401   meta_sizes.set_used(sizes.used());
 402   meta_sizes.set_reserved(sizes.reserved());
 403 
 404   return meta_sizes;
 405 }
 406 
 407 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const {
 408   EventMetaspaceSummary e;
 409   if (e.should_commit()) {
 410     e.set_gcId(GCId::current());
 411     e.set_when((u1) when);
 412     e.set_gcThreshold(meta_space_summary.capacity_until_GC());
 413     e.set_metaspace(to_trace_struct(meta_space_summary.meta_space()));
 414     e.set_dataSpace(to_trace_struct(meta_space_summary.data_space()));
 415     e.set_classSpace(to_trace_struct(meta_space_summary.class_space()));
 416     e.commit();
 417   }
 418 }
 419 
 420 class PhaseSender : public PhaseVisitor {
 421   void visit_pause(GCPhase* phase) {















 422     assert(phase->level() < PhasesStack::PHASE_LEVELS, "Need more event types for PausePhase");
 423 
 424     switch (phase->level()) {
 425       case 0: send_phase<EventGCPhasePause>(phase); break;
 426       case 1: send_phase<EventGCPhasePauseLevel1>(phase); break;
 427       case 2: send_phase<EventGCPhasePauseLevel2>(phase); break;
 428       case 3: send_phase<EventGCPhasePauseLevel3>(phase); break;
 429       default: /* Ignore sending this phase */ break;
 430     }
 431   }
 432 
 433   void visit_concurrent(GCPhase* phase) {
 434     assert(phase->level() < 1, "There is only one level for ConcurrentPhase");
 435 
 436     switch (phase->level()) {
 437       case 0: send_phase<EventGCPhaseConcurrent>(phase); break;
 438       default: /* Ignore sending this phase */ break;
 439     }
 440   }
 441 
 442  public:
 443   template<typename T>
 444   void send_phase(GCPhase* phase) {
 445     T event(UNTIMED);
 446     if (event.should_commit()) {
 447       event.set_gcId(GCId::current());
 448       event.set_name(phase->name());
 449       event.set_starttime(phase->start());
 450       event.set_endtime(phase->end());
 451       event.commit();
 452     }
 453   }
 454 
 455   void visit(GCPhase* phase) {
 456     if (phase->type() == GCPhase::PausePhaseType) {
 457       visit_pause(phase);
 458     } else {
 459       assert(phase->type() == GCPhase::ConcurrentPhaseType, "Should be ConcurrentPhaseType");
 460       visit_concurrent(phase);
 461     }
 462   }
 463 };
 464 
 465 void GCTracer::send_phase_events(TimePartitions* time_partitions) const {
 466   PhaseSender phase_reporter;
 467 
 468   TimePartitionPhasesIterator iter(time_partitions);
 469   while (iter.has_next()) {
 470     GCPhase* phase = iter.next();
 471     phase->accept(&phase_reporter);
 472   }
 473 }
< prev index next >