Class PDebug

java.lang.Object
edu.umd.cs.piccolo.util.PDebug

public class PDebug extends Object
PDebug is used to set framework wide debugging flags.

Version:
1.0
Author:
Jesse Grosjean
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static boolean
    Displays bounding boxes around nodes.
    static boolean
    Displays a tint to all shapes within a bounding box.
    static boolean
    Set to true if you want to display common errors with painting and threading.
    static boolean
    Set to true to display frame rate in the console.
    static boolean
    Set to true to display used memory in console.
    static boolean
    Set to true to display clip bounds boxes.
    static boolean
    Whether to complain whenever common threading issues occur.
    static int
    How often in frames result info should be printed to the console.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Records that processing of input has finished.
    static void
    Flags processing of output as finished.
    static long
    Returns an approximation of the amount of memory that is being used.
    static Color
    Generates a color for use while debugging.
    long
    Return the number of frames that have been processed since the last time resetFPSTiming was called.
    static double
    Return the frames per second used to process input events and activities.
    static double
    Return the frames per seconds used to paint graphics to the screen.
    static boolean
    Returns whether output is being processed.
    static double
    Return how many frames are processed and painted per second.
    static void
    Ensures that painting is not invalidating paint regions and that it's being called from the dispatch thread.
    static void
    Reset the variables used to track FPS.
    static void
    Checks that process inputs is being doing from the Swing Dispatch Thread.
    static void
    Records that processing of input has started.
    static void
    Records that processing of ouptut has begun.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • debugRegionManagement

      public static boolean debugRegionManagement
      Set to true to display clip bounds boxes.
    • debugPaintCalls

      public static boolean debugPaintCalls
      Set to true if you want to display common errors with painting and threading.
    • debugPrintFrameRate

      public static boolean debugPrintFrameRate
      Set to true to display frame rate in the console.
    • debugPrintUsedMemory

      public static boolean debugPrintUsedMemory
      Set to true to display used memory in console.
    • debugBounds

      public static boolean debugBounds
      Displays bounding boxes around nodes. Used in PCamera.
    • debugFullBounds

      public static boolean debugFullBounds
      Displays a tint to all shapes within a bounding box.
    • debugThreads

      public static boolean debugThreads
      Whether to complain whenever common threading issues occur.
    • printResultsFrameRate

      public static int printResultsFrameRate
      How often in frames result info should be printed to the console.
  • Method Details

    • getDebugPaintColor

      public static Color getDebugPaintColor()
      Generates a color for use while debugging.
      Returns:
      a color for use while debugging.
    • scheduleProcessInputs

      public static void scheduleProcessInputs()
      Checks that process inputs is being doing from the Swing Dispatch Thread.
    • processRepaint

      public static void processRepaint()
      Ensures that painting is not invalidating paint regions and that it's being called from the dispatch thread.
    • getProcessingOutput

      public static boolean getProcessingOutput()
      Returns whether output is being processed.
      Returns:
      whether output is being processed
    • startProcessingOutput

      public static void startProcessingOutput()
      Records that processing of ouptut has begun.
    • endProcessingOutput

      public static void endProcessingOutput(Graphics g)
      Flags processing of output as finished. Updates all stats in the process.
      Parameters:
      g - graphics context in which processing has finished
    • startProcessingInput

      public static void startProcessingInput()
      Records that processing of input has started.
    • endProcessingInput

      public static void endProcessingInput()
      Records that processing of input has finished.
    • getTotalFPS

      public static double getTotalFPS()
      Return how many frames are processed and painted per second. Note that since piccolo doesn't paint continuously this rate will be slow unless you are interacting with the system or have activities scheduled.
      Returns:
      frame rate achieved
    • getInputFPS

      public static double getInputFPS()
      Return the frames per second used to process input events and activities.
      Returns:
      # of frames per second that were allocated to processing input
    • getOutputFPS

      public static double getOutputFPS()
      Return the frames per seconds used to paint graphics to the screen.
      Returns:
      # of frames per second that were used up to processing output
    • getFramesProcessed

      public long getFramesProcessed()
      Return the number of frames that have been processed since the last time resetFPSTiming was called.
      Returns:
      total number of frames processed
    • resetFPSTiming

      public static void resetFPSTiming()
      Reset the variables used to track FPS. If you reset seldom they you will get good average FPS values, if you reset more often only the frames recorded after the last reset will be taken into consideration.
    • getApproximateUsedMemory

      public static long getApproximateUsedMemory()
      Returns an approximation of the amount of memory that is being used. Not that this call might affecting timings.
      Returns:
      approximate # of bytes of memory used