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

worker: allow retrieving elu from parent #45330

Closed
wants to merge 1 commit into from

Commits on Nov 9, 2022

  1. worker: allow retrieving elu from parent

    Usually, when extracting the ELU from a specific JS thread is better to
    do it from a different thread as the event loop we're observing might
    already be blocked. The `Worker.performance.eventLoopUtilization()`
    method allows us to do this for worker threads, but there's not a way
    to do this for the main thread. This new API, which allows us to
    retrieve the ELU of the parent thread from a specific worker, is going
    to enable this.
    
    For the moment, I have defined this new API in
    ```
    require('worker_threads').parent.performance.eventLoopUtilization()
    ```
    though I haven't added documentation yet as
    a) I want to know first whether this approach is acceptable, and in case
    it is,
    b) I'm not really sure whether that's the place the API should live in.
    Would love receiving feedback on this.
    santigimeno committed Nov 9, 2022
    Configuration menu
    Copy the full SHA
    d911989 View commit details
    Browse the repository at this point in the history