Re: [LTP] [PATCH 6/6] sched_football: Add trace_marker messages if we're tracing

John Stultz via ltp
2024-04-29T23:15:28Z

On Mon, Apr 29, 2024 at 2:18 AM Cyril Hrubis <chrubis@suse.cz> wrote:
> > + sprintf(buf, "I|%i|Game_Over!\n", getpid());
> > + if (fd > 0)
> > + ret = write(fd, buf, strnlen(buf, BUF_LEN));
>
> I know that we havre only two usages now, but it would be a bit cleaner
> and readable to have a function to print the messages, e.g.
>
> static void tracer_write(const char *msg);
>
> And we would do:
>
> tracer_write("Game_Started!");

Sure. For now I'll add it to the librttest code, but I'm happy to pull
it out to more generic logic once there's a good approach to the
config conflicts in the subsystem headers.

> It would be a good idea to add the test name to the message as well,
> maybe as:
>
> sprintf(buf, "sched_football|%i|%s\n", getpid(), msg);
>

How about sprintf(buf, "I|%i|%s: %s\n", getpid(), test_tag, msg) ?

This is mostly because I'm using the trace_marker format that perfetto
understands, and can visualize.

thanks
-john