-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The group.h/c only include TopDown group related functions. The name "group" is too generic and inaccurate. Use the name "topdown" to replace it. Move topdown related functions to a dedicated file, topdown.c. Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20200911144808.27603-2-kan.liang@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Kan Liang
authored and
Arnaldo Carvalho de Melo
committed
Sep 17, 2020
1 parent
c57f5ea
commit 687986b
Showing
6 changed files
with
61 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tools/perf/arch/x86/util/group.c → tools/perf/arch/x86/util/topdown.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
#include <stdio.h> | ||
#include "pmu.h" | ||
#include "topdown.h" | ||
|
||
int topdown_filter_events(const char **attr, char **str, bool use_group) | ||
{ | ||
int off = 0; | ||
int i; | ||
int len = 0; | ||
char *s; | ||
|
||
for (i = 0; attr[i]; i++) { | ||
if (pmu_have_event("cpu", attr[i])) { | ||
len += strlen(attr[i]) + 1; | ||
attr[i - off] = attr[i]; | ||
} else | ||
off++; | ||
} | ||
attr[i - off] = NULL; | ||
|
||
*str = malloc(len + 1 + 2); | ||
if (!*str) | ||
return -1; | ||
s = *str; | ||
if (i - off == 0) { | ||
*s = 0; | ||
return 0; | ||
} | ||
if (use_group) | ||
*s++ = '{'; | ||
for (i = 0; attr[i]; i++) { | ||
strcpy(s, attr[i]); | ||
s += strlen(s); | ||
*s++ = ','; | ||
} | ||
if (use_group) { | ||
s[-1] = '}'; | ||
*s = 0; | ||
} else | ||
s[-1] = 0; | ||
return 0; | ||
} | ||
|
||
__weak bool arch_topdown_check_group(bool *warn) | ||
{ | ||
*warn = false; | ||
return false; | ||
} | ||
|
||
__weak void arch_topdown_group_warn(void) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef GROUP_H | ||
#define GROUP_H 1 | ||
#ifndef TOPDOWN_H | ||
#define TOPDOWN_H 1 | ||
|
||
bool arch_topdown_check_group(bool *warn); | ||
void arch_topdown_group_warn(void); | ||
|
||
int topdown_filter_events(const char **attr, char **str, bool use_group); | ||
|
||
#endif |