Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v12.x backport] worker: add eventLoopUtilization() #37165

Merged
merged 2 commits into from
Mar 16, 2021

Commits on Mar 16, 2021

  1. worker: add eventLoopUtilization()

    Allow calling eventLoopUtilization() directly on a worker thread:
    
        const worker = new Worker('./foo.js');
        const elu = worker.performance.eventLoopUtilization();
        setTimeout(() => {
          worker.performance.eventLoopUtilization(elu);
        }, 10);
    
    Add a new performance object on the Worker instance that will hopefully
    one day hold all the other performance metrics, such as nodeTiming.
    
    Include benchmarks and tests.
    
    PR-URL: nodejs#35664
    Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    
    Backport-PR-URL: nodejs#37165
    trevnorris authored and richardlau committed Mar 16, 2021
    Configuration menu
    Copy the full SHA
    eec7542 View commit details
    Browse the repository at this point in the history
  2. test: correct test-worker-eventlooputil

    The active worker check compared the time from sending message till
    response arrived from worker with the complete time the worker was
    running till it responses to the spin request.
    
    If sending back the message is slow for some reason the test fails.
    
    Adapt the test to compare the time seen inside the worker with the
    time read from main thread.
    
    PR-URL: nodejs#35891
    Fixes: nodejs#35844
    Refs: nodejs#35886
    Refs: nodejs#35664
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    
    Backport-PR-URL: nodejs#37165
    Flarna authored and richardlau committed Mar 16, 2021
    Configuration menu
    Copy the full SHA
    d7a4ccd View commit details
    Browse the repository at this point in the history