Skip to content

Instantly share code, notes, and snippets.

@ecin
Created June 2, 2009 04:11
Show Gist options
  • Save ecin/122004 to your computer and use it in GitHub Desktop.
Save ecin/122004 to your computer and use it in GitHub Desktop.
// Our lovely namespace.
var rack = {};
// Access to all set Probes
rack.Probes = {};
// An event will be added through this function
rack.Probes.addEvent = function( pid, timestamp, name, arguments ){
if(!isDefined(rack.Probes[name]))
new rack.Probe(name);
rack.Probes[name].addEvent( new rack.Event(pid, timestamp, name, arguments));
}
// A Probe "type"
rack.Probe = function( name ){
this.name = name;
this.events = [];
rack.Probes[name] = this;
}
rack.Probe.prototype.addEvent = function( event ){
if( event.name == this.name )
this.events.push(event);
}
// A Probe "event", i.e. result of a rack.Probe firing in the app
rack.Event = function( pid, timestamp, name, arguments ){
this.pid = pid;
this.timestamp = timestamp; // unix time
this.name = name;
this.arguments = arguments; // a hash
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment