Skip to content

Instantly share code, notes, and snippets.

@calderas
Created July 15, 2013 20:28
Show Gist options
  • Save calderas/6003146 to your computer and use it in GitHub Desktop.
Save calderas/6003146 to your computer and use it in GitHub Desktop.
beginInstrumentation = function(eventName) {
var styles;
if (eventName == null) {
eventName = "render";
}
styles = {
"render.render.metamorph": "color: #a47701;",
"render.render.boundHandlebars": "color: #0f51fe;",
"render.view": "color: #37be02;"
};
Ember.subscribe(eventName, {
before: function(name, ts, payload) {
console.group(name);
return ts;
},
after: function(name, ts, payload, b_ts) {
var elapsed, style;
style = styles[name] || "";
elapsed = (ts - b_ts).toFixed(4);
console.log("%c" + payload.object + ": " + elapsed + "ms", style);
return console.groupEnd();
}
});
};
beginInstrumentation();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment