Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
tenuring-patch
diff -r b4bdf3484720 src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
--- a/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp Thu Jan 05 01:40:00 2017 +0000
+++ b/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp Wed Jan 18 13:35:05 2017 +0100
@@ -40,7 +40,7 @@
_term_attempts(0),
_tenuring_threshold(g1h->g1_policy()->tenuring_threshold()),
_age_table(false), _scanner(g1h, rp),
- _strong_roots_time(0), _term_time(0) {
+ _strong_roots_time(0), _term_time(0), survivorAges() {
_scanner.set_par_scan_thread_state(this);
// we allocate G1YoungSurvRateNumRegions plus one entries, since
// we "sacrifice" entry 0 to keep track of surviving bytes for
@@ -104,6 +104,17 @@
(alloc_buffer_waste + undo_waste) * HeapWordSize / K,
alloc_buffer_waste * HeapWordSize / K,
undo_waste * HeapWordSize / K);
+
+ std::map<KlassAndAge,int>::const_iterator it = survivorAges.begin();
+ st->print_cr("IKDEBUG >> printing ages");
+ while (it != survivorAges.end()) {
+ const char* name = InstanceKlass::cast(it->first.getKlass())->external_name();
+ if (name != NULL) {
+ st->print_cr("IKDEBUG %s - age %d - count %d", name, it->first.getAge(), it->second);
+ }
+ it++;
+ }
+ st->print_cr("IKDEBUG << printing ages");
}
#ifdef ASSERT
@@ -265,6 +276,17 @@
obj->set_mark(old_mark);
}
+ Klass* k = obj->klass_or_null();
+ if (k != NULL) {
+ const KlassAndAge key(k, age);
+ std::map<KlassAndAge,int>::iterator it = survivorAges.find(key);
+ if (it != survivorAges.end()) {
+ it->second = it->second + 1;
+ } else {
+ survivorAges.insert(std::make_pair(key, 1));
+ }
+ }
+
if (G1StringDedup::is_enabled()) {
const bool is_from_young = state.is_young();
const bool is_to_young = dest_state.is_young();
diff -r b4bdf3484720 src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp
--- a/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp Thu Jan 05 01:40:00 2017 +0000
+++ b/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp Wed Jan 18 13:35:05 2017 +0100
@@ -35,9 +35,32 @@
#include "memory/allocation.hpp"
#include "oops/oop.hpp"
+#include <map>
+#include <string>
+#include <functional>
+
class HeapRegion;
class outputStream;
+class KlassAndAge {
+private:
+ Klass* klass;
+ int age;
+
+public:
+
+ KlassAndAge(Klass* _klass, int _age) : klass(_klass), age(_age) {}
+
+ bool operator<(KlassAndAge const& right) const {
+ return (this->klass < right.klass)
+ || (this->klass == right.klass && this->age < right.age);
+ }
+
+ Klass* getKlass() const { return klass; }
+ int getAge() const { return age; }
+};
+
+
class G1ParScanThreadState : public StackObj {
private:
G1CollectedHeap* _g1h;
@@ -93,6 +116,8 @@
}
public:
+ std::map<KlassAndAge,int> survivorAges;
+
G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp);
~G1ParScanThreadState();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment