diff options
author | Jason King <jason.king@joyent.com> | 2018-10-19 20:25:51 -0500 |
---|---|---|
committer | Jason King <jason.king@joyent.com> | 2020-12-08 19:13:03 +0000 |
commit | e751b029b28ab40ab0a552ff16815ed0be38d284 (patch) | |
tree | 76bc07f8450adfc611afe7cad4d935f1e9bed400 | |
parent | 971142bcb2725979f575e02ba643a7e218f78683 (diff) | |
download | illumos-joyent-e751b029b28ab40ab0a552ff16815ed0be38d284.tar.gz |
Add cpu totals
-rw-r--r-- | usr/src/cmd/intrd/intrd.c | 17 | ||||
-rw-r--r-- | usr/src/cmd/intrd/intrd.h | 1 | ||||
-rw-r--r-- | usr/src/cmd/intrd/intrd_kstat.c | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/usr/src/cmd/intrd/intrd.c b/usr/src/cmd/intrd/intrd.c index e8eaf7a120..4a7faf360a 100644 --- a/usr/src/cmd/intrd/intrd.c +++ b/usr/src/cmd/intrd/intrd.c @@ -224,14 +224,16 @@ format_load(lgrp_id_t id, load_t *l, int indent) if (l->ld_total > 0) pct = (double)(l->ld_intrtotal * 100) / l->ld_total; - (void) printf("%*sLGRP %2d intr %6ss (%3.1f%%)", indent * 2, "", - id, buf, pct); + (void) printf("%*sLGRP %2d %zu CPUs intr %6ss (%3.1f%%)", + indent * 2, "", id, l->ld_ncpu, buf, pct); ivec_t *iv = l->ld_bigint; - if (iv != NULL) - (void) printf(" - %s%d int#%d", custr_cstr(iv->ivec_name), - iv->ivec_instance, iv->ivec_ino); + if (iv != NULL) { + nanonicenum(iv->ivec_time, buf, sizeof (buf)); + (void) printf(" - %s int#%d %ss", custr_cstr(iv->ivec_name), + iv->ivec_ino, buf); + } (void) fputc('\n', stdout); } @@ -343,8 +345,8 @@ calc_lgrp_load(cpugrp_t *grp, load_t *ld, lgrp_id_t id) lgrp->ld_total += lchild->ld_total; lgrp->ld_intrtotal += lchild->ld_intrtotal; lgrp->ld_bigint = LOAD_MAXINT(lgrp, lchild); + lgrp->ld_ncpu += lchild->ld_ncpu; } - } static intrd_walk_ret_t @@ -357,6 +359,7 @@ calc_load_cb(stats_t *stp, cpustat_t *cs, void *arg) lcpu->ld_total = cs->cs_cpu_nsec_idle + cs->cs_cpu_nsec_user + cs->cs_cpu_nsec_kernel + cs->cs_cpu_nsec_dtrace + cs->cs_cpu_nsec_intr; + lcpu->ld_ncpu = 1; for (iv = list_head(&cs->cs_ivecs); iv != NULL; iv = list_next(&cs->cs_ivecs, iv)) { @@ -366,9 +369,11 @@ calc_load_cb(stats_t *stp, cpustat_t *cs, void *arg) } load_t *lgrp = LOAD_LGRP(load, cs->cs_lgrp); + lgrp->ld_total += lcpu->ld_total; lgrp->ld_intrtotal += lcpu->ld_intrtotal; lgrp->ld_bigint = LOAD_MAXINT(lgrp, lcpu); + lgrp->ld_ncpu++; return (INTRD_WALK_NEXT); } diff --git a/usr/src/cmd/intrd/intrd.h b/usr/src/cmd/intrd/intrd.h index 1b7f812494..c4bf5d96c4 100644 --- a/usr/src/cmd/intrd/intrd.h +++ b/usr/src/cmd/intrd/intrd.h @@ -105,6 +105,7 @@ typedef struct load { uint64_t ld_total; uint64_t ld_intrtotal; ivec_t *ld_bigint; + size_t ld_ncpu; } load_t; #define LOAD_LGRP(_load, _id) ((_load) + max_cpu + (_id)) #define LOAD_CPU(_load, _id) ((_load) + (_id)) diff --git a/usr/src/cmd/intrd/intrd_kstat.c b/usr/src/cmd/intrd/intrd_kstat.c index 6873c12bb5..ba737eee60 100644 --- a/usr/src/cmd/intrd/intrd_kstat.c +++ b/usr/src/cmd/intrd/intrd_kstat.c @@ -745,7 +745,7 @@ stats_dup(const stats_t *src) VERIFY3S(cpu_iter((stats_t *)src, stats_dup_cb, stp), ==, INTRD_WALK_DONE); - sts->sts_ncpu = src->sts_ncpu; + stp->sts_ncpu = src->sts_ncpu; stp->sts_lgrp = xcalloc(src->sts_nlgrp, sizeof (cpugrp_t)); for (size_t i = 0; i < src->sts_nlgrp; i++) |