* RFC: patch to trigger thread stats output from cyclictest with SIGHUP
@ 2013-03-11 16:16 Clark Williams
2013-03-11 16:25 ` Paul Gortmaker
2013-03-12 12:10 ` John Kacur
0 siblings, 2 replies; 6+ messages in thread
From: Clark Williams @ 2013-03-11 16:16 UTC (permalink / raw)
To: John Kacur; +Cc: Steven Rostedt, RT, David Sommerseth
[-- 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 --]
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: RFC: patch to trigger thread stats output from cyclictest with SIGHUP
2013-03-11 16:16 RFC: patch to trigger thread stats output from cyclictest with SIGHUP Clark Williams
@ 2013-03-11 16:25 ` Paul Gortmaker
2013-03-11 16:54 ` David Sommerseth
2013-03-12 12:10 ` John Kacur
1 sibling, 1 reply; 6+ messages in thread
From: Paul Gortmaker @ 2013-03-11 16:25 UTC (permalink / raw)
To: Clark Williams; +Cc: John Kacur, Steven Rostedt, RT, David Sommerseth
On Mon, Mar 11, 2013 at 12:16 PM, Clark Williams <williams@redhat.com> wrote:
> 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.
Is USR1 already in use for something? That would be consistent with
how things like dd use USR1 signal - to report interim stats.
P.
--
>
> 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)
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: RFC: patch to trigger thread stats output from cyclictest with SIGHUP
2013-03-11 16:25 ` Paul Gortmaker
@ 2013-03-11 16:54 ` David Sommerseth
2013-03-11 17:16 ` Clark Williams
0 siblings, 1 reply; 6+ messages in thread
From: David Sommerseth @ 2013-03-11 16:54 UTC (permalink / raw)
To: Clark Williams; +Cc: Paul Gortmaker, John Kacur, Steven Rostedt, RT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11/03/13 17:25, Paul Gortmaker wrote:
> On Mon, Mar 11, 2013 at 12:16 PM, Clark Williams
> <williams@redhat.com> wrote:
>> 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.
>
> Is USR1 already in use for something? That would be consistent
> with how things like dd use USR1 signal - to report interim stats.
>
> P.
+1 ... I was just about to say exactly the same.
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlE+DCsACgkQIIWEatLf4Hc4lACdHs1Cuv4u1tJxkoDOfmKXSCiL
s/gAn1XHwrcn2jiNF2Q+0EC22aj+j1Ah
=nME1
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: patch to trigger thread stats output from cyclictest with SIGHUP
2013-03-11 16:54 ` David Sommerseth
@ 2013-03-11 17:16 ` Clark Williams
0 siblings, 0 replies; 6+ messages in thread
From: Clark Williams @ 2013-03-11 17:16 UTC (permalink / raw)
To: David Sommerseth; +Cc: Paul Gortmaker, John Kacur, Steven Rostedt, RT
[-- Attachment #1: Type: text/plain, Size: 2676 bytes --]
On Mon, 11 Mar 2013 17:54:05 +0100
David Sommerseth <davids@redhat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11/03/13 17:25, Paul Gortmaker wrote:
> > On Mon, Mar 11, 2013 at 12:16 PM, Clark Williams
> > <williams@redhat.com> wrote:
> >> 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.
> >
> > Is USR1 already in use for something? That would be consistent
> > with how things like dd use USR1 signal - to report interim stats.
> >
> > P.
>
> +1 ... I was just about to say exactly the same.
>
>
Good points. As I recall SIGHUP is usually used to force a re-read of
configs (which doesn't really apply here).
Here's a revised version using SIGUSR1:
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 0a15dcb..be4046f 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 == SIGUSR1) {
+ 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(SIGUSR1, sighand);
parameters = calloc(num_threads, sizeof(struct thread_param *));
if (!parameters)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: RFC: patch to trigger thread stats output from cyclictest with SIGHUP
2013-03-11 16:16 RFC: patch to trigger thread stats output from cyclictest with SIGHUP Clark Williams
2013-03-11 16:25 ` Paul Gortmaker
@ 2013-03-12 12:10 ` John Kacur
2013-03-12 13:43 ` Clark Williams
1 sibling, 1 reply; 6+ messages in thread
From: John Kacur @ 2013-03-12 12:10 UTC (permalink / raw)
To: Clark Williams; +Cc: John Kacur, Steven Rostedt, RT, David Sommerseth
On Mon, 11 Mar 2013, Clark Williams wrote:
> 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)
>
Where's your SOB Clark? I'm assuming that you and not Steve are the
author. I can add this to my development dir for people to try.
Thanks
John
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: RFC: patch to trigger thread stats output from cyclictest with SIGHUP
2013-03-12 12:10 ` John Kacur
@ 2013-03-12 13:43 ` Clark Williams
0 siblings, 0 replies; 6+ messages in thread
From: Clark Williams @ 2013-03-12 13:43 UTC (permalink / raw)
To: John Kacur; +Cc: Steven Rostedt, RT, David Sommerseth
[-- Attachment #1: Type: text/plain, Size: 3177 bytes --]
On Tue, 12 Mar 2013 13:10:43 +0100 (CET)
John Kacur <jkacur@redhat.com> wrote:
>
>
> On Mon, 11 Mar 2013, Clark Williams wrote:
>
> > 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)
> >
>
> Where's your SOB Clark? I'm assuming that you and not Steve are the
> author. I can add this to my development dir for people to try.
>
> Thanks
>
> John
I haven't even committed this to my tree yet :). I was actually toying
with the idea of having an option to setup a fifo what would allow you
to get the stats without having to screen-scrape stdout. Was thinking
about adding a -F/--fifo option where you tell cyclictest where to put
the fifo:
# cyclictest --numa -p95 -m -F /tmp/cyclictest.fifo
Then you could just cat the fifo and get a snapshot, or your program
could open and read it. Still turning this over in my head though.
Clark
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-03-12 13:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-11 16:16 RFC: patch to trigger thread stats output from cyclictest with SIGHUP Clark Williams
2013-03-11 16:25 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox