class Novika::Frontend::CLI::Profiler

Overview

A crude sample-based profiler which is triggered on every form the engine tries to execute.

Counts the amount of times a form was attempted to be open by the engine.

You can use #to_table to convert a snapshot of data to a Tablo::Table table.

Included Modules

Defined in:

cli.cr

Constructors

Instance Method Summary

Instance methods inherited from module Novika::IExhaustTracker

on_form_begin(engine : Engine, form : Form) on_form_begin, on_form_end(engine : Engine, form : Form) on_form_end

Constructor Detail

def self.new(period : UInt64 = 32_u64) #

Initializes this profiler.

period is the period between samples, in Engine loop ticks. The less the value, the more samples are taken and the more precise the results are (but the program may run slower).


Instance Method Detail

def on_form_begin(engine : Engine, form : Form) #
Description copied from module Novika::IExhaustTracker

Invoked before engine opens the given form.


def to_table(cutoff = 0.01) #

Assembles and returns the data from this profiler as a Tablo::Table.

cutoff specifies the ratio [0-1] below which profiles should be rejected (i.e., too insignificant).