* [PATCH 1/2] rt-utils: Add option to avoid stopping tracing in tracemark()
@ 2021-07-09 15:54 Nicolas Saenz Julienne
2021-07-09 15:54 ` [PATCH 2/2] oslat: Add trace maker prior starting main thread Nicolas Saenz Julienne
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Saenz Julienne @ 2021-07-09 15:54 UTC (permalink / raw)
To: linux-rt-users, peterx; +Cc: williams, jkacur, nsaenzju
Not all users of tracemark() might want to stop tracing after printing a
mark. For example, if leaving a mark during a test. So add an extra
argument to tracemark() which avoid the stop.
Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
---
src/cyclictest/cyclictest.c | 3 ++-
src/include/rt-utils.h | 2 +-
src/lib/rt-utils.c | 6 ++++--
src/oslat/oslat.c | 2 +-
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index a08c91d..1f3c5a2 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <getopt.h>
@@ -722,7 +723,7 @@ static void *timerthread(void *param)
pthread_mutex_lock(&break_thread_id_lock);
if (break_thread_id == 0) {
break_thread_id = stat->tid;
- tracemark("hit latency threshold (%llu > %d)",
+ tracemark(true, "hit latency threshold (%llu > %d)",
(unsigned long long) diff, tracelimit);
break_thread_value = diff;
}
diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
index f6b3fed..88d285b 100644
--- a/src/include/rt-utils.h
+++ b/src/include/rt-utils.h
@@ -31,7 +31,7 @@ int parse_time_string(char *val);
int parse_mem_string(char *str, uint64_t *val);
void enable_trace_mark(void);
-void tracemark(char *fmt, ...) __attribute__((format(printf, 1, 2)));
+void tracemark(bool stop, char *fmt, ...) __attribute__((format(printf, 2, 3)));
void disable_trace_mark(void);
#define MSEC_PER_SEC 1000
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index 6c0235d..d8d1325 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -23,6 +23,7 @@
#include <sys/utsname.h>
#include <time.h>
#include <sys/time.h>
+#include <stdbool.h>
#include "rt-utils.h"
#include "rt-sched.h"
@@ -458,7 +459,7 @@ static void debugfs_prepare(void)
"debug fs not mounted");
}
-void tracemark(char *fmt, ...)
+void tracemark(bool stop, char *fmt, ...)
{
va_list ap;
int len;
@@ -476,7 +477,8 @@ void tracemark(char *fmt, ...)
write(tracemark_fd, tracebuf, len);
/* now stop any trace */
- write(trace_fd, "0\n", 2);
+ if (stop)
+ write(trace_fd, "0\n", 2);
}
void enable_trace_mark(void)
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 6ff5ba8..d35be57 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -304,7 +304,7 @@ static void insert_bucket(struct thread *t, stamp_t value)
if (!g.preheat && g.trace_threshold && us >= g.trace_threshold) {
char *line = "%s: Trace threshold (%d us) triggered with %u us!\n"
"Stopping the test.\n";
- tracemark(line, g.app_name, g.trace_threshold, us);
+ tracemark(true, line, g.app_name, g.trace_threshold, us);
err_quit(line, g.app_name, g.trace_threshold, us);
}
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] oslat: Add trace maker prior starting main thread
2021-07-09 15:54 [PATCH 1/2] rt-utils: Add option to avoid stopping tracing in tracemark() Nicolas Saenz Julienne
@ 2021-07-09 15:54 ` Nicolas Saenz Julienne
2021-07-09 18:39 ` Peter Xu
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Saenz Julienne @ 2021-07-09 15:54 UTC (permalink / raw)
To: linux-rt-users, peterx; +Cc: williams, jkacur, nsaenzju
After a long tracing session it's sometimes hard to find the moment
oslat started. So leave a message in the trace buffer just before the
main thread starts.
Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
---
src/oslat/oslat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index d35be57..20bf02b 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -400,6 +400,10 @@ static void *thread_main(void *arg)
while (g.n_threads_running != g.n_threads)
relax();
+ if (!g.preheat)
+ tracemark(false, "%s: Starting thread on CPU %d.\n",
+ g.app_name, t->core_i);
+
frc(&t->frc_start);
doit(t);
frc(&t->frc_stop);
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] oslat: Add trace maker prior starting main thread
2021-07-09 15:54 ` [PATCH 2/2] oslat: Add trace maker prior starting main thread Nicolas Saenz Julienne
@ 2021-07-09 18:39 ` Peter Xu
2021-07-12 10:17 ` nicolassaenzj
0 siblings, 1 reply; 4+ messages in thread
From: Peter Xu @ 2021-07-09 18:39 UTC (permalink / raw)
To: Nicolas Saenz Julienne; +Cc: linux-rt-users, williams, jkacur
On Fri, Jul 09, 2021 at 05:54:14PM +0200, Nicolas Saenz Julienne wrote:
> After a long tracing session it's sometimes hard to find the moment
> oslat started. So leave a message in the trace buffer just before the
> main thread starts.
>
> Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
> ---
> src/oslat/oslat.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
> index d35be57..20bf02b 100644
> --- a/src/oslat/oslat.c
> +++ b/src/oslat/oslat.c
> @@ -400,6 +400,10 @@ static void *thread_main(void *arg)
> while (g.n_threads_running != g.n_threads)
> relax();
>
> + if (!g.preheat)
> + tracemark(false, "%s: Starting thread on CPU %d.\n",
> + g.app_name, t->core_i);
> +
> frc(&t->frc_start);
> doit(t);
> frc(&t->frc_stop);
> --
> 2.31.1
>
Not sure how it would help.. but no objection either. :)
Acked-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] oslat: Add trace maker prior starting main thread
2021-07-09 18:39 ` Peter Xu
@ 2021-07-12 10:17 ` nicolassaenzj
0 siblings, 0 replies; 4+ messages in thread
From: nicolassaenzj @ 2021-07-12 10:17 UTC (permalink / raw)
To: Peter Xu; +Cc: linux-rt-users, williams, jkacur
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
Hi Peter,
On Fri, 2021-07-09 at 14:39 -0400, Peter Xu wrote:
> On Fri, Jul 09, 2021 at 05:54:14PM +0200, Nicolas Saenz Julienne wrote:
> > After a long tracing session it's sometimes hard to find the moment
> > oslat started. So leave a message in the trace buffer just before the
> > main thread starts.
> >
> > Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
> > ---
> > src/oslat/oslat.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
> > index d35be57..20bf02b 100644
> > --- a/src/oslat/oslat.c
> > +++ b/src/oslat/oslat.c
> > @@ -400,6 +400,10 @@ static void *thread_main(void *arg)
> > while (g.n_threads_running != g.n_threads)
> > relax();
> >
> > + if (!g.preheat)
> > + tracemark(false, "%s: Starting thread on CPU %d.\n",
> > + g.app_name, t->core_i);
> > +
> > frc(&t->frc_start);
> > doit(t);
> > frc(&t->frc_stop);
> > --
> > 2.31.1
> >
>
> Not sure how it would help.. but no objection either. :)
For example, I tend to enable all trace points on Isolated CPUs. It's
manageable, since once oslat runs you shouldn't be getting much action. But you
get 10s/100s MBs of noise generated while oslat is being initialized. This
makes finding the beginning of the test very annoying and time consuming.
> Acked-by: Peter Xu <peterx@redhat.com>
Thanks!
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-12 10:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 15:54 [PATCH 1/2] rt-utils: Add option to avoid stopping tracing in tracemark() Nicolas Saenz Julienne
2021-07-09 15:54 ` [PATCH 2/2] oslat: Add trace maker prior starting main thread Nicolas Saenz Julienne
2021-07-09 18:39 ` Peter Xu
2021-07-12 10:17 ` nicolassaenzj
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.