Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/interpreter/bytecodeHistogram.hpp
32285 views
/*1* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_INTERPRETER_BYTECODEHISTOGRAM_HPP25#define SHARE_VM_INTERPRETER_BYTECODEHISTOGRAM_HPP2627#include "interpreter/bytecodes.hpp"28#include "memory/allocation.hpp"2930// BytecodeCounter counts the number of bytecodes executed3132class BytecodeCounter: AllStatic {33private:34NOT_PRODUCT(static int _counter_value;)35NOT_PRODUCT(static jlong _reset_time;)3637friend class TemplateInterpreterGenerator;38friend class BytecodeInterpreter;3940public:41// Initialization42static void reset() PRODUCT_RETURN;4344// Counter info (all info since last reset)45static int counter_value() PRODUCT_RETURN0 NOT_PRODUCT({ return _counter_value; });46static double elapsed_time() PRODUCT_RETURN0; // in seconds47static double frequency() PRODUCT_RETURN0; // bytecodes/seconds4849// Counter printing50static void print() PRODUCT_RETURN;51};525354// BytecodeHistogram collects number of executions of bytecodes5556class BytecodeHistogram: AllStatic {57private:58NOT_PRODUCT(static int _counters[Bytecodes::number_of_codes];) // a counter for each bytecode5960friend class TemplateInterpreterGenerator;61friend class InterpreterGenerator;62friend class BytecodeInterpreter;6364public:65// Initialization66static void reset() PRODUCT_RETURN; // reset counters6768// Profile printing69static void print(float cutoff = 0.01F) PRODUCT_RETURN; // cutoff in percent70};717273// BytecodePairHistogram collects number of executions of bytecode pairs.74// A bytecode pair is any sequence of two consequtive bytecodes.7576class BytecodePairHistogram: AllStatic {77public: // for SparcWorks78enum Constants {79log2_number_of_codes = 8, // use a power of 2 for faster addressing80number_of_codes = 1 << log2_number_of_codes, // must be no less than Bytecodes::number_of_codes81number_of_pairs = number_of_codes * number_of_codes82};8384private:85NOT_PRODUCT(static int _index;) // new bytecode is shifted in - used to index into _counters86NOT_PRODUCT(static int _counters[number_of_pairs];) // a counter for each pair8788friend class TemplateInterpreterGenerator;89friend class InterpreterGenerator;9091public:92// Initialization93static void reset() PRODUCT_RETURN; // reset counters9495// Profile printing96static void print(float cutoff = 0.01F) PRODUCT_RETURN; // cutoff in percent97};9899#endif // SHARE_VM_INTERPRETER_BYTECODEHISTOGRAM_HPP100101102