public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf intel-tpebs: Remove duplicate include of stat.h
@ 2026-03-18  3:49 Chen Ni
  2026-03-18 17:33 ` Ian Rogers
  2026-03-19 17:24 ` Namhyung Kim
  0 siblings, 2 replies; 6+ messages in thread
From: Chen Ni @ 2026-03-18  3:49 UTC (permalink / raw)
  To: linux-perf-users
  Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
	jolsa, irogers, adrian.hunter, james.clark, Chen Ni

Remove duplicate inclusion of stat.h in intel-tpebs.c to clean up
redundant code.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 tools/perf/util/intel-tpebs.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/util/intel-tpebs.c b/tools/perf/util/intel-tpebs.c
index 3c958d738ca6..2af5455488b2 100644
--- a/tools/perf/util/intel-tpebs.c
+++ b/tools/perf/util/intel-tpebs.c
@@ -22,7 +22,6 @@
 #include "tool.h"
 #include "cpumap.h"
 #include "metricgroup.h"
-#include "stat.h"
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <errno.h>
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf intel-tpebs: Remove duplicate include of stat.h
  2026-03-18  3:49 [PATCH] perf intel-tpebs: Remove duplicate include of stat.h Chen Ni
@ 2026-03-18 17:33 ` Ian Rogers
  2026-03-18 18:34   ` Namhyung Kim
  2026-03-19 17:24 ` Namhyung Kim
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Rogers @ 2026-03-18 17:33 UTC (permalink / raw)
  To: Chen Ni
  Cc: linux-perf-users, peterz, mingo, acme, namhyung, mark.rutland,
	alexander.shishkin, jolsa, adrian.hunter, james.clark

On Tue, Mar 17, 2026 at 8:54 PM Chen Ni <nichen@iscas.ac.cn> wrote:
>
> Remove duplicate inclusion of stat.h in intel-tpebs.c to clean up
> redundant code.
>
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Reviewed-by: Ian Rogers <irogers@google.com>

We should really have a style for #includes and try to get it into the
kernel coding style. It doesn't matter so much in the kernel but
inconsistencies abound in tools, and the lack of alphabetical sorting
allows duplicates to occur. Here is a proposal that makes sense:

For any given C source file (e.g., server.c), group your #include
directives into distinct blocks separated by a blank line, ordered as
follows:
 * The Corresponding Header ("server.h")
 * C Standard Library Headers (<stdio.h>, <stdlib.h>)
 * OS/System-Specific Headers (<unistd.h>, <pthread.h>)
 * Third-Party Library Headers (<sqlite3.h>, <jansson.h>)
 * Your Project's Other Headers ("utils/logger.h", "database.h")
Within each block, alphabetize the headers.

Thanks,
Ian

> ---
>  tools/perf/util/intel-tpebs.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/tools/perf/util/intel-tpebs.c b/tools/perf/util/intel-tpebs.c
> index 3c958d738ca6..2af5455488b2 100644
> --- a/tools/perf/util/intel-tpebs.c
> +++ b/tools/perf/util/intel-tpebs.c
> @@ -22,7 +22,6 @@
>  #include "tool.h"
>  #include "cpumap.h"
>  #include "metricgroup.h"
> -#include "stat.h"
>  #include <sys/stat.h>
>  #include <sys/file.h>
>  #include <errno.h>
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf intel-tpebs: Remove duplicate include of stat.h
  2026-03-18 17:33 ` Ian Rogers
@ 2026-03-18 18:34   ` Namhyung Kim
  2026-03-18 18:57     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2026-03-18 18:34 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Chen Ni, linux-perf-users, peterz, mingo, acme, mark.rutland,
	alexander.shishkin, jolsa, adrian.hunter, james.clark

On Wed, Mar 18, 2026 at 10:33:54AM -0700, Ian Rogers wrote:
> On Tue, Mar 17, 2026 at 8:54 PM Chen Ni <nichen@iscas.ac.cn> wrote:
> >
> > Remove duplicate inclusion of stat.h in intel-tpebs.c to clean up
> > redundant code.
> >
> > Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>
> 
> We should really have a style for #includes and try to get it into the
> kernel coding style. It doesn't matter so much in the kernel but
> inconsistencies abound in tools, and the lack of alphabetical sorting
> allows duplicates to occur. Here is a proposal that makes sense:
> 
> For any given C source file (e.g., server.c), group your #include
> directives into distinct blocks separated by a blank line, ordered as
> follows:
>  * The Corresponding Header ("server.h")
>  * C Standard Library Headers (<stdio.h>, <stdlib.h>)
>  * OS/System-Specific Headers (<unistd.h>, <pthread.h>)
>  * Third-Party Library Headers (<sqlite3.h>, <jansson.h>)
>  * Your Project's Other Headers ("utils/logger.h", "database.h")
> Within each block, alphabetize the headers.

Yep, sounds good.  I'm not sure if we want to convert all existing
sources for this.  I think it's good for new changes touching header
inclusion.

Thanks,
Namhyung


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf intel-tpebs: Remove duplicate include of stat.h
  2026-03-18 18:34   ` Namhyung Kim
@ 2026-03-18 18:57     ` Arnaldo Carvalho de Melo
  2026-03-18 20:40       ` Ian Rogers
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-03-18 18:57 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ian Rogers, Chen Ni, linux-perf-users, peterz, mingo,
	mark.rutland, alexander.shishkin, jolsa, adrian.hunter,
	james.clark

