Created
June 2, 2009 04:11
-
-
Save ecin/122004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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