bio: show and compute total_* statistics only when debugging

This commit is contained in:
Thomas Schoebel-Theuer 2020-08-12 09:48:19 +02:00 committed by Thomas Schoebel-Theuer
parent aed4daef78
commit e59056860f
2 changed files with 14 additions and 0 deletions

View File

@ -684,7 +684,9 @@ int bio_response_thread(void *data)
MARS_IO("%d callback done.\n", round); MARS_IO("%d callback done.\n", round);
atomic_dec(&brick->fly_count[PRIO_INDEX(mref)]); atomic_dec(&brick->fly_count[PRIO_INDEX(mref)]);
#ifdef MARS_BIO_DEBUG
atomic_inc(&brick->total_completed_count[PRIO_INDEX(mref)]); atomic_inc(&brick->total_completed_count[PRIO_INDEX(mref)]);
#endif
count++; count++;
MARS_IO("%d completed_count = %d fly_count = %d\n", round, atomic_read(&brick->completed_count), atomic_read(&brick->fly_count[PRIO_INDEX(mref)])); MARS_IO("%d completed_count = %d fly_count = %d\n", round, atomic_read(&brick->completed_count), atomic_read(&brick->fly_count[PRIO_INDEX(mref)]));
@ -939,10 +941,12 @@ char *bio_statistics(struct bio_brick *brick, int verbose)
pos += report_timing(&timings[1], res + pos, 4096 - pos); pos += report_timing(&timings[1], res + pos, 4096 - pos);
snprintf(res + pos, 4096 - pos, snprintf(res + pos, 4096 - pos,
#ifdef MARS_BIO_DEBUG
"total " "total "
"completed[0] = %d " "completed[0] = %d "
"completed[1] = %d " "completed[1] = %d "
"completed[2] = %d | " "completed[2] = %d | "
#endif
"queued[0] = %d " "queued[0] = %d "
"queued[1] = %d " "queued[1] = %d "
"queued[2] = %d " "queued[2] = %d "
@ -950,9 +954,11 @@ char *bio_statistics(struct bio_brick *brick, int verbose)
"flying[1] = %d " "flying[1] = %d "
"flying[2] = %d " "flying[2] = %d "
"completing = %d\n", "completing = %d\n",
#ifdef MARS_BIO_DEBUG
atomic_read(&brick->total_completed_count[0]), atomic_read(&brick->total_completed_count[0]),
atomic_read(&brick->total_completed_count[1]), atomic_read(&brick->total_completed_count[1]),
atomic_read(&brick->total_completed_count[2]), atomic_read(&brick->total_completed_count[2]),
#endif
atomic_read(&brick->fly_count[0]), atomic_read(&brick->fly_count[0]),
atomic_read(&brick->queue_count[0]), atomic_read(&brick->queue_count[0]),
atomic_read(&brick->queue_count[1]), atomic_read(&brick->queue_count[1]),
@ -967,9 +973,11 @@ char *bio_statistics(struct bio_brick *brick, int verbose)
static noinline static noinline
void bio_reset_statistics(struct bio_brick *brick) void bio_reset_statistics(struct bio_brick *brick)
{ {
#ifdef MARS_BIO_DEBUG
atomic_set(&brick->total_completed_count[0], 0); atomic_set(&brick->total_completed_count[0], 0);
atomic_set(&brick->total_completed_count[1], 0); atomic_set(&brick->total_completed_count[1], 0);
atomic_set(&brick->total_completed_count[2], 0); atomic_set(&brick->total_completed_count[2], 0);
#endif
} }

View File

@ -30,6 +30,10 @@
#define BIO_IO_R_MAX_LATENCY 40000 // 40 ms #define BIO_IO_R_MAX_LATENCY 40000 // 40 ms
#define BIO_IO_W_MAX_LATENCY 100000 // 100 ms #define BIO_IO_W_MAX_LATENCY 100000 // 100 ms
#ifdef CONFIG_MARS_DEBUG
#define MARS_BIO_DEBUG
#endif
extern int bio_nr_requests; extern int bio_nr_requests;
extern struct threshold bio_submit_threshold; extern struct threshold bio_submit_threshold;
extern struct threshold bio_io_threshold[2]; extern struct threshold bio_io_threshold[2];
@ -68,7 +72,9 @@ struct bio_brick {
atomic_t fly_count[MARS_PRIO_NR]; atomic_t fly_count[MARS_PRIO_NR];
atomic_t queue_count[MARS_PRIO_NR]; atomic_t queue_count[MARS_PRIO_NR];
atomic_t completed_count; atomic_t completed_count;
#ifdef MARS_BIO_DEBUG
atomic_t total_completed_count[MARS_PRIO_NR]; atomic_t total_completed_count[MARS_PRIO_NR];
#endif
// private // private
spinlock_t lock; spinlock_t lock;
struct list_head queue_list[MARS_PRIO_NR]; struct list_head queue_list[MARS_PRIO_NR];