From: Gabriele Monaco <gmonaco@redhat.com>
To: Nam Cao <namcao@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: john.ogness@linutronix.de
Subject: Re: [PATCH v2 06/22] verification/dot2k: Remove __buff_to_string()
Date: Fri, 11 Apr 2025 10:53:52 +0200 [thread overview]
Message-ID: <16410f1680d27424869f0aa642ef41ae9647bd40.camel@redhat.com> (raw)
In-Reply-To: <5e50fa5438830238d92c037c6e609db104503584.1744355018.git.namcao@linutronix.de>
On Fri, 2025-04-11 at 09:37 +0200, Nam Cao wrote:
> str.join() can do what __buff_to_string() does. Therefore replace
> __buff_to_string() to make the scripts more pythonic.
>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> ---
> tools/verification/dot2/dot2/dot2k.py | 21 ++++++---------------
> 1 file changed, 6 insertions(+), 15 deletions(-)
>
> diff --git a/tools/verification/dot2/dot2/dot2k.py
> b/tools/verification/dot2/dot2/dot2k.py
> index dd4b5528a4f2..0922754454b9 100644
> --- a/tools/verification/dot2/dot2/dot2k.py
> +++ b/tools/verification/dot2/dot2/dot2k.py
> @@ -109,15 +109,6 @@ class dot2k(Dot2c):
> fd.close()
> return content
>
> - def __buff_to_string(self, buff):
> - string = ""
> -
> - for line in buff:
> - string = string + line + "\n"
> -
> - # cut off the last \n
> - return string[:-1]
> -
> def fill_monitor_type(self):
> return self.monitor_type.upper()
>
> @@ -148,19 +139,19 @@ class dot2k(Dot2c):
> buff.append("\tda_%s_%s(%s%s);" % (handle,
> self.name, event, self.enum_suffix));
> buff.append("}")
> buff.append("")
> - return self.__buff_to_string(buff)
> + return '\n'.join(buff)
>
> def fill_tracepoint_attach_probe(self):
> buff = []
> for event in self.events:
> buff.append("\trv_attach_trace_probe(\"%s\", /* XXX:
> tracepoint */, handle_%s);" % (self.name, event))
> - return self.__buff_to_string(buff)
> + return '\n'.join(buff)
>
> def fill_tracepoint_detach_helper(self):
> buff = []
> for event in self.events:
> buff.append("\trv_detach_trace_probe(\"%s\", /* XXX:
> tracepoint */, handle_%s);" % (self.name, event))
> - return self.__buff_to_string(buff)
> + return '\n'.join(buff)
>
> def fill_main_c(self):
> main_c = self.main_c
> @@ -210,7 +201,7 @@ class dot2k(Dot2c):
> buff = self.fill_model_h_header()
> buff += self.format_model()
>
> - return self.__buff_to_string(buff)
> + return '\n'.join(buff)
>
> def fill_monitor_class_type(self):
> if self.monitor_type == "per_task":
> @@ -242,7 +233,7 @@ class dot2k(Dot2c):
> tp_args_c = ", ".join([b for a,b in tp_args])
> buff.append(" TP_PROTO(%s)," % tp_proto_c)
> buff.append(" TP_ARGS(%s)" % tp_args_c)
> - return self.__buff_to_string(buff)
> + return '\n'.join(buff)
>
> def fill_monitor_deps(self):
> buff = []
> @@ -250,7 +241,7 @@ class dot2k(Dot2c):
> if self.parent:
> buff.append(" depends on RV_MON_%s" %
> self.parent.upper())
> buff.append(" default y")
> - return self.__buff_to_string(buff)
> + return '\n'.join(buff)
>
> def fill_trace_h(self):
> trace_h = self.trace_h
Good one, I've been too lazy to do it. Thanks!
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
next prev parent reply other threads:[~2025-04-11 8:53 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 7:37 [PATCH v2 00/22] RV: Linear temporal logic monitors for RT application Nam Cao
2025-04-11 7:37 ` [PATCH v2 01/22] rv: Fix out-of-bound memory access in rv_is_container_monitor() Nam Cao
2025-04-11 7:37 ` [PATCH v2 02/22] rv: Add #undef TRACE_INCLUDE_FILE Nam Cao
2025-04-11 7:37 ` [PATCH v2 03/22] rv: Let the reactors take care of buffers Nam Cao
2025-04-11 8:39 ` Gabriele Monaco
2025-04-15 9:32 ` Petr Mladek
2025-04-15 9:53 ` Nam Cao
2025-04-11 7:37 ` [PATCH v2 04/22] verification/dot2k: Make it possible to invoke dot2k without installation Nam Cao
2025-04-11 9:23 ` Gabriele Monaco
2025-04-11 14:04 ` Nam Cao
2025-04-11 14:56 ` Gabriele Monaco
2025-04-11 7:37 ` [PATCH v2 05/22] verification/dot2k: Make a separate dot2k_templates/Kconfig_container Nam Cao
2025-04-11 8:54 ` Gabriele Monaco
2025-04-11 7:37 ` [PATCH v2 06/22] verification/dot2k: Remove __buff_to_string() Nam Cao
2025-04-11 8:53 ` Gabriele Monaco [this message]
2025-04-11 7:37 ` [PATCH v2 07/22] verification/dot2k: Replace is_container() hack with subparsers Nam Cao
2025-04-11 8:56 ` Gabriele Monaco
2025-04-11 7:37 ` [PATCH v2 08/22] rv: rename CONFIG_DA_MON_EVENTS to CONFIG_RV_MON_EVENTS Nam Cao
2025-04-11 10:37 ` Gabriele Monaco
2025-04-11 7:37 ` [PATCH v2 09/22] verification/dot2k: Prepare the frontend for LTL inclusion Nam Cao
2025-04-11 7:37 ` [PATCH v2 10/22] Documentation/rv: Prepare monitor synthesis document " Nam Cao
2025-04-11 9:28 ` Gabriele Monaco
2025-04-11 7:37 ` [PATCH v2 11/22] verification/rvgen: Prepare the templates " Nam Cao
2025-04-11 7:37 ` [PATCH v2 12/22] verification/rvgen: Restructure the classes to prepare " Nam Cao
2025-04-11 7:37 ` [PATCH v2 13/22] rv: Add support for LTL monitors Nam Cao
2025-04-11 11:17 ` Gabriele Monaco
2025-04-11 14:15 ` Nam Cao
2025-04-15 13:22 ` Gabriele Monaco
2025-04-16 3:55 ` Nam Cao
2025-04-11 7:37 ` [PATCH v2 14/22] rv: Add rtapp container monitor Nam Cao
2025-04-11 7:37 ` [PATCH v2 15/22] x86/tracing: Remove redundant trace_pagefault_key Nam Cao
2025-04-11 7:37 ` [PATCH v2 16/22] x86/tracing: Move page fault trace points to generic Nam Cao
2025-04-11 7:37 ` [PATCH v2 17/22] arm64: mm: Add page fault trace points Nam Cao
2025-04-11 7:37 ` [PATCH v2 18/22] riscv: " Nam Cao
2025-04-11 7:37 ` [PATCH v2 19/22] rv: Add rtapp_pagefault monitor Nam Cao
2025-04-15 12:31 ` Gabriele Monaco
2025-04-15 12:38 ` Nam Cao
2025-04-15 12:47 ` Gabriele Monaco
2025-04-11 7:37 ` [PATCH v2 20/22] rv: Add rtapp_sleep monitor Nam Cao
2025-04-11 7:37 ` [PATCH v2 21/22] rv: Add documentation for rtapp monitor Nam Cao
2025-04-15 13:12 ` Gabriele Monaco
2025-04-16 4:37 ` Nam Cao
2025-04-11 7:37 ` [PATCH v2 22/22] rv: Allow to configure the number of per-task monitor Nam Cao
2025-04-11 12:31 ` Gabriele Monaco
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=16410f1680d27424869f0aa642ef41ae9647bd40.camel@redhat.com \
--to=gmonaco@redhat.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=namcao@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).