Library globals

Class globals . debug . Tracer

View source

Tracer - perform conditional backtraces / statistics controlled via property tree
* backtraces are written to property tree
* do only a limited number of BT, avoid flooding the log / console
* trace statistics can be dumped to XML file

Data can be viewed / modified in the prop tree /_debug/nas/trc/<myLabel>/*
* tokens: number of backtraces to do; each hit will decrement this by 1
* hits:   total number of hits

== Example == 
var myBP = debug.Tracer.new("myLabel", 0);
myBP.enable(4);       # allow 4 hits, then be quiet 

#at the place of interest (e.g. in some loop or class method) insert:
myBP.hit();           # do backtrace here if tokens > 0, reduce tokens by 1
myBP.hit(myFunction); # same but call myFunction instead of backtrace

print(myBP.getHits()); # print total number of hits

Functions

disableTracing

dumpTrace

enable

enable BP and set hit limit; tokens: int > 0; default: 1 (single shot); 0 allowed (=disable);

hit

new

label: Used in property path and as text for backtrace. dump_locals: bool passed to backtrace. Dump variables in BT. skip_level: int passed to backtrace.

resetTrace