From: Clark Williams <williams@redhat.com>
To: John Kacur <jkacur@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
RT <linux-rt-users@vger.kernel.org>,
David Sommerseth <davids@redhat.com>
Subject: RFC: patch to trigger thread stats output from cyclictest with SIGHUP
Date: Mon, 11 Mar 2013 11:16:07 -0500 [thread overview]
Message-ID: <20130311111607.587cda32@riff.lan> (raw)
[-- Attachment #1: Type: text/plain, Size: 2078 bytes --]
John,
Steven suggested a feature for cyclictest that I'd actually been
whining about (internally anyway). During long rteval runs there's
really no feedback available if you want to know how the run is
progressing. Steven suggested sending SIGHUP and dumping the current
state. Below is a patch that seems to work for cyclictest; just
wanted to get some feedback on whether this would be acceptable
behaviour.
Of course if we get this going then we need to figure out how to wire
it into rteval as well :).
Clark
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 0a15dcb..51b97cf 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -199,6 +199,11 @@ static char **traceptr;
static int traceopt_count;
static int traceopt_size;
+static struct thread_param **parameters;
+static struct thread_stat **statistics;
+
+static void print_stat(struct thread_param *par, int index, int verbose);
+
static int latency_target_fd = -1;
static int32_t latency_target_value = 0;
@@ -1368,6 +1373,19 @@ static int check_timer(void)
static void sighand(int sig)
{
+ if (sig == SIGHUP) {
+ int i;
+ int oldquiet = quiet;
+
+ quiet = 0;
+ printf("#---------------------------\n");
+ printf("# cyclictest current status:\n");
+ for (i = 0; i < num_threads; i++)
+ print_stat(parameters[i], i, 0);
+ printf("#---------------------------\n");
+ quiet = oldquiet;
+ return;
+ }
shutdown = 1;
if (refresh_on_max)
pthread_cond_signal(&refresh_on_max_cond);
@@ -1503,8 +1521,6 @@ int main(int argc, char **argv)
sigset_t sigset;
int signum = SIGALRM;
int mode;
- struct thread_param **parameters;
- struct thread_stat **statistics;
int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
int i, ret = -1;
int status;
@@ -1642,6 +1658,7 @@ int main(int argc, char **argv)
signal(SIGINT, sighand);
signal(SIGTERM, sighand);
+ signal(SIGHUP, sighand);
parameters = calloc(num_threads, sizeof(struct thread_param *));
if (!parameters)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next reply other threads:[~2013-03-11 16:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-11 16:16 Clark Williams [this message]
2013-03-11 16:25 ` RFC: patch to trigger thread stats output from cyclictest with SIGHUP Paul Gortmaker
2013-03-11 16:54 ` David Sommerseth
2013-03-11 17:16 ` Clark Williams
2013-03-12 12:10 ` John Kacur
2013-03-12 13:43 ` Clark Williams
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=20130311111607.587cda32@riff.lan \
--to=williams@redhat.com \
--cc=davids@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox