* [PATCH 1/1] pfunct: Don't print functions twice when using -f
@ 2024-12-30 19:36 Arnaldo Carvalho de Melo
2025-01-02 23:21 ` Ihor Solodrai
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-12-30 19:36 UTC (permalink / raw)
To: Alan Maguire
Cc: Andrii Nakryiko, Eduard Zingerman, Ihor Solodrai, Mykola Lysenko,
dwarves
We print it in the pfunct_stealer, i.e. as soon as we load the CU
containing the function information, and then, later, we were iterating
all cus and printing the functions that matched.
Do it just at the stealer.
Cc: Alan Maguire <alan.maguire@oracle.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Ihor Solodrai <ihor.solodrai@pm.me>
Cc: Mykola Lysenko <mykolal@fb.com>
Link: https://lore.kernel.org/all/Z3LoTvt7PtUAbh5K@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
pfunct.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/pfunct.c b/pfunct.c
index 55eafe8a8e790dcb..5a6dd59a1c7a30b1 100644
--- a/pfunct.c
+++ b/pfunct.c
@@ -415,14 +415,12 @@ static void function__show(struct function *func, struct cu *cu)
fstats->printed = true;
}
-static int cu_function_iterator(struct cu *cu, void *cookie)
+static int cu_function_iterator(struct cu *cu, void *cookie __maybe_unused)
{
struct function *function;
uint32_t id;
cu__for_each_function(cu, id, function) {
- if (cookie && strcmp(function__name(function), cookie) != 0)
- continue;
function__show(function, cu);
}
return 0;
@@ -816,10 +814,9 @@ try_sole_arg_as_function_name:
function__show(f, cu);
} else if (show_total_inline_expansion_stats)
print_total_inline_stats();
- else if (function_name != NULL || expand_types)
- cus__for_each_cu(cus, cu_function_iterator,
- function_name, NULL);
- else
+ else if (expand_types)
+ cus__for_each_cu(cus, cu_function_iterator, NULL, NULL);
+ else if (function_name == NULL)
print_fn_stats(formatter);
rc = EXIT_SUCCESS;
--
2.46.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] pfunct: Don't print functions twice when using -f
2024-12-30 19:36 [PATCH 1/1] pfunct: Don't print functions twice when using -f Arnaldo Carvalho de Melo
@ 2025-01-02 23:21 ` Ihor Solodrai
2025-01-09 16:02 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Ihor Solodrai @ 2025-01-02 23:21 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Alan Maguire, Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
dwarves
On Monday, December 30th, 2024 at 11:36 AM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
>
> We print it in the pfunct_stealer, i.e. as soon as we load the CU
> containing the function information, and then, later, we were iterating
> all cus and printing the functions that matched.
>
> Do it just at the stealer.
>
> Cc: Alan Maguire alan.maguire@oracle.com
>
> Cc: Andrii Nakryiko andrii@kernel.org
>
> Cc: Eduard Zingerman eddyz87@gmail.com
>
> Cc: Ihor Solodrai ihor.solodrai@pm.me
>
> Cc: Mykola Lysenko mykolal@fb.com
>
> Link: https://lore.kernel.org/all/Z3LoTvt7PtUAbh5K@x1
> Signed-off-by: Arnaldo Carvalho de Melo acme@redhat.com
Can confirm this fixes double-printing of some functions when
running pfunct -F dwarf
Tested-by: Ihor Solodrai <ihor.solodrai@pm.me>
>
> ---
> pfunct.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/pfunct.c b/pfunct.c
> index 55eafe8a8e790dcb..5a6dd59a1c7a30b1 100644
> --- a/pfunct.c
> +++ b/pfunct.c
> @@ -415,14 +415,12 @@ static void function__show(struct function *func, struct cu *cu)
> fstats->printed = true;
>
> }
>
> -static int cu_function_iterator(struct cu *cu, void *cookie)
> +static int cu_function_iterator(struct cu *cu, void *cookie __maybe_unused)
> {
> struct function *function;
> uint32_t id;
>
> cu__for_each_function(cu, id, function) {
> - if (cookie && strcmp(function__name(function), cookie) != 0)
> - continue;
> function__show(function, cu);
> }
> return 0;
> @@ -816,10 +814,9 @@ try_sole_arg_as_function_name:
> function__show(f, cu);
> } else if (show_total_inline_expansion_stats)
> print_total_inline_stats();
> - else if (function_name != NULL || expand_types)
> - cus__for_each_cu(cus, cu_function_iterator,
> - function_name, NULL);
> - else
> + else if (expand_types)
> + cus__for_each_cu(cus, cu_function_iterator, NULL, NULL);
> + else if (function_name == NULL)
> print_fn_stats(formatter);
>
> rc = EXIT_SUCCESS;
> --
> 2.46.2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] pfunct: Don't print functions twice when using -f
2025-01-02 23:21 ` Ihor Solodrai
@ 2025-01-09 16:02 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-01-09 16:02 UTC (permalink / raw)
To: Ihor Solodrai
Cc: Alan Maguire, Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
dwarves
On Thu, Jan 02, 2025 at 11:21:16PM +0000, Ihor Solodrai wrote:
> On Monday, December 30th, 2024 at 11:36 AM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> >
> >
> > We print it in the pfunct_stealer, i.e. as soon as we load the CU
> > containing the function information, and then, later, we were iterating
> > all cus and printing the functions that matched.
> >
> > Do it just at the stealer.
> >
> > Cc: Alan Maguire alan.maguire@oracle.com
> >
> > Cc: Andrii Nakryiko andrii@kernel.org
> >
> > Cc: Eduard Zingerman eddyz87@gmail.com
> >
> > Cc: Ihor Solodrai ihor.solodrai@pm.me
> >
> > Cc: Mykola Lysenko mykolal@fb.com
> >
> > Link: https://lore.kernel.org/all/Z3LoTvt7PtUAbh5K@x1
> > Signed-off-by: Arnaldo Carvalho de Melo acme@redhat.com
>
> Can confirm this fixes double-printing of some functions when
> running pfunct -F dwarf
>
> Tested-by: Ihor Solodrai <ihor.solodrai@pm.me>
Thanks, added to the cset.
- Arnaldo
> >
> > ---
> > pfunct.c | 11 ++++-------
> > 1 file changed, 4 insertions(+), 7 deletions(-)
> >
> > diff --git a/pfunct.c b/pfunct.c
> > index 55eafe8a8e790dcb..5a6dd59a1c7a30b1 100644
> > --- a/pfunct.c
> > +++ b/pfunct.c
> > @@ -415,14 +415,12 @@ static void function__show(struct function *func, struct cu *cu)
> > fstats->printed = true;
> >
> > }
> >
> > -static int cu_function_iterator(struct cu *cu, void *cookie)
> > +static int cu_function_iterator(struct cu *cu, void *cookie __maybe_unused)
> > {
> > struct function *function;
> > uint32_t id;
> >
> > cu__for_each_function(cu, id, function) {
> > - if (cookie && strcmp(function__name(function), cookie) != 0)
> > - continue;
> > function__show(function, cu);
> > }
> > return 0;
> > @@ -816,10 +814,9 @@ try_sole_arg_as_function_name:
> > function__show(f, cu);
> > } else if (show_total_inline_expansion_stats)
> > print_total_inline_stats();
> > - else if (function_name != NULL || expand_types)
> > - cus__for_each_cu(cus, cu_function_iterator,
> > - function_name, NULL);
> > - else
> > + else if (expand_types)
> > + cus__for_each_cu(cus, cu_function_iterator, NULL, NULL);
> > + else if (function_name == NULL)
> > print_fn_stats(formatter);
> >
> > rc = EXIT_SUCCESS;
> > --
> > 2.46.2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-09 16:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-30 19:36 [PATCH 1/1] pfunct: Don't print functions twice when using -f Arnaldo Carvalho de Melo
2025-01-02 23:21 ` Ihor Solodrai
2025-01-09 16:02 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox