BackburnerJS / backburner.js

A rewrite of the Ember.js run loop as a generic microlibrary
MIT License
392 stars 80 forks source link

Adds the ability to get debug info from the backburner instance. #348

Closed scalvert closed 5 years ago

scalvert commented 5 years ago

Adds the ability to get debug info when the backburner instance's DEBUG flag is set to true. This internally leverages the existing functionality of retrieving stacktraces from queues.

Changes include:

The intent is that this can be leveraged for additional information when identifying timer leaks within ember-qunit, which already contains some leak detection.

Sample output:

{
  "counters": {
    "begin": 59,
    "end": 49,
    "events": {
      "begin": 58,
      "end": 0
    },
    "autoruns": {
      "created": 13,
      "completed": 12
    },
    "run": 16,
    "join": 0,
    "defer": 0,
    "schedule": 17,
    "scheduleIterable": 0,
    "deferOnce": 0,
    "scheduleOnce": 10,
    "setTimeout": 1,
    "later": 13,
    "throttle": 4,
    "debounce": 60,
    "cancelTimers": 2,
    "cancel": 35,
    "loops": {
      "total": 58,
      "nested": 2
    }
  },
  "timers": [],
  "instanceStack": [
    {
      "one": [],
      "two": [],
      "three": [
        {
          "target": null,
          "stack": "Three stack"
        }
      ],
      "four": [
        {
          "target": null,
          "stack": "Four stack"
        }
      ]
    },
    {
      "one": [
        {
          "target": null,
          "stack": "One stack"
        }
      ],
      "two": [
        {
          "target": null,
          "stack": "Two stack"
        }
      ],
      "three": [],
      "four": []
    }
  ]
}

TODO:

scalvert commented 5 years ago

@rwjblue - what else do you think this PR needs?