On Wed, Mar 18, 2026 at 11:34:46AM -0700, Namhyung Kim wrote:
> On Wed, Mar 18, 2026 at 10:33:54AM -0700, Ian Rogers wrote:
> > On Tue, Mar 17, 2026 at 8:54 PM Chen Ni <nichen@iscas.ac.cn> wrote:
> > >
> > > Remove duplicate inclusion of stat.h in intel-tpebs.c to clean up
> > > redundant code.
> > >
> > > Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> > 
> > Reviewed-by: Ian Rogers <irogers@google.com>
> > 
> > We should really have a style for #includes and try to get it into the
> > kernel coding style. It doesn't matter so much in the kernel but
> > inconsistencies abound in tools, and the lack of alphabetical sorting
> > allows duplicates to occur. Here is a proposal that makes sense:
> > 
> > For any given C source file (e.g., server.c), group your #include
> > directives into distinct blocks separated by a blank line, ordered as
> > follows:
> >  * The Corresponding Header ("server.h")
> >  * C Standard Library Headers (<stdio.h>, <stdlib.h>)
> >  * OS/System-Specific Headers (<unistd.h>, <pthread.h>)
> >  * Third-Party Library Headers (<sqlite3.h>, <jansson.h>)
> >  * Your Project's Other Headers ("utils/logger.h", "database.h")
> > Within each block, alphabetize the headers.
> 
> Yep, sounds good.  I'm not sure if we want to convert all existing
> sources for this.  I think it's good for new changes touching header
> inclusion.

And then there are cases where there are ordering dependencies, which I
can't recall one to give as an example right now but I come accross in
the past.

So perhaps this should be made as a recommendation and when we have the
opportunity we change?

Just going thru lots of churn to have it look polished seems overkill
:-\

- Arnaldo
 
> Thanks,
> Namhyung

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf intel-tpebs: Remove duplicate include of stat.h
  2026-03-18 18:57     ` Arnaldo Carvalho de Melo
@ 2026-03-18 20:40       ` Ian Rogers
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2026-03-18 20:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Chen Ni, linux-perf-users, peterz, mingo,
	mark.rutland, alexander.shishkin, jolsa, adrian.hunter,
	james.clark

On Wed, Mar 18, 2026 at 11:57 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> On Wed, Mar 18, 2026 at 11:34:46AM -0700, Namhyung Kim wrote:
> > On Wed, Mar 18, 2026 at 10:33:54AM -0700, Ian Rogers wrote:
> > > On Tue, Mar 17, 2026 at 8:54 PM Chen Ni <nichen@iscas.ac.cn> wrote:
> > > >
> > > > Remove duplicate inclusion of stat.h in intel-tpebs.c to clean up
> > > > redundant code.
> > > >
> > > > Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> > >
> > > Reviewed-by: Ian Rogers <irogers@google.com>
> > >
> > > We should really have a style for #includes and try to get it into the
> > > kernel coding style. It doesn't matter so much in the kernel but
> > > inconsistencies abound in tools, and the lack of alphabetical sorting
> > > allows duplicates to occur. Here is a proposal that makes sense:
> > >
> > > For any given C source file (e.g., server.c), group your #include
> > > directives into distinct blocks separated by a blank line, ordered as
> > > follows:
> > >  * The Corresponding Header ("server.h")
> > >  * C Standard Library Headers (<stdio.h>, <stdlib.h>)
> > >  * OS/System-Specific Headers (<unistd.h>, <pthread.h>)
> > >  * Third-Party Library Headers (<sqlite3.h>, <jansson.h>)
> > >  * Your Project's Other Headers ("utils/logger.h", "database.h")
> > > Within each block, alphabetize the headers.
> >
> > Yep, sounds good.  I'm not sure if we want to convert all existing
> > sources for this.  I think it's good for new changes touching header
> > inclusion.
>
> And then there are cases where there are ordering dependencies, which I
> can't recall one to give as an example right now but I come accross in
> the past.
>
> So perhaps this should be made as a recommendation and when we have the
> opportunity we change?

The issue I normally face is adding 1 header file include. Should
there be 1 patch to sort/fix the headers, followed by a second patch
that adds the new header and feature? A problem with the sorting
patches is that they are prone to merge conflicts. Then the feature
landing gates doing the clean up. It may be worth cleaning up and
accepting the pain as a one-time event.

Thanks,
Ian

> Just going thru lots of churn to have it look polished seems overkill
> :-\
>
> - Arnaldo
>
> > Thanks,
> > Namhyung

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf intel-tpebs: Remove duplicate include of stat.h
  2026-03-18  3:49 [PATCH] perf intel-tpebs: Remove duplicate include of stat.h Chen Ni
  2026-03-18 17:33 ` Ian Rogers
@ 2026-03-19 17:24 ` Namhyung Kim
  1 sibling, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2026-03-19 17:24 UTC (permalink / raw)
  To: linux-perf-users, Chen Ni
  Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	irogers, adrian.hunter, james.clark

On Wed, 18 Mar 2026 11:49:32 +0800, Chen Ni wrote:

> Remove duplicate inclusion of stat.h in intel-tpebs.c to clean up
> redundant code.
> 
> 

Applied to perf-tools-next, thanks!

Best regards,
Namhyung


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-19 17:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18  3:49 [PATCH] perf intel-tpebs: Remove duplicate include of stat.h Chen Ni
2026-03-18 17:33 ` Ian Rogers
2026-03-18 18:34   ` Namhyung Kim
2026-03-18 18:57     ` Arnaldo Carvalho de Melo
2026-03-18 20:40       ` Ian Rogers
2026-03-19 17:24 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox