Skip to content

Feature: Count over time #3

@kirbysayshi

Description

@kirbysayshi

I think I'm looking for something like:

function physicsEngineCollisionCallback(a, b) {
  rstats('collisions').mark(); // alternative: .inc()
}

The idea being that we want to know the "flow frequency" of how many collisions are happening over time without manually managing decay.

I could also see this being used to monitor a stream:

someStream.on('data', function(chunk) {
  rstats('someStream emit').mark();
});

If I wanted to measure flow rate, .set is good enough, but not for frequency of flow.

Perhaps this is possible today, and I'm missing something?

For context, I'm measuring both a standard game loop as well as when asynchronous messages arrive via postMessage from a web worker:

worker.addEventListener('message', function(ev) {
  rstats('msgs: recv').tick();
  rstats().update(); // ensure the graph always reflects
  // Do stuff with message
});

.tick will measure the time between calls, but I want to measure how many calls over time. Not sure how best to handle that, which is why I'm opening this ticket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions