# Effect.Perf

A naive performance effect for gathering data about the
performance of effectful programmes.

MkPMetrics : (canPerf : Bool) -> (livePerf : Bool) -> (counters : List (String, Nat)) -> (timers : List (String, Timer)) -> (stime : Integer) -> (stamps : List (String, Integer)) -> PMetrics
MkTimer : (desc : String) -> (start : Integer) -> (stop : Integer) -> (splits : List (Integer, Maybe String)) -> Timer
PERF : EFFECT
record PMetrics

  Performance Metrics to keep during program lifetime.

  MkPMetrics : (canPerf : Bool) -> (livePerf : Bool) -> (counters : List (String, Nat)) -> (timers : List (String, Timer)) -> (stime : Integer) -> (stamps : List (String, Integer)) -> PMetrics
  canPerf : (rec : PMetrics) -> Bool
  livePerf : (rec : PMetrics) -> Bool
  counters : (rec : PMetrics) -> List (String, Nat)
  timers : (rec : PMetrics) -> List (String, Timer)
  stime : (rec : PMetrics) -> Integer
  stamps : (rec : PMetrics) -> List (String, Integer)
data Perf : Effect
  GetMetrics : sig Perf PMetrics PMetrics
  TurnOn : Bool -> sig Perf () PMetrics PMetrics
  MkCounter : String -> sig Perf () PMetrics PMetrics
  IncCounter : String -> sig Perf () PMetrics PMetrics
  Timestamp : String -> sig Perf () PMetrics PMetrics
  MkStopWatch : String -> sig Perf () PMetrics PMetrics
  TimerStuff : TOpt -> String -> Maybe String -> sig Perf () PMetrics PMetrics
data TOpt : Type
  START : TOpt
  STOP : TOpt
  SPLIT : TOpt
record Timer

  A Simple timer.

  MkTimer : (desc : String) -> (start : Integer) -> (stop : Integer) -> (splits : List (Integer, Maybe String)) -> Timer
  desc : (rec : Timer) -> String
  start : (rec : Timer) -> Integer
  stop : (rec : Timer) -> Integer
  splits : (rec : Timer) -> List (Integer, Maybe String)
collectPMetrics : Bool -> Eff () [PERF]
collectPMetricsAndShow : Eff () [PERF]

  Turn on performance metrics and show during operation

collectPMetricsOnly : Eff () [PERF]

  Turn on performance metrics.

defaultTimer : String -> Timer
displayPerfMetrics : PMetrics -> String
displayTimer : Timer -> String
displayTimerOpt : TOpt -> String
getPerfMetrics : Eff PMetrics [PERF]

  Return gathered metrics

incCounter : String -> Eff () [PERF]

  Increment the counter

incCounter' : String -> PMetrics -> PMetrics
mkCounter : String -> Eff () [PERF]

  Create a counter

mkTimer : String -> Eff () [PERF]
perfLog : PMetrics -> String -> IO ()
splitTimer : String -> Eff () [PERF]

  Split a timer

splitTimerMsg : String -> String -> Eff () [PERF]
startTimer : String -> Eff () [PERF]

  Start a timer

stopTimer : String -> Eff () [PERF]

  Stop a timer

timerStuff' : TOpt -> Integer -> String -> Maybe String -> PMetrics -> PMetrics
timestamp : String -> Eff () [PERF]

  Create a time stamp.