From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: dm-devel@redhat.com
Subject: [PATCH 9/9] multipathd: measure path check time
Date: Tue, 26 Nov 2013 12:41:30 +0100 [thread overview]
Message-ID: <1385466090-24290-10-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1385466090-24290-1-git-send-email-hare@suse.de>
Instrument code to measure path check time.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
multipathd/main.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index b57fa5d..67feb61 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1104,7 +1104,7 @@ int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh)
return 0;
}
-void
+int
check_path (struct vectors * vecs, struct path * pp)
{
int newstate;
@@ -1113,10 +1113,10 @@ check_path (struct vectors * vecs, struct path * pp)
int oldchkrstate = pp->chkrstate;
if (!pp->mpp)
- return;
+ return 0;
if (pp->tick && --pp->tick)
- return; /* don't check this path yet */
+ return 0; /* don't check this path yet */
/*
* provision a next check soonest,
@@ -1131,7 +1131,7 @@ check_path (struct vectors * vecs, struct path * pp)
if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) {
condlog(2, "%s: unusable path", pp->dev);
pathinfo(pp, conf->hwtable, 0);
- return;
+ return 1;
}
/*
* Async IO in flight. Keep the previous path state
@@ -1139,7 +1139,7 @@ check_path (struct vectors * vecs, struct path * pp)
*/
if (newstate == PATH_PENDING) {
pp->tick = 1;
- return;
+ return 0;
}
/*
* Synchronize with kernel state
@@ -1177,7 +1177,7 @@ check_path (struct vectors * vecs, struct path * pp)
pp->mpp->failback_tick = 0;
pp->mpp->stat_path_failures++;
- return;
+ return 1;
}
if(newstate == PATH_UP || newstate == PATH_GHOST){
@@ -1262,6 +1262,7 @@ check_path (struct vectors * vecs, struct path * pp)
(chkr_new_path_up && followover_should_failback(pp)))
switch_pathgroup(pp->mpp);
}
+ return 1;
}
static void *
@@ -1284,6 +1285,11 @@ checkerloop (void *ap)
}
while (1) {
+ struct timeval diff_time, start_time, end_time;
+ int num_paths = 0;
+
+ if (gettimeofday(&start_time, NULL) != 0)
+ start_time.tv_sec = 0;
pthread_cleanup_push(cleanup_lock, &vecs->lock);
lock(vecs->lock);
pthread_testcancel();
@@ -1292,7 +1298,7 @@ checkerloop (void *ap)
if (vecs->pathvec) {
vector_foreach_slot (vecs->pathvec, pp, i) {
- check_path(vecs, pp);
+ num_paths += check_path(vecs, pp);
}
}
if (vecs->mpvec) {
@@ -1308,6 +1314,14 @@ checkerloop (void *ap)
}
lock_cleanup_pop(vecs->lock);
+ if (start_time.tv_sec &&
+ gettimeofday(&end_time, NULL) == 0 &&
+ num_paths) {
+ timersub(&end_time, &start_time, &diff_time);
+ condlog(3, "checked %d path%s in %lu.%06lu secs",
+ num_paths, num_paths > 1 ? "s" : "",
+ diff_time.tv_sec, diff_time.tv_usec);
+ }
sleep(1);
}
return NULL;
--
1.8.1.4
prev parent reply other threads:[~2013-11-26 11:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-26 11:41 [PATCH 0/9] multipath systemd integration Hannes Reinecke
2013-11-26 11:41 ` [PATCH 1/9] Clarify uxsock logging Hannes Reinecke
2013-11-26 11:41 ` [PATCH 2/9] Use system-provided regex implementation Hannes Reinecke
2013-11-26 11:41 ` [PATCH 3/9] multipathd: Add option '-s' to suppress timestamps Hannes Reinecke
2013-11-26 11:41 ` [PATCH 4/9] multipathd: switch to socket activation for systemd Hannes Reinecke
2013-11-26 11:41 ` [PATCH 5/9] multipathd: use sd_notify() to inform systemd Hannes Reinecke
2013-11-26 11:41 ` [PATCH 6/9] multipathd: Implement systemd watchdog integration Hannes Reinecke
2013-11-26 18:41 ` Benjamin Marzinski
2013-11-27 7:05 ` Hannes Reinecke
2013-11-26 11:41 ` [PATCH 7/9] multipathd: enable core dumps for systemd Hannes Reinecke
2013-11-26 11:41 ` [PATCH 8/9] multipathd: Read environment variables from systemd Hannes Reinecke
2013-11-26 11:41 ` Hannes Reinecke [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1385466090-24290-10-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=christophe.varoqui@gmail.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.