src/share/vm/gc/shared/plab.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -152,10 +152,21 @@
}
assert(is_object_aligned(max_size()) && min_size() <= max_size(),
"PLAB clipping computation may be incorrect");
+ size_t plab_sz = adjust_desired_plab_sz_helper();
+ // Take historical weighted average
+ _filter.sample(plab_sz);
+ _desired_net_plab_sz = MAX2(min_size(), (size_t)_filter.average());
+
+ log_sizing(plab_sz, _desired_net_plab_sz);
+ // Clear accumulators for next round
+ reset();
+}
+
+size_t PLABStats::adjust_desired_plab_sz_helper() {
if (_allocated == 0) {
assert(_unused == 0,
"Inconsistency in PLAB stats: "
"_allocated: " SIZE_FORMAT ", "
"_wasted: " SIZE_FORMAT ", "
@@ -171,13 +182,7 @@
target_refills = 1;
}
size_t used = _allocated - _wasted - _unused;
// Assumed to have 1 gc worker thread
size_t recent_plab_sz = used / target_refills;
- // Take historical weighted average
- _filter.sample(recent_plab_sz);
- _desired_net_plab_sz = MAX2(min_size(), (size_t)_filter.average());
-
- log_sizing(recent_plab_sz, _desired_net_plab_sz);
-
- reset();
+ return recent_plab_sz;
}