webrtc-stats icon indicating copy to clipboard operation
webrtc-stats copied to clipboard

CPU metrics

Open henbos opened this issue 7 years ago • 7 comments

System, process and tab CPU usage directly affects the performance of WebRTC and WebRTC has ways of adapting depending on available CPU.

While not in direct control of WebRTC, there is a relationship in both directions between WebRTC and CPU usage. This is analogous to WebRTC and bandwidth.

Can we standardize CPU metrics?

henbos avatar Sep 26 '17 15:09 henbos

What did you have in mind?

We've done some work on sending CPU metrics from the bridge (SFU, MCU, etc) and endpoints. On the client side, we've done this as an additional object in the webrtc-stats.

I am fine with postponing this until after v1 is out.

vr000m avatar Sep 26 '17 15:09 vr000m

Just a note for when it is picked up - we'll want to verify this isn't a privacy/fingerprinting issue (may be fine, but we'll want to check with people who are involved)

jesup avatar Sep 26 '17 17:09 jesup

It would be nice with a 0.0-1.0 value for "how loaded the CPU is", but with multiple processes/tabs, CPU cores and also GPU being utilized I'm not sure it's that simple.

@icydragons Do you have thoughts on this? How do the current APIs present this?

henbos avatar Sep 27 '17 07:09 henbos

@vr000m I think CPU metrics should be in a new stats object or on the PC object. Unless we get decoding-specific CPU usage.

henbos avatar Sep 27 '17 07:09 henbos

@henbos @jesup: I know the Battery API was removed because of privacy concerns, so definitely would need a wide review for that. Also what object should we associate this to?

vr000m avatar Sep 27 '17 09:09 vr000m

It's such an obvious thing to do, I'm sure there are reasons why https://www.w3.org/standards/techs/performance#w3c_all seems to have failed to do it. Better talk to them before entering the swamp.

This message written from a computer with 6 cores, or 12 if hypercores count.

alvestrand avatar Sep 27 '17 11:09 alvestrand

This is the code we use in Hangouts, but it requires an extension and is only functional on chrome: https://cs.chromium.org/chromium/src/chrome/browser/resources/hangout_services/thunk.js

Which calls into: chrome.system.cpu.getInfo -> https://developer.chrome.com/apps/system_cpu which gives us information about the number of cores, processors, etc.

And we listen for process, tab, etc stats by listening to the chrome process information -> https://developer.chrome.com/extensions/processes#type-Process

@alvestrand That is concerning, is there a representative we could pull in who may know? I agree it seems like it would be an obvious addition.

icydragons avatar Sep 27 '17 18:09 icydragons