summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/latency.c
diff options
context:
space:
mode:
authorGluster Ant <bugzilla-bot@gluster.org>2018-09-12 17:52:45 +0530
committerNigel Babu <nigelb@redhat.com>2018-09-12 17:52:45 +0530
commite16868dede6455cab644805af6fe1ac312775e13 (patch)
tree15aebdb4fff2d87cf8a72f836816b3aa634da58d /libglusterfs/src/latency.c
parent45a71c0548b6fd2c757aa2e7b7671a1411948894 (diff)
Land part 2 of clang-format changes
Change-Id: Ia84cc24c8924e6d22d02ac15f611c10e26db99b4 Signed-off-by: Nigel Babu <nigelb@redhat.com>
Diffstat (limited to 'libglusterfs/src/latency.c')
-rw-r--r--libglusterfs/src/latency.c106
1 files changed, 50 insertions, 56 deletions
diff --git a/libglusterfs/src/latency.c b/libglusterfs/src/latency.c
index fb3b155caa6..2dc2a318216 100644
--- a/libglusterfs/src/latency.c
+++ b/libglusterfs/src/latency.c
@@ -8,7 +8,6 @@
cases as published by the Free Software Foundation.
*/
-
/*
* This file contains functions to support dumping of
* latencies of FOPs broken down by subvolumes.
@@ -21,82 +20,77 @@
#include "libglusterfs-messages.h"
void
-gf_update_latency (call_frame_t *frame)
+gf_update_latency(call_frame_t *frame)
{
- double elapsed;
- struct timespec *begin, *end;
+ double elapsed;
+ struct timespec *begin, *end;
- fop_latency_t *lat;
+ fop_latency_t *lat;
- begin = &frame->begin;
- end = &frame->end;
+ begin = &frame->begin;
+ end = &frame->end;
- if (!(begin->tv_sec && end->tv_sec))
- goto out;
+ if (!(begin->tv_sec && end->tv_sec))
+ goto out;
- elapsed = (end->tv_sec - begin->tv_sec) * 1e9
- + (end->tv_nsec - begin->tv_nsec);
+ elapsed = (end->tv_sec - begin->tv_sec) * 1e9 +
+ (end->tv_nsec - begin->tv_nsec);
- if (frame->op < 0 || frame->op >= GF_FOP_MAXVALUE) {
- gf_log ("[core]", GF_LOG_WARNING,
- "Invalid frame op value: %d",
- frame->op);
- return;
- }
+ if (frame->op < 0 || frame->op >= GF_FOP_MAXVALUE) {
+ gf_log("[core]", GF_LOG_WARNING, "Invalid frame op value: %d",
+ frame->op);
+ return;
+ }
- /* Can happen mostly at initiator xlator, as STACK_WIND/UNWIND macros
- set it right anyways for those frames */
- if (!frame->op)
- frame->op = frame->root->op;
+ /* Can happen mostly at initiator xlator, as STACK_WIND/UNWIND macros
+ set it right anyways for those frames */
+ if (!frame->op)
+ frame->op = frame->root->op;
- lat = &frame->this->stats.interval.latencies[frame->op];
+ lat = &frame->this->stats.interval.latencies[frame->op];
- if (lat->max < elapsed)
- lat->max = elapsed;
+ if (lat->max < elapsed)
+ lat->max = elapsed;
- if (lat->min > elapsed)
- lat->min = elapsed;
+ if (lat->min > elapsed)
+ lat->min = elapsed;
- lat->total += elapsed;
- lat->count++;
+ lat->total += elapsed;
+ lat->count++;
out:
- return;
+ return;
}
-
void
-gf_proc_dump_latency_info (xlator_t *xl)
+gf_proc_dump_latency_info(xlator_t *xl)
{
- char key_prefix[GF_DUMP_MAX_BUF_LEN];
- char key[GF_DUMP_MAX_BUF_LEN];
- int i;
+ char key_prefix[GF_DUMP_MAX_BUF_LEN];
+ char key[GF_DUMP_MAX_BUF_LEN];
+ int i;
- snprintf (key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.latency", xl->name);
- gf_proc_dump_add_section (key_prefix);
+ snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.latency", xl->name);
+ gf_proc_dump_add_section(key_prefix);
- for (i = 0; i < GF_FOP_MAXVALUE; i++) {
- gf_proc_dump_build_key (key, key_prefix, "%s",
- (char *)gf_fop_list[i]);
+ for (i = 0; i < GF_FOP_MAXVALUE; i++) {
+ gf_proc_dump_build_key(key, key_prefix, "%s", (char *)gf_fop_list[i]);
- fop_latency_t *lat = &xl->stats.interval.latencies[i];
+ fop_latency_t *lat = &xl->stats.interval.latencies[i];
- /* Doesn't make sense to continue if there are no fops
- came in the given interval */
- if (!lat->count)
- continue;
+ /* Doesn't make sense to continue if there are no fops
+ came in the given interval */
+ if (!lat->count)
+ continue;
- gf_proc_dump_write (key, "%.03f,%"PRId64",%.03f",
- (lat->total / lat->count), lat->count,
- lat->total);
- }
+ gf_proc_dump_write(key, "%.03f,%" PRId64 ",%.03f",
+ (lat->total / lat->count), lat->count, lat->total);
+ }
- memset (xl->stats.interval.latencies, 0,
- sizeof (xl->stats.interval.latencies));
+ memset(xl->stats.interval.latencies, 0,
+ sizeof(xl->stats.interval.latencies));
- /* make sure 'min' is set to high value, so it would be
- properly set later */
- for (i = 0; i < GF_FOP_MAXVALUE; i++) {
- xl->stats.interval.latencies[i].min = 0xffffffff;
- }
+ /* make sure 'min' is set to high value, so it would be
+ properly set later */
+ for (i = 0; i < GF_FOP_MAXVALUE; i++) {
+ xl->stats.interval.latencies[i].min = 0xffffffff;
+ }
}
-