diff options
| -rw-r--r-- | tests/basic/ios-dump.t | 1 | ||||
| -rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 24 | 
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/basic/ios-dump.t b/tests/basic/ios-dump.t index ddeb19d01ac..8e16c036934 100644 --- a/tests/basic/ios-dump.t +++ b/tests/basic/ios-dump.t @@ -39,5 +39,6 @@ for i in {1..10}; do  done  EXPECT_WITHIN 30 "Y" check_brick_inter_stats fop.weighted_latency_ave_usec +EXPECT_WITHIN 30 "Y" check_brick_inter_stats errors.eio.per_sec  cleanup diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 2835b0a3f6e..50917d13c83 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -127,6 +127,7 @@ struct ios_global_stats {          uint64_t        fop_hits[GF_FOP_MAXVALUE];          struct timeval  started_at;          struct ios_lat  latency[GF_FOP_MAXVALUE]; +        uint64_t        errno_count[IOS_MAX_ERRORS];          uint64_t        nr_opens;          uint64_t        max_nr_opens;          struct timeval  max_openfd_time; @@ -490,6 +491,11 @@ ios_track_fd (call_frame_t *frame, fd_t *fd)                          if (conf && conf->measure_latency &&                  \                              conf->count_fop_hits) {                           \                                  BUMP_FOP(op);                                 \ +                                if (op_ret != 0 && op_errno > 0               \ +                                    && op_errno < IOS_MAX_ERRORS) {           \ +                                        conf->cumulative.errno_count[op_errno]++; \ +                                        conf->incremental.errno_count[op_errno]++; \ +                                }                                             \                                  gettimeofday (&frame->end, NULL);             \                                  update_ios_latency (conf, frame, GF_FOP_##op, \                                                          op_ret, op_errno);    \ @@ -1011,7 +1017,9 @@ io_stats_dump_global_to_json_logfp (xlator_t *this,          int                   ret = 1;  /* Default to error */          int                   rw_size;          char                  *rw_unit = NULL; +        const char            *errno_name = NULL;          long                  fop_hits; +        long                  error_count;          float                 fop_lat_ave;          float                 fop_lat_min;          float                 fop_lat_max; @@ -1086,6 +1094,22 @@ io_stats_dump_global_to_json_logfp (xlator_t *this,                          key_prefix, str_prefix, conf->cumulative.max_nr_opens);          } +        for (i = 0; i < IOS_MAX_ERRORS; i++) { +                errno_name = errno_to_name[i]; +                error_count = stats->errno_count[i]; +                if (interval == -1) { +                        ios_log (this, logfp, +                                "\"%s.%s.errors.%s.count\": \"%"PRId64"\",", +                                key_prefix, str_prefix, errno_name, +                                error_count); +                } else { +                        ios_log (this, logfp, +                                "\"%s.%s.errors.%s.per_sec\": \"%0.2lf\",", +                                key_prefix, str_prefix, errno_name, +                                (double)(error_count/interval_sec)); +                } +        } +          for (i = 0; i < GF_FOP_MAXVALUE; i++) {                  lc_fop_name = strdupa (gf_fop_list[i]);                  for (j = 0; lc_fop_name[j]; j++) {  | 
