-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat: implement process.cpuUsage
(Deno.cpuUsage
)
#27217
base: main
Are you sure you want to change the base?
Conversation
Does it need to check |
|
Do I need to change something after adding an op? After add the |
Signed-off-by: Cyan <[email protected]>
The operations are listed in 2 different arrays, and they must have the same order: See Look at the last 2 elements of both lists. |
Signed-off-by: Cyan <[email protected]>
Signed-off-by: Cyan <[email protected]>
Signed-off-by: Cyan <[email protected]>
Signed-off-by: Cyan <[email protected]>
Signed-off-by: Cyan <[email protected]>
Signed-off-by: Cyan <[email protected]>
@irbull can you please review again? |
I'm not on the core team so I can't actually review this, but I'll look at this again tomorrow and leave my thoughts, and I can ask on Discord for someone on the team to take a final look. |
user: 0, | ||
system: 0, | ||
}; | ||
return Deno.cpuUsage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit, but maybe define this the same way that memoryUsage
is defined. That is, create a function
and then just Process.prototype.memoryUsage = memoryUsage;
.
I was going to suggest moving this next to memoryUsage
too, but it seems that the prototypes
are mostly organized in alphabetical order (not all), so maybe leave it here.
external: usize, | ||
#[op2] | ||
#[serde] | ||
fn op_runtime_cpu_usage() -> (usize, usize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the other ops return a Struct, not just a tuple. While a tuple may be faster (I'm not sure how much performance matters here) consistency might be better.
s.external_memory(), | ||
); | ||
|
||
(rss, heap_total, heap_used, external) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see you changed the memory_usage
one too. Consistency FTW!
No description provided.