Skip to content

Instantly share code, notes, and snippets.

@krisselden
Created August 25, 2021 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisselden/932b1e653f783eaedf145d9e0a62d0d6 to your computer and use it in GitHub Desktop.
Save krisselden/932b1e653f783eaedf145d9e0a62d0d6 to your computer and use it in GitHub Desktop.
// append at end of ember-cli-build.js
(() => {
const Instrumentation = require("ember-cli/lib/models/instrumentation");
let count = 0;
const start = Instrumentation.prototype.start;
Instrumentation.prototype.start = function hookedStart(...args) {
count++;
console.profile(args[0] + count);
return Reflect.apply(start, this, args);
};
const stopAndReport = Instrumentation.prototype.stopAndReport;
Instrumentation.prototype.stopAndReport = function hookedStopAndStart(...args) {
console.profileEnd(args[0] + count);
return Reflect.apply(stopAndReport, this, args);
};
})();

run node --inspect-brk ./node_modules/.bin/ember serve

open chrome://inspect/ in Chrome

click inspect node under Remote Target

unpause break in Sources tab

open Profiler tab and wait for profile to show up

make changes, and wait for next profile to show up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment