author | duke |
Wed, 05 Jul 2017 20:10:48 +0200 | |
changeset 27963 | 88d7c7c376e9 |
parent 23494 | 950d6469ff05 |
permissions | -rw-r--r-- |
23491 | 1 |
/* |
2 |
* Copyright (c) 2014, 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 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "precompiled.hpp" |
|
23494
950d6469ff05
8038181: Can't build product VM without precompiled header
kvn
parents:
23491
diff
changeset
|
26 |
#include "memory/allocation.inline.hpp" |
23491 | 27 |
#include "runtime/task.hpp" |
28 |
#include "runtime/rtmLocking.hpp" |
|
29 |
||
30 |
// One-shot PeriodicTask subclass for enabling RTM locking |
|
31 |
uintx RTMLockingCounters::_calculation_flag = 0; |
|
32 |
||
33 |
class RTMLockingCalculationTask : public PeriodicTask { |
|
34 |
public: |
|
35 |
RTMLockingCalculationTask(size_t interval_time) : PeriodicTask(interval_time){ } |
|
36 |
||
37 |
virtual void task() { |
|
38 |
RTMLockingCounters::_calculation_flag = 1; |
|
39 |
// Reclaim our storage and disenroll ourself |
|
40 |
delete this; |
|
41 |
} |
|
42 |
}; |
|
43 |
||
44 |
void RTMLockingCounters::init() { |
|
45 |
if (UseRTMLocking && RTMLockingCalculationDelay > 0) { |
|
46 |
RTMLockingCalculationTask* task = new RTMLockingCalculationTask(RTMLockingCalculationDelay); |
|
47 |
task->enroll(); |
|
48 |
} else { |
|
49 |
_calculation_flag = 1; |
|
50 |
} |
|
51 |
} |
|
52 |
||
53 |
//------------------------------print_on------------------------------- |
|
54 |
void RTMLockingCounters::print_on(outputStream* st) { |
|
55 |
tty->print_cr("# rtm locks total (estimated): " UINTX_FORMAT, _total_count * RTMTotalCountIncrRate); |
|
56 |
tty->print_cr("# rtm lock aborts : " UINTX_FORMAT, _abort_count); |
|
57 |
for (int i = 0; i < ABORT_STATUS_LIMIT; i++) { |
|
58 |
tty->print_cr("# rtm lock aborts %d: " UINTX_FORMAT, i, _abortX_count[i]); |
|
59 |
} |
|
60 |
} |