FreeBSD Bugzilla – Attachment 184311 Details for
Bug 220690
sysctl(8) value kern.cp_times (current CPU utilization) is inconsistent with top(1)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
cpu-consumption-kern.cp_times.sh
show-cpu (text/plain), 2.59 KB, created by
Yuri Victorovich
on 2017-07-12 19:45:23 UTC
(
hide
)
Description:
cpu-consumption-kern.cp_times.sh
Filename:
MIME Type:
Creator:
Yuri Victorovich
Created:
2017-07-12 19:45:23 UTC
Size:
2.59 KB
patch
obsolete
>#!/bin/sh > >(while sleep 1 && sysctl -n kern.cp_times; do :; done) | awk ' > BEGIN {n = 0; > C = 256; > cpu0used = cpu0total = cpu1used = cpu1total = cpu2used = cpu2total = cpu3used = cpu3total = 0; > cpu4used = cpu4total = cpu5used = cpu5total = cpu6used = cpu6total = cpu7used = cpu7total = 0;}; > { > cpu0used_new = $1+$2+$3+$4 ; cpu0total_new = $1+$2+$3+$4+$5; > cpu1used_new = $6+$7+$8+$9 ; cpu1total_new = $6+$7+$8+$9+$10; > cpu2used_new = $11+$12+$13+$14; cpu2total_new = $11+$12+$13+$14+$15; > cpu3used_new = $16+$17+$18+$19; cpu3total_new = $16+$17+$18+$19+$20; > cpu4used_new = $21+$22+$23+$24; cpu4total_new = $21+$22+$23+$24+$25; > cpu5used_new = $26+$27+$28+$29; cpu5total_new = $26+$27+$28+$29+$30; > cpu6used_new = $31+$32+$33+$34; cpu6total_new = $31+$32+$33+$34+$35; > cpu7used_new = $36+$37+$38+$39; cpu7total_new = $36+$37+$38+$39+$40; > > if (cpu0total_new != cpu0total) {cpu0load = C*(cpu0used_new-cpu0used)/(cpu0total_new-cpu0total)} else {cpu0load = 0} > if (cpu1total_new != cpu1total) {cpu1load = C*(cpu1used_new-cpu1used)/(cpu1total_new-cpu1total)} else {cpu1load = 0} > if (cpu2total_new != cpu2total) {cpu2load = C*(cpu2used_new-cpu2used)/(cpu2total_new-cpu2total)} else {cpu2load = 0} > if (cpu3total_new != cpu3total) {cpu3load = C*(cpu3used_new-cpu3used)/(cpu3total_new-cpu3total)} else {cpu3load = 0} > if (cpu4total_new != cpu4total) {cpu4load = C*(cpu4used_new-cpu4used)/(cpu4total_new-cpu4total)} else {cpu4load = 0} > if (cpu5total_new != cpu5total) {cpu5load = C*(cpu5used_new-cpu5used)/(cpu5total_new-cpu5total)} else {cpu5load = 0} > if (cpu6total_new != cpu6total) {cpu6load = C*(cpu6used_new-cpu6used)/(cpu6total_new-cpu6total)} else {cpu6load = 0} > if (cpu7total_new != cpu7total) {cpu7load = C*(cpu7used_new-cpu7used)/(cpu7total_new-cpu7total)} else {cpu7load = 0} > > if (n > 0) > printf("%.02f\t%.02f\t%.02f\t%.02f\t%.02f\t%.02f\t%.02f\t%.02f\n", > cpu0load, cpu1load, cpu2load, cpu3load, cpu4load, cpu5load, cpu6load, cpu7load); > > cpu0used = cpu0used_new; cpu0total = cpu0total_new; > cpu1used = cpu1used_new; cpu1total = cpu1total_new; > cpu2used = cpu2used_new; cpu2total = cpu2total_new; > cpu3used = cpu3used_new; cpu3total = cpu3total_new; > cpu4used = cpu4used_new; cpu4total = cpu4total_new; > cpu5used = cpu5used_new; cpu5total = cpu5total_new; > cpu6used = cpu6used_new; cpu6total = cpu6total_new; > cpu7used = cpu7used_new; cpu7total = cpu7total_new; > > n++; > }'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 220690
:
184310
| 184311