77 assert(_ref_processor == NULL, "a reference processor already exists");
78 assert(!_reserved.is_empty(), "empty generation?");
79 _ref_processor = new ReferenceProcessor(_reserved); // a vanilla reference processor
80 if (_ref_processor == NULL) {
81 vm_exit_during_initialization("Could not allocate ReferenceProcessor object");
82 }
83 }
84
85 void Generation::print() const { print_on(tty); }
86
87 void Generation::print_on(outputStream* st) const {
88 st->print(" %-20s", name());
89 st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
90 capacity()/K, used()/K);
91 st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
92 p2i(_virtual_space.low_boundary()),
93 p2i(_virtual_space.high()),
94 p2i(_virtual_space.high_boundary()));
95 }
96
97 void Generation::print_summary_info() { print_summary_info_on(tty); }
98
99 void Generation::print_summary_info_on(outputStream* st) {
100 StatRecord* sr = stat_record();
101 double time = sr->accumulated_time.seconds();
102 // I didn't want to change the logging when removing the level concept,
103 // but I guess this logging could say young/old or something instead of 0/1.
104 uint level;
105 if (GenCollectedHeap::heap()->is_young_gen(this)) {
106 level = 0;
107 } else {
108 level = 1;
109 }
110 st->print_cr("[Accumulated GC generation %d time %3.7f secs, "
111 "%u GC's, avg GC time %3.7f]",
112 level, time, sr->invocations,
113 sr->invocations > 0 ? time / sr->invocations : 0.0);
114 }
115
116 // Utility iterator classes
117
118 class GenerationIsInReservedClosure : public SpaceClosure {
119 public:
120 const void* _p;
121 Space* sp;
122 virtual void do_space(Space* s) {
123 if (sp == NULL) {
124 if (s->is_in_reserved(_p)) sp = s;
125 }
126 }
127 GenerationIsInReservedClosure(const void* p) : _p(p), sp(NULL) {}
128 };
129
130 class GenerationIsInClosure : public SpaceClosure {
131 public:
132 const void* _p;
|
77 assert(_ref_processor == NULL, "a reference processor already exists");
78 assert(!_reserved.is_empty(), "empty generation?");
79 _ref_processor = new ReferenceProcessor(_reserved); // a vanilla reference processor
80 if (_ref_processor == NULL) {
81 vm_exit_during_initialization("Could not allocate ReferenceProcessor object");
82 }
83 }
84
85 void Generation::print() const { print_on(tty); }
86
87 void Generation::print_on(outputStream* st) const {
88 st->print(" %-20s", name());
89 st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
90 capacity()/K, used()/K);
91 st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
92 p2i(_virtual_space.low_boundary()),
93 p2i(_virtual_space.high()),
94 p2i(_virtual_space.high_boundary()));
95 }
96
97 void Generation::print_summary_info() {
98 StatRecord* sr = stat_record();
99 double time = sr->accumulated_time.seconds();
100 log_debug(gc, heap, exit)("Accumulated %s generation GC time %3.7f secs, "
101 "%u GC's, avg GC time %3.7f",
102 GenCollectedHeap::heap()->is_young_gen(this) ? "young" : "old" ,
103 time,
104 sr->invocations,
105 sr->invocations > 0 ? time / sr->invocations : 0.0);
106 }
107
108 // Utility iterator classes
109
110 class GenerationIsInReservedClosure : public SpaceClosure {
111 public:
112 const void* _p;
113 Space* sp;
114 virtual void do_space(Space* s) {
115 if (sp == NULL) {
116 if (s->is_in_reserved(_p)) sp = s;
117 }
118 }
119 GenerationIsInReservedClosure(const void* p) : _p(p), sp(NULL) {}
120 };
121
122 class GenerationIsInClosure : public SpaceClosure {
123 public:
124 const void* _p;
|