Lines Matching +full:isp +full:- +full:0
4 * SPDX-License-Identifier: BSD-2-Clause
48 enum { OP_READ = 0, OP_WRITE, OP_TRIM, NUM_OPS };
73 oid[0] = CTL_SYSCTL; in name2oid()
78 if (i < 0) in name2oid()
92 qoid[0] = CTL_SYSCTL; in oid2name()
96 i = sysctl(qoid, nlen + 2, name, &j, 0, 0); in oid2name()
110 qoid[0] = CTL_SYSCTL; in oidfmt()
115 i = sysctl(qoid, len + 2, buf, &j, 0, 0); in oidfmt()
119 return (0); in oidfmt()
128 memset(buckets, 0, n * sizeof(buckets[0])); in split_u64()
129 for (i = 0; (v = strsep(&str, delim)) != NULL && i < n; i++) { in split_u64()
146 for (tot = 0, i = 0; i < nlat; i++) in pest()
148 if (tot == 0) in pest()
149 return -nanf(""); in pest()
150 if (tot < (uint64_t)2000 / (1000 - permill)) in pest()
153 if (samp < lats[0]) in pest()
154 return baselat * (float)samp / lats[0]; /* linear interpolation 0 and baselat */ in pest()
155 for (tot = 0, i = 0; samp >= tot && i < nlat; i++) in pest()
157 i--; in pest()
158 b1 = baselat * (1 << (i - 1)); in pest()
160 /* Should expoentially interpolate between buckets -- doing linear instead */ in pest()
161 return b1 + (b2 - b1) * (float)(lats[i] - (tot - samp)) / lats[i]; in pest()
167 for (int i = 0; i < NUM_OPS; i++) in op2num()
168 if (strcmp(op, ops[i]) == 0) in op2num()
170 return -1; in op2num()
176 struct iosched_stat *isp; in find_dev() local
179 SLIST_FOREACH(isp, &curlist, link) { in find_dev()
180 if (strcmp(isp->dev_name, dev) != 0 || isp->unit != unit) in find_dev()
182 iosp = &isp->op_stats[op]; in find_dev()
191 struct iosched_stat *isp; in alloc_dev() local
194 isp = malloc(sizeof(*isp)); in alloc_dev()
195 if (isp == NULL) in alloc_dev()
197 strlcpy(isp->dev_name, dev, sizeof(isp->dev_name)); in alloc_dev()
198 isp->unit = unit; in alloc_dev()
199 SLIST_INSERT_HEAD(&curlist, isp, link); in alloc_dev()
201 iosp = &isp->op_stats[op]; in alloc_dev()
216 iosp->nlats = nlat; in update_dev()
217 memcpy(iosp->prev_lats, iosp->lats, iosp->nlats * sizeof(uint64_t)); in update_dev()
218 memcpy(iosp->lats, lats, iosp->nlats * sizeof(uint64_t)); in update_dev()
219 // printf("%s%d: %-6s %.3f %.3f %.3f %.3f\r\n", in update_dev()
234 qoid[0] = CTL_SYSCTL; in walk_sysctl()
245 if (sysctl(qoid, l1, oid, &l2, 0, 0) != 0) { in walk_sysctl()
247 return (0); in walk_sysctl()
258 memcmp(oid, base_oid, len * sizeof(int)) != 0) in walk_sysctl()
259 return (0); in walk_sysctl()
275 if (strcmp(name + l1 - strlen(LATENCY) - 1, LATENCY) != 0) in walk_sysctl()
277 if (oidfmt(oid, l2, &kind) != 0) in walk_sysctl()
282 if (sysctl(oid, l2, val, &l3, 0, 0) != 0) in walk_sysctl()
284 val[l3] = '\0'; in walk_sysctl()
286 if (split_u64(val, ",", latvals, &nlat) == 0) in walk_sysctl()
294 if (op < 0) in walk_sysctl()
345 return (0); in cmdiolat()
361 baselat = 1e-3; /* old default */ in initiolat()
362 if (sysctlbyname(CAM_IOSCHED_BASE, &sbt_base, &len, NULL, 0) == 0) in initiolat()
363 baselat = sbt_base * 1e-6; /* Convert to microseconds */ in initiolat()
386 struct iosched_stat *isp; in labeliolat() local
389 #define DRIVESPERLINE ((getmaxx(wnd) - 1 - INSET) / COLWIDTH) in labeliolat()
393 for (int i = 0; i < NUM_OPS; i++) { in labeliolat()
397 row = 0; in labeliolat()
406 SLIST_FOREACH(isp, &curlist, link) { in labeliolat()
407 if (_col + COLWIDTH >= getmaxx(wnd) - 1 - INSET) { in labeliolat()
410 if (row > getmaxy(wnd) - 1 - (lpr + 1)) in labeliolat()
420 snprintf(tmpstr, sizeof(tmpstr), "%s%d", isp->dev_name, isp->unit); in labeliolat()
421 mvwaddstr(wnd, row, _col + (COLWIDTH - strlen(tmpstr)) / 2, tmpstr); in labeliolat()
430 return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0)); in openiolat()
437 strlcpy(buf, " - ", len); in fmt()
475 struct iosched_stat *isp; in showiolat() local
478 #define DRIVESPERLINE ((getmaxx(wnd) - 1 - INSET) / COLWIDTH) in showiolat()
482 for (int i = 0; i < NUM_OPS; i++) { in showiolat()
486 row = 0; in showiolat()
488 SLIST_FOREACH(isp, &curlist, link) { in showiolat()
489 if (_col + COLWIDTH >= getmaxx(wnd) - 1 - INSET) { in showiolat()
492 if (row > getmaxy(wnd) - 1 - (lpr + 1)) in showiolat()
496 for (int i = 0; i < NUM_OPS; i++) { in showiolat()
501 if ((flags & (1 << i)) == 0) in showiolat()
503 iosp = &isp->op_stats[i]; in showiolat()
504 nlats = iosp->nlats; in showiolat()
505 memset(lats, 0, sizeof(lats)); in showiolat()
506 for (int j = 0; j < iosp->nlats; j++) in showiolat()
507 lats[j] = iosp->lats[j] - iosp->prev_lats[j]; in showiolat()