* [PATCH v2 0/4] cyclictest: improve running under trace-cmd
@ 2016-03-17 18:30 Luiz Capitulino
2016-03-17 18:30 ` [PATCH 1/4] cyclictest: tracing(): check for notrace Luiz Capitulino
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Luiz Capitulino @ 2016-03-17 18:30 UTC (permalink / raw)
To: linux-rt-users; +Cc: jkacur, williams
In short, this series allows you to run cyclictest under
trace-cmd and still get trace marks when the latency
specified with -b is execeded. More details in patch 4/4.
o v2
- rebase against current master
Luiz Capitulino (4):
cyclictest: tracing(): check for notrace
cyclictest: move debugfs init code to its own function
cyclictest: move tracemark_fd handling to its own function
cyclictest: add --tracemark option
src/cyclictest/cyclictest.c | 62 ++++++++++++++++++++++++++++++++++-----------
1 file changed, 47 insertions(+), 15 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 1/4] cyclictest: tracing(): check for notrace 2016-03-17 18:30 [PATCH v2 0/4] cyclictest: improve running under trace-cmd Luiz Capitulino @ 2016-03-17 18:30 ` Luiz Capitulino 2016-03-22 14:37 ` John Kacur 2016-03-17 18:30 ` [PATCH 2/4] cyclictest: move debugfs init code to its own function Luiz Capitulino ` (2 subsequent siblings) 3 siblings, 1 reply; 12+ messages in thread From: Luiz Capitulino @ 2016-03-17 18:30 UTC (permalink / raw) To: linux-rt-users; +Cc: jkacur, williams If you pass -b and --notrace to cyclictest today, it will write to tracing_on when -b latency is reached. Fix this by making tracing() check notrace. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- src/cyclictest/cyclictest.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index f5a67dc..6070457 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -479,6 +479,9 @@ static void tracemark(char *fmt, ...) static void tracing(int on) { + if (notrace) + return; + if (on) { switch (kernelversion) { case KV_26_LT18: gettimeofday(0,(struct timezone *)1); break; @@ -1698,7 +1701,7 @@ static void sighand(int sig) shutdown = 1; if (refresh_on_max) pthread_cond_signal(&refresh_on_max_cond); - if (tracelimit && !notrace) + if (tracelimit) tracing(0); } @@ -2303,7 +2306,7 @@ int main(int argc, char **argv) } out: /* ensure that the tracer is stopped */ - if (tracelimit && !notrace) + if (tracelimit) tracing(0); -- 2.1.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] cyclictest: tracing(): check for notrace 2016-03-17 18:30 ` [PATCH 1/4] cyclictest: tracing(): check for notrace Luiz Capitulino @ 2016-03-22 14:37 ` John Kacur 0 siblings, 0 replies; 12+ messages in thread From: John Kacur @ 2016-03-22 14:37 UTC (permalink / raw) To: Luiz Capitulino; +Cc: linux-rt-users, williams On Thu, 17 Mar 2016, Luiz Capitulino wrote: > If you pass -b and --notrace to cyclictest today, it will > write to tracing_on when -b latency is reached. > > Fix this by making tracing() check notrace. > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> > --- > src/cyclictest/cyclictest.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c > index f5a67dc..6070457 100644 > --- a/src/cyclictest/cyclictest.c > +++ b/src/cyclictest/cyclictest.c > @@ -479,6 +479,9 @@ static void tracemark(char *fmt, ...) > > static void tracing(int on) > { > + if (notrace) > + return; > + > if (on) { > switch (kernelversion) { > case KV_26_LT18: gettimeofday(0,(struct timezone *)1); break; > @@ -1698,7 +1701,7 @@ static void sighand(int sig) > shutdown = 1; > if (refresh_on_max) > pthread_cond_signal(&refresh_on_max_cond); > - if (tracelimit && !notrace) > + if (tracelimit) > tracing(0); > } > > @@ -2303,7 +2306,7 @@ int main(int argc, char **argv) > } > out: > /* ensure that the tracer is stopped */ > - if (tracelimit && !notrace) > + if (tracelimit) > tracing(0); > > > -- > 2.1.0 > > -- Signed-off-by: John Kacur <jkacur@redhat.com> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/4] cyclictest: move debugfs init code to its own function 2016-03-17 18:30 [PATCH v2 0/4] cyclictest: improve running under trace-cmd Luiz Capitulino 2016-03-17 18:30 ` [PATCH 1/4] cyclictest: tracing(): check for notrace Luiz Capitulino @ 2016-03-17 18:30 ` Luiz Capitulino 2016-03-22 14:40 ` John Kacur 2016-03-17 18:30 ` [PATCH 3/4] cyclictest: move tracemark_fd handling " Luiz Capitulino 2016-03-17 18:30 ` [PATCH 4/4] cyclictest: add --tracemark option Luiz Capitulino 3 siblings, 1 reply; 12+ messages in thread From: Luiz Capitulino @ 2016-03-17 18:30 UTC (permalink / raw) To: linux-rt-users; +Cc: jkacur, williams A function added by a future commit will want to call this code too. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- src/cyclictest/cyclictest.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 6070457..4e80831 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -514,11 +514,8 @@ static int settracer(char *tracer) return -1; } -static void setup_tracer(void) +static void debugfs_prepare(void) { - if (!tracelimit || notrace) - return; ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] cyclictest: move debugfs init code to its own function 2016-03-17 18:30 ` [PATCH 2/4] cyclictest: move debugfs init code to its own function Luiz Capitulino @ 2016-03-22 14:40 ` John Kacur 0 siblings, 0 replies; 12+ messages in thread From: John Kacur @ 2016-03-22 14:40 UTC (permalink / raw) To: Luiz Capitulino; +Cc: linux-rt-users, williams On Thu, 17 Mar 2016, Luiz Capitulino wrote: > A function added by a future commit will want to call > this code too. > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> > --- > src/cyclictest/cyclictest.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c > index 6070457..4e80831 100644 > --- a/src/cyclictest/cyclictest.c > +++ b/src/cyclictest/cyclictest.c > @@ -514,11 +514,8 @@ static int settracer(char *tracer) > return -1; > } > > -static void setup_tracer(void) > +static void debugfs_prepare(void) > { > - if (!tracelimit || notrace) > - return; > - > if (mount_debugfs(NULL)) > fatal("could not mount debugfs"); > > @@ -533,6 +530,14 @@ static void setup_tracer(void) > "TRACERs not configured?\n", testname); > } else > fileprefix = procfileprefix; > +} > + > +static void setup_tracer(void) > +{ > + if (!tracelimit || notrace) > + return; > + > + debugfs_prepare(); > > if (kernelversion >= KV_26_33) { > int ret; > -- > 2.1.0 > > -- Signed-off-by: John Kacur <jkacur@redhat.com> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] cyclictest: move tracemark_fd handling to its own function 2016-03-17 18:30 [PATCH v2 0/4] cyclictest: improve running under trace-cmd Luiz Capitulino 2016-03-17 18:30 ` [PATCH 1/4] cyclictest: tracing(): check for notrace Luiz Capitulino 2016-03-17 18:30 ` [PATCH 2/4] cyclictest: move debugfs init code to its own function Luiz Capitulino @ 2016-03-17 18:30 ` Luiz Capitulino 2016-03-22 14:35 ` John Kacur 2016-03-17 18:30 ` [PATCH 4/4] cyclictest: add --tracemark option Luiz Capitulino 3 siblings, 1 reply; 12+ messages in thread From: Luiz Capitulino @ 2016-03-17 18:30 UTC (permalink / raw) To: linux-rt-users; +Cc: jkacur, williams A function added by the next commit will want to call this code too. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- src/cyclictest/cyclictest.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 4e80831..65f2aec 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -532,6 +532,19 @@ static void debugfs_prepare(void) fileprefix = procfileprefix; } +static void open_tracemark_fd(void) +{ + char path[MAX_PATH]; + + if (tracemark_fd >= 0) + return; + + sprintf(path, "%s/%s", fileprefix, "trace_marker"); + tracemark_fd = open(path, O_WRONLY); + if (tracemark_fd < 0) + warn("unable to open trace_marker file: %s\n", path); +} + static void setup_tracer(void) { if (!tracelimit || notrace) @@ -647,14 +660,7 @@ static void setup_tracer(void) fatal("unable to open %s for tracing", path); } - /* open the tracemark file descriptor */ - if (tracemark_fd == -1) { - char path[MAX_PATH]; - strcat(strcpy(path, fileprefix), "trace_marker"); - if ((tracemark_fd = open(path, O_WRONLY)) == -1) - warn("unable to open trace_marker file: %s\n", path); - } ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/4] cyclictest: move tracemark_fd handling to its own function 2016-03-17 18:30 ` [PATCH 3/4] cyclictest: move tracemark_fd handling " Luiz Capitulino @ 2016-03-22 14:35 ` John Kacur 2016-03-22 14:42 ` Luiz Capitulino 0 siblings, 1 reply; 12+ messages in thread From: John Kacur @ 2016-03-22 14:35 UTC (permalink / raw) To: Luiz Capitulino; +Cc: linux-rt-users, williams On Thu, 17 Mar 2016, Luiz Capitulino wrote: > A function added by the next commit will want to call > this code too. > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> > --- > src/cyclictest/cyclictest.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) > > diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c > index 4e80831..65f2aec 100644 > --- a/src/cyclictest/cyclictest.c > +++ b/src/cyclictest/cyclictest.c > @@ -532,6 +532,19 @@ static void debugfs_prepare(void) > fileprefix = procfileprefix; > } > > +static void open_tracemark_fd(void) > +{ > + char path[MAX_PATH]; > + > + if (tracemark_fd >= 0) > + return; > + > + sprintf(path, "%s/%s", fileprefix, "trace_marker"); > + tracemark_fd = open(path, O_WRONLY); > + if (tracemark_fd < 0) > + warn("unable to open trace_marker file: %s\n", path); > +} > + > static void setup_tracer(void) > { > if (!tracelimit || notrace) > @@ -647,14 +660,7 @@ static void setup_tracer(void) > fatal("unable to open %s for tracing", path); > } > > - /* open the tracemark file descriptor */ > - if (tracemark_fd == -1) { > - char path[MAX_PATH]; > - strcat(strcpy(path, fileprefix), "trace_marker"); > - if ((tracemark_fd = open(path, O_WRONLY)) == -1) > - warn("unable to open trace_marker file: %s\n", path); > - } > - > + open_tracemark_fd(); > } else { > setkernvar("trace_all_cpus", "1"); > setkernvar("trace_freerunning", "1"); > -- > 2.1.0 Signed-off-by: John Kacur <jkacur@redhat.com> But, once again, it didn't apply cleanly, and you should have included it with the next set off patches where it is required, because I was scratching my head as to why I should include this until I looked there. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/4] cyclictest: move tracemark_fd handling to its own function 2016-03-22 14:35 ` John Kacur @ 2016-03-22 14:42 ` Luiz Capitulino 0 siblings, 0 replies; 12+ messages in thread From: Luiz Capitulino @ 2016-03-22 14:42 UTC (permalink / raw) To: John Kacur; +Cc: linux-rt-users, williams On Tue, 22 Mar 2016 15:35:55 +0100 (CET) John Kacur <jkacur@redhat.com> wrote: > > > On Thu, 17 Mar 2016, Luiz Capitulino wrote: > > > A function added by the next commit will want to call > > this code too. > > > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> > > --- > > src/cyclictest/cyclictest.c | 22 ++++++++++++++-------- > > 1 file changed, 14 insertions(+), 8 deletions(-) > > > > diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c > > index 4e80831..65f2aec 100644 > > --- a/src/cyclictest/cyclictest.c > > +++ b/src/cyclictest/cyclictest.c > > @@ -532,6 +532,19 @@ static void debugfs_prepare(void) > > fileprefix = procfileprefix; > > } > > > > +static void open_tracemark_fd(void) > > +{ > > + char path[MAX_PATH]; > > + > > + if (tracemark_fd >= 0) > > + return; > > + > > + sprintf(path, "%s/%s", fileprefix, "trace_marker"); > > + tracemark_fd = open(path, O_WRONLY); > > + if (tracemark_fd < 0) > > + warn("unable to open trace_marker file: %s\n", path); > > +} > > + > > static void setup_tracer(void) > > { > > if (!tracelimit || notrace) > > @@ -647,14 +660,7 @@ static void setup_tracer(void) > > fatal("unable to open %s for tracing", path); > > } > > > > - /* open the tracemark file descriptor */ > > - if (tracemark_fd == -1) { > > - char path[MAX_PATH]; > > - strcat(strcpy(path, fileprefix), "trace_marker"); > > - if ((tracemark_fd = open(path, O_WRONLY)) == -1) > > - warn("unable to open trace_marker file: %s\n", path); > > - } > > - > > + open_tracemark_fd(); > > } else { > > setkernvar("trace_all_cpus", "1"); > > setkernvar("trace_freerunning", "1"); > > -- > > 2.1.0 > > Signed-off-by: John Kacur <jkacur@redhat.com> > > But, once again, it didn't apply cleanly, Yeah, I didn't know I had to use the devel branch. Do you want me to re-send or did git solved the conflicts? > and you should have included it > with the next set off patches where it is required, because I was > scratching my head as to why I should include this until I looked there. Which set of patches? ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/4] cyclictest: add --tracemark option 2016-03-17 18:30 [PATCH v2 0/4] cyclictest: improve running under trace-cmd Luiz Capitulino ` (2 preceding siblings ...) 2016-03-17 18:30 ` [PATCH 3/4] cyclictest: move tracemark_fd handling " Luiz Capitulino @ 2016-03-17 18:30 ` Luiz Capitulino 2016-03-22 14:57 ` John Kacur 3 siblings, 1 reply; 12+ messages in thread From: Luiz Capitulino @ 2016-03-17 18:30 UTC (permalink / raw) To: linux-rt-users; +Cc: jkacur, williams cyclictest will only write to /sys/kernel/debug/tracing/trace_maker if it's also setup to do tracing. This conflicts with running cyclictest under trace-cmd. The --tracemark option tells cyclictest to write to the trace_marker file even when it's not doing tracing. It can be used like this: # trace-cmd record [...] cyclictest [...] -bX --tracemark --notrace Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- src/cyclictest/cyclictest.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 65f2aec..75af721 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -192,6 +192,7 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts); static int shutdown; static int tracelimit = 0; static int notrace = 0; +static int trace_marker = 0; static int ftrace = 0; static int kernelversion; static int verbose = 0; @@ -545,6 +546,18 @@ static void open_tracemark_fd(void) warn("unable to open trace_marker file: %s\n", path); } +static void enable_trace_mark(void) +{ + if (!trace_marker) + return; + + if (!tracelimit) + fatal("--tracemark requires -b\n"); + + debugfs_prepare(); + open_tracemark_fd(); +} + static void setup_tracer(void) { if (!tracelimit || notrace) @@ -1286,7 +1299,7 @@ enum option_values { OPT_SYSTEM, OPT_SMP, OPT_THREADS, OPT_TRACER, OPT_TRIGGER, OPT_TRIGGER_NODES, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE, OPT_WAKEUP, OPT_WAKEUPRT, OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS, - OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP, + OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP, OPT_TRACEMARK, }; /* Process commandline options */ @@ -1340,6 +1353,7 @@ static void process_options (int argc, char *argv[], int max_cpus) {"spike", required_argument, NULL, OPT_TRIGGER }, {"spike-nodes", required_argument, NULL, OPT_TRIGGER_NODES }, {"threads", optional_argument, NULL, OPT_THREADS }, + {"tracemark", no_argument, NULL, OPT_TRACEMARK }, {"tracer", required_argument, NULL, OPT_TRACER }, {"unbuffered", no_argument, NULL, OPT_UNBUFFERED }, {"numa", no_argument, NULL, OPT_NUMA }, @@ -1574,6 +1588,8 @@ static void process_options (int argc, char *argv[], int max_cpus) ct_debug = 1; break; case OPT_LAPTOP: laptop = 1; break; + case OPT_TRACEMARK: + trace_marker = 1; break; } } @@ -1983,6 +1999,8 @@ int main(int argc, char **argv) setup_tracer(); + enable_trace_mark(); + if (check_timer()) warn("High resolution timers not available\n"); -- 2.1.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] cyclictest: add --tracemark option 2016-03-17 18:30 ` [PATCH 4/4] cyclictest: add --tracemark option Luiz Capitulino @ 2016-03-22 14:57 ` John Kacur 2016-03-22 15:01 ` Luiz Capitulino 0 siblings, 1 reply; 12+ messages in thread From: John Kacur @ 2016-03-22 14:57 UTC (permalink / raw) To: Luiz Capitulino; +Cc: linux-rt-users, williams On Thu, 17 Mar 2016, Luiz Capitulino wrote: > cyclictest will only write to /sys/kernel/debug/tracing/trace_maker > if it's also setup to do tracing. This conflicts with > running cyclictest under trace-cmd. > > The --tracemark option tells cyclictest to write to the > trace_marker file even when it's not doing tracing. > > It can be used like this: > > # trace-cmd record [...] cyclictest [...] -bX --tracemark --notrace > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> > --- > src/cyclictest/cyclictest.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c > index 65f2aec..75af721 100644 > --- a/src/cyclictest/cyclictest.c > +++ b/src/cyclictest/cyclictest.c > @@ -192,6 +192,7 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts); > static int shutdown; > static int tracelimit = 0; > static int notrace = 0; > +static int trace_marker = 0; > static int ftrace = 0; > static int kernelversion; > static int verbose = 0; > @@ -545,6 +546,18 @@ static void open_tracemark_fd(void) > warn("unable to open trace_marker file: %s\n", path); > } > > +static void enable_trace_mark(void) > +{ > + if (!trace_marker) > + return; > + > + if (!tracelimit) > + fatal("--tracemark requires -b\n"); > + > + debugfs_prepare(); > + open_tracemark_fd(); > +} > + > static void setup_tracer(void) > { > if (!tracelimit || notrace) > @@ -1286,7 +1299,7 @@ enum option_values { > OPT_SYSTEM, OPT_SMP, OPT_THREADS, OPT_TRACER, OPT_TRIGGER, > OPT_TRIGGER_NODES, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE, OPT_WAKEUP, > OPT_WAKEUPRT, OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS, > - OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP, > + OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP, OPT_TRACEMARK, > }; > > /* Process commandline options */ > @@ -1340,6 +1353,7 @@ static void process_options (int argc, char *argv[], int max_cpus) > {"spike", required_argument, NULL, OPT_TRIGGER }, > {"spike-nodes", required_argument, NULL, OPT_TRIGGER_NODES }, > {"threads", optional_argument, NULL, OPT_THREADS }, > + {"tracemark", no_argument, NULL, OPT_TRACEMARK }, > {"tracer", required_argument, NULL, OPT_TRACER }, > {"unbuffered", no_argument, NULL, OPT_UNBUFFERED }, > {"numa", no_argument, NULL, OPT_NUMA }, > @@ -1574,6 +1588,8 @@ static void process_options (int argc, char *argv[], int max_cpus) > ct_debug = 1; break; > case OPT_LAPTOP: > laptop = 1; break; > + case OPT_TRACEMARK: > + trace_marker = 1; break; > } > } > > @@ -1983,6 +1999,8 @@ int main(int argc, char **argv) > > setup_tracer(); > > + enable_trace_mark(); > + > if (check_timer()) > warn("High resolution timers not available\n"); > > -- > 2.1.0 > I've pushed all the fixed up to before this point to kernel.org can you respin this patch against the latest code? Once it applies cleanly then I'll take it Thanks John ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] cyclictest: add --tracemark option 2016-03-22 14:57 ` John Kacur @ 2016-03-22 15:01 ` Luiz Capitulino 0 siblings, 0 replies; 12+ messages in thread From: Luiz Capitulino @ 2016-03-22 15:01 UTC (permalink / raw) To: John Kacur; +Cc: linux-rt-users, williams On Tue, 22 Mar 2016 15:57:45 +0100 (CET) John Kacur <jkacur@redhat.com> wrote: > > > On Thu, 17 Mar 2016, Luiz Capitulino wrote: > > > cyclictest will only write to /sys/kernel/debug/tracing/trace_maker > > if it's also setup to do tracing. This conflicts with > > running cyclictest under trace-cmd. > > > > The --tracemark option tells cyclictest to write to the > > trace_marker file even when it's not doing tracing. > > > > It can be used like this: > > > > # trace-cmd record [...] cyclictest [...] -bX --tracemark --notrace > > > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> > > --- > > src/cyclictest/cyclictest.c | 20 +++++++++++++++++++- > > 1 file changed, 19 insertions(+), 1 deletion(-) > > > > diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c > > index 65f2aec..75af721 100644 > > --- a/src/cyclictest/cyclictest.c > > +++ b/src/cyclictest/cyclictest.c > > @@ -192,6 +192,7 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts); > > static int shutdown; > > static int tracelimit = 0; > > static int notrace = 0; > > +static int trace_marker = 0; > > static int ftrace = 0; > > static int kernelversion; > > static int verbose = 0; > > @@ -545,6 +546,18 @@ static void open_tracemark_fd(void) > > warn("unable to open trace_marker file: %s\n", path); > > } > > > > +static void enable_trace_mark(void) > > +{ > > + if (!trace_marker) > > + return; > > + > > + if (!tracelimit) > > + fatal("--tracemark requires -b\n"); > > + > > + debugfs_prepare(); > > + open_tracemark_fd(); > > +} > > + > > static void setup_tracer(void) > > { > > if (!tracelimit || notrace) > > @@ -1286,7 +1299,7 @@ enum option_values { > > OPT_SYSTEM, OPT_SMP, OPT_THREADS, OPT_TRACER, OPT_TRIGGER, > > OPT_TRIGGER_NODES, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE, OPT_WAKEUP, > > OPT_WAKEUPRT, OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS, > > - OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP, > > + OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP, OPT_TRACEMARK, > > }; > > > > /* Process commandline options */ > > @@ -1340,6 +1353,7 @@ static void process_options (int argc, char *argv[], int max_cpus) > > {"spike", required_argument, NULL, OPT_TRIGGER }, > > {"spike-nodes", required_argument, NULL, OPT_TRIGGER_NODES }, > > {"threads", optional_argument, NULL, OPT_THREADS }, > > + {"tracemark", no_argument, NULL, OPT_TRACEMARK }, > > {"tracer", required_argument, NULL, OPT_TRACER }, > > {"unbuffered", no_argument, NULL, OPT_UNBUFFERED }, > > {"numa", no_argument, NULL, OPT_NUMA }, > > @@ -1574,6 +1588,8 @@ static void process_options (int argc, char *argv[], int max_cpus) > > ct_debug = 1; break; > > case OPT_LAPTOP: > > laptop = 1; break; > > + case OPT_TRACEMARK: > > + trace_marker = 1; break; > > } > > } > > > > @@ -1983,6 +1999,8 @@ int main(int argc, char **argv) > > > > setup_tracer(); > > > > + enable_trace_mark(); > > + > > if (check_timer()) > > warn("High resolution timers not available\n"); > > > > -- > > 2.1.0 > > > > I've pushed all the fixed up to before this point to kernel.org > can you respin this patch against the latest code? Sure, which branch? > > Once it applies cleanly then I'll take it > > Thanks > > John > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 0/4] cyclictest: improve running under trace-cmd @ 2016-02-25 16:29 Luiz Capitulino 2016-02-25 16:29 ` [PATCH 3/4] cyclictest: move tracemark_fd handling to its own function Luiz Capitulino 0 siblings, 1 reply; 12+ messages in thread From: Luiz Capitulino @ 2016-02-25 16:29 UTC (permalink / raw) To: linux-rt-users; +Cc: jkacur, williams This is just a repost of my RFC posting with no changes. I have tested it a bit more and I think it's good for inclusion. Original intro: In short, this series allows you to run cyclictest under trace-cmd and still get trace marks when the latency specified with -b is execeded. More details in patch 4/4. This series is RFC because I'm not completely sure this is the right thing to do. I'm wondering if we shouldn't ditch all tracing support from cyclictest... Luiz Capitulino (4): cyclictest: tracing(): check for notrace cyclictest: move debugfs init code to its own function cyclictest: move tracemark_fd handling to its own function cyclictest: add --tracemark option src/cyclictest/cyclictest.c | 62 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 15 deletions(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] cyclictest: move tracemark_fd handling to its own function 2016-02-25 16:29 [PATCH 0/4] cyclictest: improve running under trace-cmd Luiz Capitulino @ 2016-02-25 16:29 ` Luiz Capitulino 0 siblings, 0 replies; 12+ messages in thread From: Luiz Capitulino @ 2016-02-25 16:29 UTC (permalink / raw) To: linux-rt-users; +Cc: jkacur, williams A function added by the next commit will want to call this code too. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- src/cyclictest/cyclictest.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index f543c34..e35088b 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -497,6 +497,19 @@ static void debugfs_prepare(void) fileprefix = procfileprefix; } +static void open_tracemark_fd(void) +{ + char path[MAX_PATH]; + + if (tracemark_fd >= 0) + return; + + sprintf(path, "%s/%s", fileprefix, "trace_marker"); + tracemark_fd = open(path, O_WRONLY); + if (tracemark_fd < 0) + warn("unable to open trace_marker file: %s\n", path); +} + static void setup_tracer(void) { if (!tracelimit || notrace) @@ -612,14 +625,7 @@ static void setup_tracer(void) fatal("unable to open %s for tracing", path); } - /* open the tracemark file descriptor */ - if (tracemark_fd == -1) { - char path[MAX_PATH]; - strcat(strcpy(path, fileprefix), "trace_marker"); - if ((tracemark_fd = open(path, O_WRONLY)) == -1) - warn("unable to open trace_marker file: %s\n", path); - } ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-03-22 15:01 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-03-17 18:30 [PATCH v2 0/4] cyclictest: improve running under trace-cmd Luiz Capitulino 2016-03-17 18:30 ` [PATCH 1/4] cyclictest: tracing(): check for notrace Luiz Capitulino 2016-03-22 14:37 ` John Kacur 2016-03-17 18:30 ` [PATCH 2/4] cyclictest: move debugfs init code to its own function Luiz Capitulino 2016-03-22 14:40 ` John Kacur 2016-03-17 18:30 ` [PATCH 3/4] cyclictest: move tracemark_fd handling " Luiz Capitulino 2016-03-22 14:35 ` John Kacur 2016-03-22 14:42 ` Luiz Capitulino 2016-03-17 18:30 ` [PATCH 4/4] cyclictest: add --tracemark option Luiz Capitulino 2016-03-22 14:57 ` John Kacur 2016-03-22 15:01 ` Luiz Capitulino -- strict thread matches above, loose matches on Subject: below -- 2016-02-25 16:29 [PATCH 0/4] cyclictest: improve running under trace-cmd Luiz Capitulino 2016-02-25 16:29 ` [PATCH 3/4] cyclictest: move tracemark_fd handling to its own function Luiz Capitulino
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.