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
refactor: Added the Nvidia SM average as app_status #7671
Conversation
$gpus=0; | ||
$sm_total=0; | ||
while (isset($gpuArray[$gpus])) { | ||
$sm_total = $sm_total+explode(",", $gpuArray[$gpus])[3]; |
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.
You can do:
foreach ($gpuArray as $gpu) {
$stats = explode(",", $gpu);
$sm_total += $stats[3];
}
$sm_average = ($sm_total ? 0 : ($sm_total / count($gpuArray));
Can't reference an array like that in php 5.3 :-)
Need to avoid divide by zero too.
} | ||
$sm_average = ($sm_total ? 0 : ($sm_total / count($gpuArray))); |
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.
This should probably be the other way around, if $sm_total
evaluates to true, it should calculate the average.
The inspection completed: 1 new issues |
This thread has been automatically locked since there has not been any recent activity after it was closed. |
DO NOT DELETE THIS TEXT
Please note
Testers
If you would like to test this pull request then please run:
./scripts/github-apply <pr_id>
, i.e./scripts/github-apply 5926