1 /*
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1029
1030 plab_stats()->adjust_desired_plab_sz();
1031
1032 TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats());
1033 TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats());
1034
1035 if (UseAdaptiveSizePolicy) {
1036 size_policy->minor_collection_end(gch->gc_cause());
1037 size_policy->avg_survived()->sample(from()->used());
1038 }
1039
1040 // We need to use a monotonically non-decreasing time in ms
1041 // or we will see time-warp warnings and os::javaTimeMillis()
1042 // does not guarantee monotonicity.
1043 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
1044 update_time_of_last_gc(now);
1045
1046 rp->set_enqueuing_is_done(true);
1047 if (rp->processing_is_mt()) {
1048 ParNewRefProcTaskExecutor task_executor(*this, *_old_gen, thread_state_set);
1049 rp->enqueue_discovered_references(&task_executor);
1050 } else {
1051 rp->enqueue_discovered_references(NULL);
1052 }
1053 rp->verify_no_references_recorded();
1054
1055 gch->trace_heap_after_gc(gc_tracer());
1056
1057 _gc_timer->register_gc_end();
1058
1059 _gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
1060 }
1061
1062 size_t ParNewGeneration::desired_plab_sz() {
1063 return _plab_stats.desired_plab_sz(GenCollectedHeap::heap()->workers()->active_workers());
1064 }
1065
1066 static int sum;
1067 void ParNewGeneration::waste_some_time() {
1068 for (int i = 0; i < 100; i++) {
1069 sum += i;
1070 }
1071 }
|
1 /*
2 * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1029
1030 plab_stats()->adjust_desired_plab_sz();
1031
1032 TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats());
1033 TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats());
1034
1035 if (UseAdaptiveSizePolicy) {
1036 size_policy->minor_collection_end(gch->gc_cause());
1037 size_policy->avg_survived()->sample(from()->used());
1038 }
1039
1040 // We need to use a monotonically non-decreasing time in ms
1041 // or we will see time-warp warnings and os::javaTimeMillis()
1042 // does not guarantee monotonicity.
1043 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
1044 update_time_of_last_gc(now);
1045
1046 rp->set_enqueuing_is_done(true);
1047 if (rp->processing_is_mt()) {
1048 ParNewRefProcTaskExecutor task_executor(*this, *_old_gen, thread_state_set);
1049 rp->enqueue_discovered_references(&task_executor, _gc_timer);
1050 } else {
1051 rp->enqueue_discovered_references(NULL, _gc_timer);
1052 }
1053 rp->verify_no_references_recorded();
1054
1055 gch->trace_heap_after_gc(gc_tracer());
1056
1057 _gc_timer->register_gc_end();
1058
1059 _gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
1060 }
1061
1062 size_t ParNewGeneration::desired_plab_sz() {
1063 return _plab_stats.desired_plab_sz(GenCollectedHeap::heap()->workers()->active_workers());
1064 }
1065
1066 static int sum;
1067 void ParNewGeneration::waste_some_time() {
1068 for (int i = 0; i < 100; i++) {
1069 sum += i;
1070 }
1071 }
|