Module Debug.Profile

Simple profiling library with operations to access run-time data.

Author: Michael Hanus

Version: January 2019

Summary of exported operations:

getProcessInfos :: IO [(ProcessInfo,Int)]  Deterministic 
Returns various informations about the current state of the Curry process.
garbageCollectorOff :: IO ()  Deterministic 
Turns off the garbage collector of the run-time system (if possible).
garbageCollectorOn :: IO ()  Deterministic 
Turns on the garbage collector of the run-time system (if possible).
garbageCollect :: IO ()  Deterministic 
Invoke the garbage collector (if possible).
showMemInfo :: [(ProcessInfo,Int)] -> String  Deterministic 
Get a human readable version of the memory situation from the process infos.
printMemInfo :: IO ()  Deterministic 
Print a human readable version of the current memory situation of the Curry process.
profileTime :: IO a -> IO a  Deterministic 
Print the time needed to execute a given IO action.
getTimings :: IO a -> IO (a,Int,Int,Int)  Deterministic 
Returns the run time, elapsed time, and number of garbage collections needed to execute a given IO action.
profileTimeNF :: a -> IO ()  Deterministic 
Evaluates the argument to normal form and print the time needed for this evaluation.
getTimingsNF :: a -> IO (Int,Int,Int)  Deterministic 
Evaluates the argument to normal form and returns the run time, elapsed time, and number of garbage collections needed for this evaluation.
profileSpace :: IO a -> IO a  Deterministic 
Print the time and space needed to execute a given IO action.
profileSpaceNF :: a -> IO ()  Deterministic 
Evaluates the argument to normal form and print the time and space needed for this evaluation.

Exported datatypes:


ProcessInfo

The data type for representing information about the state of a Curry process.

Constructors:

  • RunTime :: ProcessInfo : the run time in milliseconds
  • ElapsedTime :: ProcessInfo : the elapsed time in milliseconds
  • Memory :: ProcessInfo : the total memory in bytes
  • Code :: ProcessInfo : the size of the code area in bytes
  • Stack :: ProcessInfo : the size of the local stack for recursive functions in bytes
  • Heap :: ProcessInfo : the size of the heap to store term structures in bytes
  • Choices :: ProcessInfo : the size of the choicepoint stack
  • GarbageCollections :: ProcessInfo : the number of garbage collections performed

Exported operations:

getProcessInfos :: IO [(ProcessInfo,Int)]  Deterministic 

Returns various informations about the current state of the Curry process. Note that the returned values are implementation dependent so that one should interpret them with care!

Note for KiCS2 users: Since GHC version 7.x, one has to set the run-time option -T when this operation is used. This can be done by the kics2 command

:set rts -T
Further infos:
  • externally defined

garbageCollectorOff :: IO ()  Deterministic 

Turns off the garbage collector of the run-time system (if possible). This could be useful to get more precise data of memory usage.

Further infos:
  • externally defined

garbageCollectorOn :: IO ()  Deterministic 

Turns on the garbage collector of the run-time system (if possible).

Further infos:
  • externally defined

garbageCollect :: IO ()  Deterministic 

Invoke the garbage collector (if possible). This could be useful before run-time critical operations.

Further infos:
  • externally defined

showMemInfo :: [(ProcessInfo,Int)] -> String  Deterministic 

Get a human readable version of the memory situation from the process infos.

printMemInfo :: IO ()  Deterministic 

Print a human readable version of the current memory situation of the Curry process.

profileTime :: IO a -> IO a  Deterministic 

Print the time needed to execute a given IO action.

getTimings :: IO a -> IO (a,Int,Int,Int)  Deterministic 

Returns the run time, elapsed time, and number of garbage collections needed to execute a given IO action.

profileTimeNF :: a -> IO ()  Deterministic 

Evaluates the argument to normal form and print the time needed for this evaluation.

getTimingsNF :: a -> IO (Int,Int,Int)  Deterministic 

Evaluates the argument to normal form and returns the run time, elapsed time, and number of garbage collections needed for this evaluation.

profileSpace :: IO a -> IO a  Deterministic 

Print the time and space needed to execute a given IO action. During the executation, the garbage collector is turned off to get the total space usage.

profileSpaceNF :: a -> IO ()  Deterministic 

Evaluates the argument to normal form and print the time and space needed for this evaluation. During the evaluation, the garbage collector is turned off to get the total space usage.