author | coleenp |
Fri, 08 Mar 2013 11:47:57 -0500 | |
changeset 15928 | f9d5c6e4107f |
parent 7397 | 5b173b4ca846 |
child 35214 | d86005e0b4c2 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_INTERPRETER_BYTECODEHISTOGRAM_HPP |
26 |
#define SHARE_VM_INTERPRETER_BYTECODEHISTOGRAM_HPP |
|
27 |
||
28 |
#include "interpreter/bytecodes.hpp" |
|
29 |
#include "memory/allocation.hpp" |
|
30 |
||
1 | 31 |
// BytecodeCounter counts the number of bytecodes executed |
32 |
||
33 |
class BytecodeCounter: AllStatic { |
|
34 |
private: |
|
35 |
NOT_PRODUCT(static int _counter_value;) |
|
36 |
NOT_PRODUCT(static jlong _reset_time;) |
|
37 |
||
38 |
friend class TemplateInterpreterGenerator; |
|
39 |
friend class BytecodeInterpreter; |
|
40 |
||
41 |
public: |
|
42 |
// Initialization |
|
43 |
static void reset() PRODUCT_RETURN; |
|
44 |
||
45 |
// Counter info (all info since last reset) |
|
46 |
static int counter_value() PRODUCT_RETURN0 NOT_PRODUCT({ return _counter_value; }); |
|
47 |
static double elapsed_time() PRODUCT_RETURN0; // in seconds |
|
48 |
static double frequency() PRODUCT_RETURN0; // bytecodes/seconds |
|
49 |
||
50 |
// Counter printing |
|
51 |
static void print() PRODUCT_RETURN; |
|
52 |
}; |
|
53 |
||
54 |
||
55 |
// BytecodeHistogram collects number of executions of bytecodes |
|
56 |
||
57 |
class BytecodeHistogram: AllStatic { |
|
58 |
private: |
|
59 |
NOT_PRODUCT(static int _counters[Bytecodes::number_of_codes];) // a counter for each bytecode |
|
60 |
||
61 |
friend class TemplateInterpreterGenerator; |
|
62 |
friend class InterpreterGenerator; |
|
63 |
friend class BytecodeInterpreter; |
|
64 |
||
65 |
public: |
|
66 |
// Initialization |
|
67 |
static void reset() PRODUCT_RETURN; // reset counters |
|
68 |
||
69 |
// Profile printing |
|
70 |
static void print(float cutoff = 0.01F) PRODUCT_RETURN; // cutoff in percent |
|
71 |
}; |
|
72 |
||
73 |
||
74 |
// BytecodePairHistogram collects number of executions of bytecode pairs. |
|
75 |
// A bytecode pair is any sequence of two consequtive bytecodes. |
|
76 |
||
77 |
class BytecodePairHistogram: AllStatic { |
|
78 |
public: // for SparcWorks |
|
79 |
enum Constants { |
|
80 |
log2_number_of_codes = 8, // use a power of 2 for faster addressing |
|
81 |
number_of_codes = 1 << log2_number_of_codes, // must be no less than Bytecodes::number_of_codes |
|
82 |
number_of_pairs = number_of_codes * number_of_codes |
|
83 |
}; |
|
84 |
||
85 |
private: |
|
86 |
NOT_PRODUCT(static int _index;) // new bytecode is shifted in - used to index into _counters |
|
87 |
NOT_PRODUCT(static int _counters[number_of_pairs];) // a counter for each pair |
|
88 |
||
89 |
friend class TemplateInterpreterGenerator; |
|
90 |
friend class InterpreterGenerator; |
|
91 |
||
92 |
public: |
|
93 |
// Initialization |
|
94 |
static void reset() PRODUCT_RETURN; // reset counters |
|
95 |
||
96 |
// Profile printing |
|
97 |
static void print(float cutoff = 0.01F) PRODUCT_RETURN; // cutoff in percent |
|
98 |
}; |
|
7397 | 99 |
|
100 |
#endif // SHARE_VM_INTERPRETER_BYTECODEHISTOGRAM_HPP |