comparison graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiProfilingInfo.java @ 4440:271220b49abc

profiling info fixes
author Christian Haeubl <christian.haeubl@oracle.com>
date Fri, 20 Jan 2012 18:24:17 -0800
parents f7251c729b31
children 4e3aaf14cbc6
comparison
equal deleted inserted replaced
4439:f7251c729b31 4440:271220b49abc
1 /* 1 /*
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, 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.
25 25
26 /** 26 /**
27 * Represents profiling information for one specific method. 27 * Represents profiling information for one specific method.
28 */ 28 */
29 public interface RiProfilingInfo { 29 public interface RiProfilingInfo {
30 // iterating the profiling information 30 /**
31 boolean setBCI(int bci); 31 * Returns an estimate of how often the branch at the given byte code was taken.
32 int currentBCI(); 32 * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if this information is not available.
33 boolean next(); 33 */
34 boolean isAtValidData(); 34 double getBranchTakenProbability(int bci);
35 35
36 // invokevirtual/invokeinterface 36 /**
37 RiResolvedType[] getTypes(); 37 * Returns an estimate of how often the switch cases are taken at the given BCI.
38 double[] getTypeProbabilities(); 38 * @return An array of double values that contains the estimated probabilities, with 0.0 meaning never and 1.0 meaning always,
39 * or null if this information is not available. The default case is stored as the last entry.
40 */
41 double[] getSwitchProbabilities(int bci);
39 42
40 // branches 43 /**
41 double getBranchTakenProbability(); 44 * Returns all types that were encountered at the given BCI.
42 double[] getSwitchProbabilities(); 45 * @return An array containing all types that were encountered during profiling at the given BCI, or null if not available.
46 */
47 RiResolvedType[] getTypes(int bci);
43 48
44 // exceptions 49 /**
45 boolean hasExceptionOccurred(); 50 * Returns an estimate of how often each individual type is encountered at the given BCI.
51 * @return An array of double values that contains the estimated probabilities, with 0.0 meaning never and 1.0 meaning always,
52 * or null if this information is not available.
53 */
54 double[] getTypeProbabilities(int bci);
55
56 /**
57 * Returns true if the given BCI did throw an implicit exception (NullPointerException, ClassCastException,
58 * ArrayStoreException, or ArithmeticException) during profiling.
59 * @return true if any of the exceptions was encountered during profiling, false otherwise.
60 */
61 boolean getImplicitExceptionSeen(int bci);
62
63 /**
64 * Returns an estimate how often the current BCI was executed.
65 * @return the estimated execution count or -1 if not available.
66 */
67 int getExecutionCount(int bci);
46 } 68 }