Coder Social home page Coder Social logo

grammar-profiler-simple's Introduction

Grammar::Profiler::Simple

This module provides a simple profiler for Perl 6 grammars. To enable profiling simply add

use Grammar::Profiler::Simple;

to your code. Any grammar in the lexical scope of the use statement will automatically have profiling information collected when the grammar is used.

This module exports two subroutines, each with 3 variants:

reset-timing()

Reset all time information collected since the start of the program or since the last call to reset-timing()

reset-timing($grammar)

Reset all time information only for the specified grammar.

reset-timing($grammar, $rule)

Reset all time information only for the specified rule within the specified grammar.

get-timing()

Retrieve the timing information collected so far or since the last call to reset-timing. Returned as a mult-level hash with the first level indexed by the name of the grammar and the second level indexed by the name of the rule within the grammar.

get-timing($grammar)

Retrieve the timing information collected for a particular grammar.

get-timing($grammar, $rule)

Retrieve the timing information collected for a particular rule within a particular grammar.

Timing information

There are 2 bits of timing information collected: the number of times each rule was called and the cumulative time that was spent executing each rule. For example

say "MyRule was called {get-timing('MyGrammar','MyRule')<calls>} times";
say "The total time executing MyRule was {get-timing('MyGrammar','MyRule')<time>} seconds";

grammar-profiler-simple's People

Contributors

perlpilot avatar froggs avatar zakame avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.