std.prof

<- Back to stdlib index

Runtime profiling helpers for Eta programs.

std.prof wraps runtime profiling primitives for both trace and sample sessions.

Import

(import std.prof)

Exports

Arguments

mode:

mode can be passed as a symbol or string.

hz:

format:

prof/counter increments named counters that are included in pretty and json reports.

pretty and json flat report rows include bytes_allocated as a coarse per-frame allocation metric.

Example

(module demo
  (import std.prof)
  (begin
    (define (fib n)
      (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))

    (call-with-values
      (lambda ()
        (prof/with
          (lambda ()
            (prof/counter "fib-runs" 1)
            (fib 10))
          'trace
          1000))
      (lambda (value handle)
        (display value) (newline)
        (display (prof/report handle "json"))))))