Lines Matching refs:stats

140 	struct io_stats *stats;
142 stats = kmem_zalloc(sizeof(*stats), KM_SLEEP);
143 if (stats == NULL)
144 panic("iostat_alloc: cannot allocate memory for stats buffer");
146 stats->io_type = type;
147 stats->io_parent = parent;
148 (void)strlcpy(stats->io_name, name, sizeof(stats->io_name));
153 getmicrouptime(&stats->io_attachtime);
159 TAILQ_INSERT_TAIL(&iostatlist, stats, io_link);
163 return stats;
167 * Remove i/o from stats collection.
170 iostat_free(struct io_stats *stats)
179 TAILQ_REMOVE(&iostatlist, stats, io_link);
182 kmem_free(stats, sizeof(*stats));
190 iostat_busy(struct io_stats *stats)
193 if (stats->io_busy++ == 0)
194 getmicrouptime(&stats->io_timestamp);
202 iostat_unbusy(struct io_stats *stats, long bcount, int read)
206 if (stats->io_busy-- == 0) {
207 printf("%s: busy < 0\n", stats->io_name);
213 timersub(&dv_time, &stats->io_timestamp, &diff_time);
214 timeradd(&stats->io_time, &diff_time, &stats->io_time);
216 stats->io_timestamp = dv_time;
219 stats->io_rbytes += bcount;
220 stats->io_rxfer++;
222 stats->io_wbytes += bcount;
223 stats->io_wxfer++;
232 iostat_isbusy(struct io_stats *stats)
235 return stats->io_busy != 0;
240 * abstracts the stats gathering.
243 iostat_seek(struct io_stats *stats)
246 stats->io_seek++;
269 struct io_stats *stats;
284 for (stats = TAILQ_FIRST(&iostatlist); stats != NULL;
285 stats = TAILQ_NEXT(stats, io_link)) {
286 if ((disk_only == 1) && (stats->io_type != IOSTAT_DISK))
290 needed += strlen(stats->io_name) + 1;
294 strncpy(bf, stats->io_name, sizeof(bf));
298 strncpy(bf + 1, stats->io_name,
323 struct io_stats *stats;
352 TAILQ_FOREACH(stats, &iostatlist, io_link) {
355 strncpy(sdrive.name, stats->io_name, sizeof(sdrive.name));
356 sdrive.xfer = stats->io_rxfer + stats->io_wxfer;
357 sdrive.rxfer = stats->io_rxfer;
358 sdrive.wxfer = stats->io_wxfer;
359 sdrive.seek = stats->io_seek;
360 sdrive.bytes = stats->io_rbytes + stats->io_wbytes;
361 sdrive.rbytes = stats->io_rbytes;
362 sdrive.wbytes = stats->io_wbytes;
363 sdrive.attachtime_sec = stats->io_attachtime.tv_sec;
364 sdrive.attachtime_usec = stats->io_attachtime.tv_usec;
365 sdrive.timestamp_sec = stats->io_timestamp.tv_sec;
366 sdrive.timestamp_usec = stats->io_timestamp.tv_usec;
367 sdrive.time_sec = stats->io_time.tv_sec;
368 sdrive.time_usec = stats->io_time.tv_usec;
369 sdrive.busy = stats->io_busy;
401 SYSCTL_DESCR("I/O stats are being collected for these"