diff options
author | Junsong Li <junsongli@fb.com> | 2017-04-18 13:25:03 -0700 |
---|---|---|
committer | Shreyas Siravara <sshreyas@fb.com> | 2017-09-08 04:14:24 +0000 |
commit | cb1395b71b523eb5391d5970a8a4230ee6069941 (patch) | |
tree | da223f47638f75976c13a92c4d42d376209db3a2 /xlators/debug/io-stats/src/io-stats.c | |
parent | 7f55c2e767440a22ef1e1ac225e3047d18b0f152 (diff) |
debug/io-stats: Track outstanding requests
Summary:
Add outstanding-req field to track requests that have been sent
down the stack and haven't come back.
This is a port of D4908836 to 3.8
Reviewers: sshreyas
Change-Id: I5870f63008d553416109c1808a434f526f5a633d
Reviewed-on: https://review.gluster.org/18236
Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/debug/io-stats/src/io-stats.c')
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 50917d13c83..408908cbd9b 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -306,6 +306,7 @@ struct ios_conf { gf_boolean_t audit_creates_and_unlinks; gf_boolean_t sample_hard_errors; gf_boolean_t sample_all_errors; + uint32_t outstanding_req; }; @@ -434,6 +435,7 @@ ios_track_fd (call_frame_t *frame, fd_t *fd) #define _IOS_DUMP_DIR DATADIR "/db/glusterd/stats" #endif + #define END_FOP_LATENCY(frame, op) \ do { \ struct ios_conf *conf = NULL; \ @@ -451,6 +453,7 @@ ios_track_fd (call_frame_t *frame, fd_t *fd) \ conf = this->private; \ if (conf && conf->measure_latency) { \ + STATS_INC (conf->outstanding_req); \ gettimeofday (&frame->begin, NULL); \ } else { \ memset (&frame->begin, 0, sizeof (frame->begin));\ @@ -469,16 +472,24 @@ ios_track_fd (call_frame_t *frame, fd_t *fd) conf->incremental.fop_hits[GF_FOP_##op]++; \ } while (0) + #if defined(HAVE_ATOMIC_BUILTINS) #define STATS_LOCK(x) #define STATS_UNLOCK(x) #define STATS_ADD(x,i) __sync_add_and_fetch (&x, i) +#define STATS_SUB(x,i) __sync_sub_and_fetch (&x, i) +#define STATS_INC(x) STATS_ADD(x, 1) +#define STATS_DEC(x) STATS_SUB(x, 1) #else #define STATS_LOCK(x) LOCK (x) #define STATS_UNLOCK(x) UNLOCK (x) #define STATS_ADD(x,i) (x) += (i) +#define STATS_SUB(x,i) (x) -= (i) +#define STATS_INC(x) (x) += 1 +#define STATS_DEC(x) (x) -= 1 #endif + #define UPDATE_PROFILE_STATS(frame, op, op_ret, op_errno) \ do { \ struct ios_conf *conf = NULL; \ @@ -491,10 +502,11 @@ ios_track_fd (call_frame_t *frame, fd_t *fd) if (conf && conf->measure_latency && \ conf->count_fop_hits) { \ BUMP_FOP(op); \ + STATS_DEC (conf->outstanding_req); \ if (op_ret != 0 && op_errno > 0 \ && op_errno < IOS_MAX_ERRORS) { \ - conf->cumulative.errno_count[op_errno]++; \ - conf->incremental.errno_count[op_errno]++; \ + STATS_INC(conf->cumulative.errno_count[op_errno]); \ + STATS_INC(conf->incremental.errno_count[op_errno]); \ } \ gettimeofday (&frame->end, NULL); \ update_ios_latency (conf, frame, GF_FOP_##op, \ @@ -1049,6 +1061,8 @@ io_stats_dump_global_to_json_logfp (xlator_t *this, str_prefix = "inter"; } ios_log (this, logfp, "{"); + ios_log (this, logfp, "\"%s.%s.outstanding_req\": \"%u\",", + key_prefix, str_prefix, conf->outstanding_req); for (i = 0; i < 31; i++) { rw_size = (1 << i); |