416 e.commit(); |
416 e.commit(); |
417 } |
417 } |
418 } |
418 } |
419 |
419 |
420 class PhaseSender : public PhaseVisitor { |
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 |
421 public: |
442 public: |
422 template<typename T> |
443 template<typename T> |
423 void send_phase(PausePhase* pause) { |
444 void send_phase(GCPhase* phase) { |
424 T event(UNTIMED); |
445 T event(UNTIMED); |
425 if (event.should_commit()) { |
446 if (event.should_commit()) { |
426 event.set_gcId(GCId::current()); |
447 event.set_gcId(GCId::current()); |
427 event.set_name(pause->name()); |
448 event.set_name(phase->name()); |
428 event.set_starttime(pause->start()); |
449 event.set_starttime(phase->start()); |
429 event.set_endtime(pause->end()); |
450 event.set_endtime(phase->end()); |
430 event.commit(); |
451 event.commit(); |
431 } |
452 } |
432 } |
453 } |
433 |
454 |
434 void visit(GCPhase* pause) { ShouldNotReachHere(); } |
455 void visit(GCPhase* phase) { |
435 void visit(ConcurrentPhase* pause) { Unimplemented(); } |
456 if (phase->type() == GCPhase::PausePhaseType) { |
436 void visit(PausePhase* pause) { |
457 visit_pause(phase); |
437 assert(PhasesStack::PHASE_LEVELS == 5, "Need more event types"); |
458 } else { |
438 |
459 assert(phase->type() == GCPhase::ConcurrentPhaseType, "Should be ConcurrentPhaseType"); |
439 switch (pause->level()) { |
460 visit_concurrent(phase); |
440 case 0: send_phase<EventGCPhasePause>(pause); break; |
|
441 case 1: send_phase<EventGCPhasePauseLevel1>(pause); break; |
|
442 case 2: send_phase<EventGCPhasePauseLevel2>(pause); break; |
|
443 case 3: send_phase<EventGCPhasePauseLevel3>(pause); break; |
|
444 default: /* Ignore sending this phase */ break; |
|
445 } |
461 } |
446 } |
462 } |
447 }; |
463 }; |
448 |
464 |
449 void GCTracer::send_phase_events(TimePartitions* time_partitions) const { |
465 void GCTracer::send_phase_events(TimePartitions* time_partitions) const { |