summaryrefslogtreecommitdiffstats
path: root/xlators/debug/io-stats/src
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2016-08-17 20:19:59 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-08-31 20:18:42 -0700
commitee0d8ca53f685f8f27c93b3d7c808f2a78c1ae43 (patch)
tree32627cdffde0b55cff78d972529a456178655cc6 /xlators/debug/io-stats/src
parent054b09eb5f040ccc0adbb86759da403b49544083 (diff)
io-stats: Add stats for upcall notificationsv3.10dev
With this patch, there will be additional entries seen in the profile info: UPCALL : Total number of upcall events that were sent from the brick(in brick profile), and number of upcall notifications recieved by client(in client profile) Cache invalidation events: ------------------------- CI_IATT : Number of upcalls that were cache invalidation and had one of the IATT_UPDATE_FLAGS set. This indicates that one of the iatt value was changed. CI_XATTR : Number of upcalls that were cache invalidation, and had one of the UP_XATTR or UP_XATTR_RM set. This indicates that an xattr was updated or deleted. CI_RENAME : Number of upcalls that were cache invalidation, resulted by the renaming of a file or directory CI_UNLINK : Number of upcalls that were cache invalidation, resulted by the unlink of a file. CI_FORGET : Number of upcalls that were cache invalidation, resulted by the forget of inode on the server side. Lease events: ------------ LEASE_RECALL : Number of lease recalls sent by the brick (in brick profile), and number of lease recalls recieved by client(in client profile) Note that the sum of CI_IATT, CI_XATTR, CI_RENAME, CI_UNLINK, CI_FORGET, LEASE_RECALL may not be equal to UPCALL. This is because, each cache invalidation can carry multiple flags. Eg: - Every CI_XATTR will have CI_IATT - Every CI_UNLINK will also increment CI_IATT as link count is an iatt attribute. Also UP_PARENT_DENTRY_FLAGS is currently not accounted for, as CI_RENAME and CI_UNLINK will always have the flag UP_PARENT_DENTRY_FLAGS Change-Id: Ieb8cd21dde2c4c7618f12d025a5e5156f9cc0fe9 BUG: 1371543 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/15193 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/debug/io-stats/src')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 9889618..b734dff 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -38,6 +38,7 @@
#include "statedump.h"
#include <pwd.h>
#include <grp.h>
+#include "upcall-utils.h"
#define MAX_LIST_MEMBERS 100
#define DEFAULT_PWD_BUF_SZ 16384
@@ -120,6 +121,7 @@ struct ios_global_stats {
uint64_t block_count_write[32];
uint64_t block_count_read[32];
uint64_t fop_hits[GF_FOP_MAXVALUE];
+ uint64_t upcall_hits[GF_UPCALL_FLAGS_MAXVALUE];
struct timeval started_at;
struct ios_lat latency[GF_FOP_MAXVALUE];
uint64_t nr_opens;
@@ -378,6 +380,19 @@ is_fop_latency_started (call_frame_t *frame)
throughput, iosstat); \
} while (0)
+#define BUMP_UPCALL(event) \
+ do { \
+ struct ios_conf *conf = NULL; \
+ \
+ conf = this->private; \
+ if (!conf) \
+ break; \
+ if (conf->count_fop_hits) { \
+ conf->cumulative.upcall_hits[event]++; \
+ conf->incremental.upcall_hits[event]++; \
+ } \
+ } while (0)
+
int
ios_fd_ctx_get (fd_t *fd, xlator_t *this, struct ios_fd **iosfd)
{
@@ -897,6 +912,26 @@ io_stats_dump_global_to_json_logfp (xlator_t *this,
"\"%s.%s.fop.%s.latency_max_usec\": \"%0.2lf\",",
key_prefix, str_prefix, lc_fop_name, fop_lat_max);
}
+
+ for (i = 0; i < GF_UPCALL_FLAGS_MAXVALUE; i++) {
+ lc_fop_name = strdupa (gf_upcall_list[i]);
+ for (j = 0; lc_fop_name[j]; j++) {
+ lc_fop_name[j] = tolower (lc_fop_name[j]);
+ }
+ fop_hits = stats->upcall_hits[i];
+ if (interval == -1) {
+ ios_log (this, logfp,
+ "\"%s.%s.fop.%s.count\": \"%"PRId64"\",",
+ key_prefix, str_prefix, lc_fop_name,
+ fop_hits);
+ } else {
+ ios_log (this, logfp,
+ "\"%s.%s.fop.%s.per_sec\": \"%0.2lf\",",
+ key_prefix, str_prefix, lc_fop_name,
+ (double)(fop_hits / interval_sec));
+ }
+ }
+
if (interval == -1) {
ios_log (this, logfp, "\"%s.%s.uptime\": \"%"PRId64"\",",
key_prefix, str_prefix,
@@ -1247,6 +1282,14 @@ io_stats_dump_global_to_logfp (xlator_t *this, struct ios_global_stats *stats,
stats->fop_hits[i], stats->latency[i].avg,
stats->latency[i].min, stats->latency[i].max);
}
+
+ for (i = 0; i < GF_UPCALL_FLAGS_MAXVALUE; i++) {
+ if (stats->upcall_hits[i])
+ ios_log (this, logfp, "%-13s %10"PRId64" %11s "
+ "us %11s us %11s us", gf_upcall_list[i],
+ stats->upcall_hits[i], "0", "0", "0");
+ }
+
ios_log (this, logfp, "------ ----- ----- ----- ----- ----- ----- ----- "
" ----- ----- ----- -----\n");
@@ -1429,6 +1472,19 @@ io_stats_dump_global_to_dict (xlator_t *this, struct ios_global_stats *stats,
goto out;
}
}
+ for (i = 0; i < GF_UPCALL_FLAGS_MAXVALUE; i++) {
+ if (stats->upcall_hits[i] == 0)
+ continue;
+ snprintf (key, sizeof (key), "%d-%d-upcall-hits", interval, i);
+ ret = dict_set_uint64 (dict, key, stats->upcall_hits[i]);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "failed to "
+ "set %s-upcall-hits: %"PRIu64,
+ gf_upcall_list[i],
+ stats->upcall_hits[i]);
+ goto out;
+ }
+ }
out:
gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret);
return ret;
@@ -3805,6 +3861,8 @@ notify (xlator_t *this, int32_t event, void *data, ...)
double time = 0;
gf_boolean_t is_peek = _gf_false;
va_list ap;
+ struct gf_upcall *up_data = NULL;
+ struct gf_upcall_cache_invalidation *up_ci = NULL;
dict = data;
va_start (ap, data);
@@ -3900,6 +3958,35 @@ notify (xlator_t *this, int32_t event, void *data, ...)
}
}
break;
+ case GF_EVENT_UPCALL:
+ up_data = (struct gf_upcall *)data;
+ BUMP_UPCALL (GF_UPCALL);
+
+ switch (up_data->event_type) {
+ case GF_UPCALL_RECALL_LEASE:
+ BUMP_UPCALL (GF_UPCALL_LEASE_RECALL);
+ break;
+ case GF_UPCALL_CACHE_INVALIDATION:
+ up_ci = (struct gf_upcall_cache_invalidation *)up_data->data;
+ if (up_ci->flags & (UP_XATTR | UP_XATTR_RM))
+ BUMP_UPCALL (GF_UPCALL_CI_XATTR);
+ if (up_ci->flags & IATT_UPDATE_FLAGS)
+ BUMP_UPCALL (GF_UPCALL_CI_STAT);
+ if (up_ci->flags & UP_RENAME_FLAGS)
+ BUMP_UPCALL (GF_UPCALL_CI_RENAME);
+ if (up_ci->flags & UP_FORGET)
+ BUMP_UPCALL (GF_UPCALL_CI_FORGET);
+ if (up_ci->flags & UP_NLINK)
+ BUMP_UPCALL (GF_UPCALL_CI_NLINK);
+ break;
+ default:
+ gf_msg_debug (this->name, 0, "Unknown upcall event "
+ "type :%d", up_data->event_type);
+ break;
+ }
+
+ default_notify (this, event, data);
+ break;
default:
default_notify (this, event, data);
break;