diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2011-04-16 00:48:46 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-16 04:10:46 -0700 |
commit | a70c0034cc5c7e38390167ebfa9c8706be16fd6d (patch) | |
tree | 010db68803dafd9c28bb3e61b05598a7de8bb7b8 | |
parent | 426eed2dd4992f3fb6048dff49b0e2db38d2a87b (diff) |
mgmt/glusterd: Fix percentage latency formula
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2783 (Fix percentage latency and precisions of profile info)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2783
-rw-r--r-- | cli/src/cli-rpc-ops.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 215a48e2d11..32fc2e0ca9f 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -2907,8 +2907,7 @@ cmd_profile_volume_brick_out (dict_t *dict, int count, int interval) int index = 0; int is_header_printed = 0; int ret = 0; - uint64_t total_fop_hits = 0; - double total_avg_latency = 0; + double total_percentage_latency = 0; memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "%d-brick", count); @@ -2949,14 +2948,14 @@ cmd_profile_volume_brick_out (dict_t *dict, int count, int interval) ret = dict_get_double (dict, key, &profile_info[i].max_latency); profile_info[i].fop_name = gf_fop_list[i]; - total_fop_hits += profile_info[i].fop_hits; - total_avg_latency += profile_info[i].avg_latency; + total_percentage_latency += + (profile_info[i].fop_hits * profile_info[i].avg_latency); } - if (total_fop_hits && total_avg_latency) { + if (total_percentage_latency) { for (i = 0; i < GF_FOP_MAXVALUE; i++) { profile_info[i].percentage_avg_latency = 100 * ( (profile_info[i].avg_latency* profile_info[i].fop_hits) / - (total_avg_latency * total_fop_hits)); + total_percentage_latency); } gf_array_insertionsort (profile_info, 1, GF_FOP_MAXVALUE - 1, sizeof (cli_profile_info_t), @@ -3038,7 +3037,7 @@ cmd_profile_volume_brick_out (dict_t *dict, int count, int interval) is_header_printed = 1; } if (profile_info[i].fop_hits) { - cli_out ("%11lf %11lf %11lf %11lf %20"PRId64" %10s", + cli_out ("%9.2lf %9.2lf %9.2lf %9.2lf %20"PRId64" %10s", profile_info[i].percentage_avg_latency, profile_info[i].avg_latency, profile_info[i].min_latency, |