comparison src/share/vm/runtime/advancedThresholdPolicy.cpp @ 10105:aeaca88565e6

8010862: The Method counter fields used for profiling can be allocated lazily. Summary: Allocate the method's profiling related metadata until they are needed. Reviewed-by: coleenp, roland
author jiangli
date Tue, 09 Apr 2013 17:17:41 -0400
parents d8ce2825b193
children 91eba9f82325
comparison
equal deleted inserted replaced
9055:dcdeb150988c 10105:aeaca88565e6
1 /* 1 /*
2 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
72 set_start_time(os::javaTimeMillis()); 72 set_start_time(os::javaTimeMillis());
73 } 73 }
74 74
75 // update_rate() is called from select_task() while holding a compile queue lock. 75 // update_rate() is called from select_task() while holding a compile queue lock.
76 void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) { 76 void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) {
77 JavaThread* THREAD = JavaThread::current();
77 if (is_old(m)) { 78 if (is_old(m)) {
78 // We don't remove old methods from the queue, 79 // We don't remove old methods from the queue,
79 // so we can just zero the rate. 80 // so we can just zero the rate.
80 m->set_rate(0); 81 m->set_rate(0, THREAD);
81 return; 82 return;
82 } 83 }
83 84
84 // We don't update the rate if we've just came out of a safepoint. 85 // We don't update the rate if we've just came out of a safepoint.
85 // delta_s is the time since last safepoint in milliseconds. 86 // delta_s is the time since last safepoint in milliseconds.
91 92
92 // We should be running for at least 1ms. 93 // We should be running for at least 1ms.
93 if (delta_s >= TieredRateUpdateMinTime) { 94 if (delta_s >= TieredRateUpdateMinTime) {
94 // And we must've taken the previous point at least 1ms before. 95 // And we must've taken the previous point at least 1ms before.
95 if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) { 96 if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) {
96 m->set_prev_time(t); 97 m->set_prev_time(t, THREAD);
97 m->set_prev_event_count(event_count); 98 m->set_prev_event_count(event_count, THREAD);
98 m->set_rate((float)delta_e / (float)delta_t); // Rate is events per millisecond 99 m->set_rate((float)delta_e / (float)delta_t, THREAD); // Rate is events per millisecond
99 } else 100 } else
100 if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) { 101 if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) {
101 // If nothing happened for 25ms, zero the rate. Don't modify prev values. 102 // If nothing happened for 25ms, zero the rate. Don't modify prev values.
102 m->set_rate(0); 103 m->set_rate(0, THREAD);
103 } 104 }
104 } 105 }
105 } 106 }
106 107
107 // Check if this method has been stale from a given number of milliseconds. 108 // Check if this method has been stale from a given number of milliseconds.