Lines Matching full:stats

35 void block_acct_init(BlockAcctStats *stats)  in block_acct_init()  argument
37 qemu_mutex_init(&stats->lock); in block_acct_init()
41 stats->account_invalid = true; in block_acct_init()
42 stats->account_failed = true; in block_acct_init()
59 void block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid, in block_acct_setup() argument
62 stats->account_invalid = bool_from_onoffauto(account_invalid, in block_acct_setup()
63 stats->account_invalid); in block_acct_setup()
64 stats->account_failed = bool_from_onoffauto(account_failed, in block_acct_setup()
65 stats->account_failed); in block_acct_setup()
68 void block_acct_cleanup(BlockAcctStats *stats) in block_acct_cleanup() argument
71 QSLIST_FOREACH_SAFE(s, &stats->intervals, entries, next) { in block_acct_cleanup()
74 qemu_mutex_destroy(&stats->lock); in block_acct_cleanup()
77 void block_acct_add_interval(BlockAcctStats *stats, unsigned interval_length) in block_acct_add_interval() argument
84 s->stats = stats; in block_acct_add_interval()
85 qemu_mutex_lock(&stats->lock); in block_acct_add_interval()
86 QSLIST_INSERT_HEAD(&stats->intervals, s, entries); in block_acct_add_interval()
92 qemu_mutex_unlock(&stats->lock); in block_acct_add_interval()
95 BlockAcctTimedStats *block_acct_interval_next(BlockAcctStats *stats, in block_acct_interval_next() argument
99 return QSLIST_FIRST(&stats->intervals); in block_acct_interval_next()
105 void block_acct_start(BlockAcctStats *stats, BlockAcctCookie *cookie, in block_acct_start() argument
159 int block_latency_histogram_set(BlockAcctStats *stats, enum BlockAcctType type, in block_latency_histogram_set() argument
162 BlockLatencyHistogram *hist = &stats->latency_histogram[type]; in block_latency_histogram_set()
191 void block_latency_histograms_clear(BlockAcctStats *stats) in block_latency_histograms_clear() argument
196 BlockLatencyHistogram *hist = &stats->latency_histogram[i]; in block_latency_histograms_clear()
203 static void block_account_one_io(BlockAcctStats *stats, BlockAcctCookie *cookie, in block_account_one_io() argument
220 WITH_QEMU_LOCK_GUARD(&stats->lock) { in block_account_one_io()
222 stats->failed_ops[cookie->type]++; in block_account_one_io()
224 stats->nr_bytes[cookie->type] += cookie->bytes; in block_account_one_io()
225 stats->nr_ops[cookie->type]++; in block_account_one_io()
228 block_latency_histogram_account(&stats->latency_histogram[cookie->type], in block_account_one_io()
231 if (!failed || stats->account_failed) { in block_account_one_io()
232 stats->total_time_ns[cookie->type] += latency_ns; in block_account_one_io()
233 stats->last_access_time_ns = time_ns; in block_account_one_io()
235 QSLIST_FOREACH(s, &stats->intervals, entries) { in block_account_one_io()
244 void block_acct_done(BlockAcctStats *stats, BlockAcctCookie *cookie) in block_acct_done() argument
246 block_account_one_io(stats, cookie, false); in block_acct_done()
249 void block_acct_failed(BlockAcctStats *stats, BlockAcctCookie *cookie) in block_acct_failed() argument
251 block_account_one_io(stats, cookie, true); in block_acct_failed()
254 void block_acct_invalid(BlockAcctStats *stats, enum BlockAcctType type) in block_acct_invalid() argument
262 qemu_mutex_lock(&stats->lock); in block_acct_invalid()
263 stats->invalid_ops[type]++; in block_acct_invalid()
265 if (stats->account_invalid) { in block_acct_invalid()
266 stats->last_access_time_ns = qemu_clock_get_ns(clock_type); in block_acct_invalid()
268 qemu_mutex_unlock(&stats->lock); in block_acct_invalid()
271 void block_acct_merge_done(BlockAcctStats *stats, enum BlockAcctType type, in block_acct_merge_done() argument
276 qemu_mutex_lock(&stats->lock); in block_acct_merge_done()
277 stats->merged[type] += num_requests; in block_acct_merge_done()
278 qemu_mutex_unlock(&stats->lock); in block_acct_merge_done()
281 int64_t block_acct_idle_time_ns(BlockAcctStats *stats) in block_acct_idle_time_ns() argument
283 return qemu_clock_get_ns(clock_type) - stats->last_access_time_ns; in block_acct_idle_time_ns()
286 double block_acct_queue_depth(BlockAcctTimedStats *stats, in block_acct_queue_depth() argument
293 qemu_mutex_lock(&stats->stats->lock); in block_acct_queue_depth()
294 sum = timed_average_sum(&stats->latency[type], &elapsed); in block_acct_queue_depth()
295 qemu_mutex_unlock(&stats->stats->lock); in block_acct_queue_depth()