aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorDivyesh Shah <dpshah@google.com>2010-04-09 00:15:10 -0400
committerJens Axboe <jens.axboe@oracle.com>2010-04-09 02:36:08 -0400
commitcdc1184cf4a7bd99f5473a91244197accc49146b (patch)
treeecd572867bfa5a82fa4ed16d7303448c7ea7d24c /block/blk-cgroup.h
parent812d402648f4fc1ab1091b2172a46fc1b367c724 (diff)
blkio: Add io_queued and avg_queue_size stats
These stats are useful for getting a feel for the queue depth of the cgroup, i.e., how filled up its queues are at a given instant and over the existence of the cgroup. This ability is useful when debugging problems in the wild as it helps understand the application's IO pattern w/o having to read through the userspace code (coz its tedious or just not available) or w/o the ability to run blktrace (since you may not have root access and/or not want to disturb performance). Signed-off-by: Divyesh Shah<dpshah@google.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 470a29db6bec..bea7f3b9a88e 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -36,10 +36,13 @@ enum stat_type {
36 BLKIO_STAT_WAIT_TIME, 36 BLKIO_STAT_WAIT_TIME,
37 /* Number of IOs merged */ 37 /* Number of IOs merged */
38 BLKIO_STAT_MERGED, 38 BLKIO_STAT_MERGED,
39 /* Number of IOs queued up */
40 BLKIO_STAT_QUEUED,
39 /* All the single valued stats go below this */ 41 /* All the single valued stats go below this */
40 BLKIO_STAT_TIME, 42 BLKIO_STAT_TIME,
41 BLKIO_STAT_SECTORS, 43 BLKIO_STAT_SECTORS,
42#ifdef CONFIG_DEBUG_BLK_CGROUP 44#ifdef CONFIG_DEBUG_BLK_CGROUP
45 BLKIO_STAT_AVG_QUEUE_SIZE,
43 BLKIO_STAT_DEQUEUE 46 BLKIO_STAT_DEQUEUE
44#endif 47#endif
45}; 48};
@@ -63,8 +66,12 @@ struct blkio_group_stats {
63 /* total disk time and nr sectors dispatched by this group */ 66 /* total disk time and nr sectors dispatched by this group */
64 uint64_t time; 67 uint64_t time;
65 uint64_t sectors; 68 uint64_t sectors;
66 uint64_t stat_arr[BLKIO_STAT_MERGED + 1][BLKIO_STAT_TOTAL]; 69 uint64_t stat_arr[BLKIO_STAT_QUEUED + 1][BLKIO_STAT_TOTAL];
67#ifdef CONFIG_DEBUG_BLK_CGROUP 70#ifdef CONFIG_DEBUG_BLK_CGROUP
71 /* Sum of number of IOs queued across all samples */
72 uint64_t avg_queue_size_sum;
73 /* Count of samples taken for average */
74 uint64_t avg_queue_size_samples;
68 /* How many times this group has been removed from service tree */ 75 /* How many times this group has been removed from service tree */
69 unsigned long dequeue; 76 unsigned long dequeue;
70#endif 77#endif
@@ -127,10 +134,13 @@ static inline char *blkg_path(struct blkio_group *blkg)
127{ 134{
128 return blkg->path; 135 return blkg->path;
129} 136}
137void blkiocg_update_set_active_queue_stats(struct blkio_group *blkg);
130void blkiocg_update_dequeue_stats(struct blkio_group *blkg, 138void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
131 unsigned long dequeue); 139 unsigned long dequeue);
132#else 140#else
133static inline char *blkg_path(struct blkio_group *blkg) { return NULL; } 141static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
142static inline void blkiocg_update_set_active_queue_stats(
143 struct blkio_group *blkg) {}
134static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg, 144static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
135 unsigned long dequeue) {} 145 unsigned long dequeue) {}
136#endif 146#endif
@@ -152,6 +162,10 @@ void blkiocg_update_completion_stats(struct blkio_group *blkg,
152 uint64_t start_time, uint64_t io_start_time, bool direction, bool sync); 162 uint64_t start_time, uint64_t io_start_time, bool direction, bool sync);
153void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction, 163void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction,
154 bool sync); 164 bool sync);
165void blkiocg_update_request_add_stats(struct blkio_group *blkg,
166 struct blkio_group *curr_blkg, bool direction, bool sync);
167void blkiocg_update_request_remove_stats(struct blkio_group *blkg,
168 bool direction, bool sync);
155#else 169#else
156struct cgroup; 170struct cgroup;
157static inline struct blkio_cgroup * 171static inline struct blkio_cgroup *
@@ -175,5 +189,9 @@ static inline void blkiocg_update_completion_stats(struct blkio_group *blkg,
175 bool sync) {} 189 bool sync) {}
176static inline void blkiocg_update_io_merged_stats(struct blkio_group *blkg, 190static inline void blkiocg_update_io_merged_stats(struct blkio_group *blkg,
177 bool direction, bool sync) {} 191 bool direction, bool sync) {}
192static inline void blkiocg_update_request_add_stats(struct blkio_group *blkg,
193 struct blkio_group *curr_blkg, bool direction, bool sync) {}
194static inline void blkiocg_update_request_remove_stats(struct blkio_group *blkg,
195 bool direction, bool sync) {}
178#endif 196#endif
179#endif /* _BLK_CGROUP_H */ 197#endif /* _BLK_CGROUP_H */