Class DTraceWriter

    • Constructor Detail

      • DTraceWriter

        public DTraceWriter​(PrintWriter writer)
        Initializes the DTraceWriter.
        Parameters:
        writer - stream to write to
    • Method Detail

      • methodEntry

        public void methodEntry​(@GuardSatisfied DTraceWriter this,
                                MethodInfo mi,
                                int nonceVal,
                                @Nullable Object obj,
                                Object[] args)
        Prints the method entry program point in the dtrace file.
      • clinitEntry

        public void clinitEntry​(@GuardSatisfied DTraceWriter this,
                                String pptname,
                                int nonceVal)
        Prints an entry program point for a static initializer in the dtrace file.
      • methodExit

        public void methodExit​(@GuardSatisfied DTraceWriter this,
                               MethodInfo mi,
                               int nonceVal,
                               @Nullable Object obj,
                               Object[] args,
                               Object ret_val,
                               int lineNum)
        Prints the method exit program point in the dtrace file.
      • clinitExit

        public void clinitExit​(@GuardSatisfied DTraceWriter this,
                               String pptname,
                               int nonceVal)
        Prints an exit program point for a static initializer in the dtrace file.
      • getFieldValues

        public static List<ObjectgetFieldValues​(Field field,
                                                  List<Object> theObjects)
        Returns a list of values of the field for each Object in theObjects.
        Parameters:
        theObjects - list of Objects, each must have the Field field
        field - which field of theObjects we are probing
      • getValue

        public static Object getValue​(Field classField,
                                      Object theObj)
        Get the value of a certain field in theObj.
        Parameters:
        classField - which field we are interested in
        theObj - the object whose field we are examining. TheoObj must be null, Nonsensical, or of a type which contains the field classField.
        Returns:
        the value of the classField field in theObj
      • getListFromArray

        public static List<ObjectgetListFromArray​(Object arrayVal)
        Return a List derived from an aray.
        Parameters:
        arrayVal - must be an array type
        Returns:
        a List (with correct primitive wrappers) corresponding to the array
      • getTypeNameList

        public static @Nullable List<StringgetTypeNameList​(List<Object> theVals)
        Returns a list of Strings which are the names of the run-time types in the theVals param.
        Parameters:
        theVals - list of ObjectReferences
        Returns:
        a list of Strings which are the names of the run-time types in the theVals param
      • removeWrappers

        public static @Nullable Class<?> removeWrappers​(Object val,
                                                        Class<?> declared,
                                                        boolean runtime)
        Get the type of val, removing any PrimitiveWrapper if it exists For example, if we execute removeWRappers(val, boolean.class, true) where (val instanceof Runtime.PrimitiveWrapper), then the method returns boolean.class
        Parameters:
        val - the object whose type we are examining
        declared - the declared type of the variable corresponding to val
        runtime - should we use the run-time type or declared type?
        Returns:
        the variable's type, with primitive wrappers removed, or null if the value is non-null