Package edu.umd.cs.piccolo.util
Class PDebug
java.lang.Object
edu.umd.cs.piccolo.util.PDebug
PDebug is used to set framework wide debugging flags.
- Version:
- 1.0
- Author:
- Jesse Grosjean
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanDisplays bounding boxes around nodes.static booleanDisplays a tint to all shapes within a bounding box.static booleanSet to true if you want to display common errors with painting and threading.static booleanSet to true to display frame rate in the console.static booleanSet to true to display used memory in console.static booleanSet to true to display clip bounds boxes.static booleanWhether to complain whenever common threading issues occur.static intHow often in frames result info should be printed to the console. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRecords that processing of input has finished.static voidFlags processing of output as finished.static longReturns an approximation of the amount of memory that is being used.static ColorGenerates a color for use while debugging.longReturn the number of frames that have been processed since the last time resetFPSTiming was called.static doubleReturn the frames per second used to process input events and activities.static doubleReturn the frames per seconds used to paint graphics to the screen.static booleanReturns whether output is being processed.static doubleReturn how many frames are processed and painted per second.static voidEnsures that painting is not invalidating paint regions and that it's being called from the dispatch thread.static voidReset the variables used to track FPS.static voidChecks that process inputs is being doing from the Swing Dispatch Thread.static voidRecords that processing of input has started.static voidRecords that processing of ouptut has begun.
-
Field Details
-
debugRegionManagement
public static boolean debugRegionManagementSet to true to display clip bounds boxes. -
debugPaintCalls
public static boolean debugPaintCallsSet to true if you want to display common errors with painting and threading. -
debugPrintFrameRate
public static boolean debugPrintFrameRateSet to true to display frame rate in the console. -
debugPrintUsedMemory
public static boolean debugPrintUsedMemorySet to true to display used memory in console. -
debugBounds
public static boolean debugBoundsDisplays bounding boxes around nodes. Used in PCamera. -
debugFullBounds
public static boolean debugFullBoundsDisplays a tint to all shapes within a bounding box. -
debugThreads
public static boolean debugThreadsWhether to complain whenever common threading issues occur. -
printResultsFrameRate
public static int printResultsFrameRateHow often in frames result info should be printed to the console.
-
-
Method Details
-
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
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
-