mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
perf sort: Add dynamic headers for perf report columns
Currently the header string for different columns in perf report is fixed. Some fields of perf sample could have different meaning for different architectures than the meaning conveyed by the header string. An example is the new field 'var2_w' of perf_sample_weight structure. This is presently captured as 'Local INSTR Latency' in perf mem report. But this could be used to denote a different latency cycle in another architecture. Introduce a weak function arch_perf_header_entry() to set the arch specific header string for the fields which can contain dynamic header. If the architecture do not have this function, fall back to the default header string value. Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com> Link: https://lore.kernel.org/r/1616425047-1666-3-git-send-email-atrajeev@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
463a7d5a9e
commit
0a606822c4
@ -427,5 +427,6 @@ char *get_page_size_name(u64 size, char *str);
|
||||
|
||||
void arch_perf_parse_sample_weight(struct perf_sample *data, const __u64 *array, u64 type);
|
||||
void arch_perf_synthesize_sample_weight(const struct perf_sample *data, __u64 *array, u64 type);
|
||||
const char *arch_perf_header_entry(const char *se_header);
|
||||
|
||||
#endif /* __PERF_RECORD_H */
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <traceevent/event-parse.h>
|
||||
#include "mem-events.h"
|
||||
#include "annotate.h"
|
||||
#include "event.h"
|
||||
#include "time-utils.h"
|
||||
#include "cgroup.h"
|
||||
#include "machine.h"
|
||||
@ -45,6 +46,7 @@ const char *field_order;
|
||||
regex_t ignore_callees_regex;
|
||||
int have_ignore_callees = 0;
|
||||
enum sort_mode sort__mode = SORT_MODE__NORMAL;
|
||||
const char *dynamic_headers[] = {"local_ins_lat"};
|
||||
|
||||
/*
|
||||
* Replaces all occurrences of a char used with the:
|
||||
@ -1816,6 +1818,16 @@ struct sort_dimension {
|
||||
int taken;
|
||||
};
|
||||
|
||||
const char * __weak arch_perf_header_entry(const char *se_header)
|
||||
{
|
||||
return se_header;
|
||||
}
|
||||
|
||||
static void sort_dimension_add_dynamic_header(struct sort_dimension *sd)
|
||||
{
|
||||
sd->entry->se_header = arch_perf_header_entry(sd->entry->se_header);
|
||||
}
|
||||
|
||||
#define DIM(d, n, func) [d] = { .name = n, .entry = &(func) }
|
||||
|
||||
static struct sort_dimension common_sort_dimensions[] = {
|
||||
@ -2739,7 +2751,7 @@ int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
|
||||
struct evlist *evlist,
|
||||
int level)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int i, j;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(common_sort_dimensions); i++) {
|
||||
struct sort_dimension *sd = &common_sort_dimensions[i];
|
||||
@ -2747,6 +2759,11 @@ int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
|
||||
if (strncasecmp(tok, sd->name, strlen(tok)))
|
||||
continue;
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE(dynamic_headers); j++) {
|
||||
if (!strcmp(dynamic_headers[j], sd->name))
|
||||
sort_dimension_add_dynamic_header(sd);
|
||||
}
|
||||
|
||||
if (sd->entry == &sort_parent) {
|
||||
int ret = regcomp(&parent_regex, parent_pattern, REG_EXTENDED);
|
||||
if (ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user