From ee0d8ca53f685f8f27c93b3d7c808f2a78c1ae43 Mon Sep 17 00:00:00 2001 From: Poornima G Date: Wed, 17 Aug 2016 20:19:59 +0530 Subject: io-stats: Add stats for upcall notifications 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 Reviewed-on: http://review.gluster.org/15193 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Rajesh Joseph CentOS-regression: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- cli/src/cli-rpc-ops.c | 25 +++++++++++++++++++++++++ cli/src/cli-xml-output.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 6b5277ced95..12f54f61f23 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -30,6 +30,7 @@ #include "protocol-common.h" #include "cli-mem-types.h" #include "compat.h" +#include "upcall-utils.h" #include "syscall.h" #include "glusterfs3.h" @@ -6276,6 +6277,7 @@ cmd_profile_volume_brick_out (dict_t *dict, int count, int interval) uint64_t rb_counts[32] = {0}; uint64_t wb_counts[32] = {0}; cli_profile_info_t profile_info[GF_FOP_MAXVALUE] = {{0}}; + cli_profile_info_t upcall_info[GF_UPCALL_FLAGS_MAXVALUE] = {{0},}; char output[128] = {0}; int per_line = 0; char read_blocks[128] = {0}; @@ -6299,6 +6301,13 @@ cmd_profile_volume_brick_out (dict_t *dict, int count, int interval) ret = dict_get_uint64 (dict, key, &wb_counts[i]); } + for (i = 0; i < GF_UPCALL_FLAGS_MAXVALUE; i++) { + snprintf (key, sizeof (key), "%d-%d-%d-upcall-hits", count, + interval, i); + ret = dict_get_uint64 (dict, key, &upcall_info[i].fop_hits); + upcall_info[i].fop_name = (char *)gf_upcall_list[i]; + } + for (i = 0; i < GF_FOP_MAXVALUE; i++) { memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "%d-%d-%d-hits", count, @@ -6423,6 +6432,22 @@ cmd_profile_volume_brick_out (dict_t *dict, int count, int interval) profile_info[i].fop_name); } } + + for (i = 0; i < GF_UPCALL_FLAGS_MAXVALUE; i++) { + if (upcall_info[i].fop_hits == 0) + continue; + if (upcall_info[i].fop_hits) { + cli_out ("%10.2lf %10.2lf us %10.2lf us %10.2lf us" + " %14"PRId64" %11s", + upcall_info[i].percentage_avg_latency, + upcall_info[i].avg_latency, + upcall_info[i].min_latency, + upcall_info[i].max_latency, + upcall_info[i].fop_hits, + upcall_info[i].fop_name); + } + } + cli_out (" "); cli_out ("%12s: %"PRId64" seconds", "Duration", sec); cli_out ("%12s: %"PRId64" bytes", "Data Read", r_count); diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 6639262066c..af4f020bbbd 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -13,7 +13,7 @@ #include "run.h" #include "compat.h" #include "syscall.h" - +#include "upcall-utils.h" enum gf_task_types { GF_TASK_TYPE_REBALANCE, @@ -2200,6 +2200,48 @@ cont: max_latency = 0.0; } + for (i = 0; i < GF_UPCALL_FLAGS_MAXVALUE; i++) { + hits = 0; + avg_latency = 0.0; + min_latency = 0.0; + max_latency = 0.0; + + memset (key, 0, sizeof (key)); + snprintf (key, sizeof (key), "%d-%d-%d-upcall-hits", brick_index, + interval, i); + ret = dict_get_uint64 (dict, key, &hits); + if (ret) + continue; + + /* */ + ret = xmlTextWriterStartElement (writer, (xmlChar *)"fop"); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"name", "%s", gf_fop_list[i]); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"hits", "%"PRIu64, hits); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"avgLatency", "%f", avg_latency); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"minLatency", "%f", min_latency); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"maxLatency", "%f", max_latency); + XML_RET_CHECK_AND_GOTO (ret, out); + + /* */ + ret = xmlTextWriterEndElement (writer); + XML_RET_CHECK_AND_GOTO (ret, out); + } + /* */ ret = xmlTextWriterEndElement (writer); XML_RET_CHECK_AND_GOTO (ret, out); -- cgit