< prev index next >

src/hotspot/share/interpreter/bytecodeHistogram.hpp

Print this page

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 #ifndef SHARE_INTERPRETER_BYTECODEHISTOGRAM_HPP
26 #define SHARE_INTERPRETER_BYTECODEHISTOGRAM_HPP
27 
28 #include "interpreter/bytecodes.hpp"
29 #include "memory/allStatic.hpp"
30 
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         BytecodeInterpreter;
63 
64  public:
65   // Initialization
66   static void reset()                       PRODUCT_RETURN; // reset counters
67 
68   // Profile printing
69   static void print(float cutoff = 0.01F)   PRODUCT_RETURN; // cutoff in percent
70 };
71 
72 
73 // BytecodePairHistogram collects number of executions of bytecode pairs.
74 // A bytecode pair is any sequence of two consecutive bytecodes.
75 
76 class BytecodePairHistogram: AllStatic {
77  public: // for solstudio
78   enum Constants {
79     log2_number_of_codes = 8,                         // use a power of 2 for faster addressing
80     number_of_codes      = 1 << log2_number_of_codes, // must be no less than Bytecodes::number_of_codes
81     number_of_pairs      = number_of_codes * number_of_codes
82   };
83 
84  private:
85   NOT_PRODUCT(static int  _index;)                      // new bytecode is shifted in - used to index into _counters
86   NOT_PRODUCT(static int  _counters[number_of_pairs];)  // a counter for each pair
87 
88   friend class TemplateInterpreterGenerator;
89 

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 #ifndef SHARE_INTERPRETER_BYTECODEHISTOGRAM_HPP
26 #define SHARE_INTERPRETER_BYTECODEHISTOGRAM_HPP
27 
28 #include "interpreter/bytecodes.hpp"
29 #include "memory/allStatic.hpp"
30 
31 // BytecodeCounter counts the number of bytecodes executed
32 
33 class BytecodeCounter: AllStatic {
34  private:
35   static jlong _counter_value;
36   static jlong _reset_time;
37 
38   friend class TemplateInterpreterGenerator;
39   friend class         BytecodeInterpreter;
40 
41  public:
42   // Initialization
43   static void reset();
44 
45   // Counter info (all info since last reset)
46   static jlong  counter_value() { return _counter_value; }
47   static double elapsed_time(); // in seconds
48   static double frequency();    // bytecodes/seconds
49 
50   // Counter printing
51   static void   print();
52 };
53 
54 
55 // BytecodeHistogram collects number of executions of bytecodes
56 
57 class BytecodeHistogram: AllStatic {
58  private:
59   static int _counters[Bytecodes::number_of_codes];   // a counter for each bytecode
60 
61   friend class TemplateInterpreterGenerator;
62   friend class         BytecodeInterpreter;
63 
64  public:
65   // Initialization
66   static void reset(); // reset counters
67 
68   // Profile printing
69   static void print(float cutoff); // cutoff in percent
70 };
71 
72 
73 // BytecodePairHistogram collects number of executions of bytecode pairs.
74 // A bytecode pair is any sequence of two consecutive bytecodes.
75 
76 class BytecodePairHistogram: AllStatic {
77  public: // for solstudio
78   enum Constants {
79     log2_number_of_codes = 8,                         // use a power of 2 for faster addressing
80     number_of_codes      = 1 << log2_number_of_codes, // must be no less than Bytecodes::number_of_codes
81     number_of_pairs      = number_of_codes * number_of_codes
82   };
83 
84  private:
85   NOT_PRODUCT(static int  _index;)                      // new bytecode is shifted in - used to index into _counters
86   NOT_PRODUCT(static int  _counters[number_of_pairs];)  // a counter for each pair
87 
88   friend class TemplateInterpreterGenerator;
89 
< prev index next >