2019-08-21 21:54:14 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2017-09-01 03:40:31 +08:00
|
|
|
#ifndef METRICGROUP_H
|
|
|
|
#define METRICGROUP_H 1
|
|
|
|
|
2019-08-21 21:54:14 +08:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/rbtree.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
struct evsel;
|
|
|
|
struct option;
|
|
|
|
struct rblist;
|
2017-09-01 03:40:31 +08:00
|
|
|
|
|
|
|
struct metric_event {
|
|
|
|
struct rb_node nd;
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *evsel;
|
2017-09-01 03:40:31 +08:00
|
|
|
struct list_head head; /* list of metric_expr */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct metric_expr {
|
|
|
|
struct list_head nd;
|
|
|
|
const char *metric_expr;
|
|
|
|
const char *metric_name;
|
perf metricgroup: Scale the metric result
Some metrics define the scale unit, such as
{
"BriefDescription": "Intel Optane DC persistent memory read latency (ns). Derived from unc_m_pmm_rpq_occupancy.all",
"Counter": "0,1,2,3",
"EventCode": "0xE0",
"EventName": "UNC_M_PMM_READ_LATENCY",
"MetricExpr": "UNC_M_PMM_RPQ_OCCUPANCY.ALL / UNC_M_PMM_RPQ_INSERTS / UNC_M_CLOCKTICKS",
"MetricName": "UNC_M_PMM_READ_LATENCY",
"PerPkg": "1",
"ScaleUnit": "6000000000ns",
"UMask": "0x1",
"Unit": "iMC"
},
For above example, the ratio should be,
ratio = (UNC_M_PMM_RPQ_OCCUPANCY.ALL / UNC_M_PMM_RPQ_INSERTS / UNC_M_CLOCKTICKS) * 6000000000
But in current code, the ratio is not scaled ( * 6000000000)
With this patch, the ratio is scaled and the unit (ns) is printed.
For example,
# 219.4 ns UNC_M_PMM_READ_LATENCY
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20190828055932.8269-4-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-08-28 13:59:31 +08:00
|
|
|
const char *metric_unit;
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel **metric_events;
|
2017-09-01 03:40:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct metric_event *metricgroup__lookup(struct rblist *metric_events,
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *evsel,
|
2017-09-01 03:40:31 +08:00
|
|
|
bool create);
|
|
|
|
int metricgroup__parse_groups(const struct option *opt,
|
|
|
|
const char *str,
|
|
|
|
struct rblist *metric_events);
|
|
|
|
|
2019-02-13 20:32:41 +08:00
|
|
|
void metricgroup__print(bool metrics, bool groups, char *filter,
|
|
|
|
bool raw, bool details);
|
2018-06-26 15:17:01 +08:00
|
|
|
bool metricgroup__has_metric(const char *metric);
|
2017-09-01 03:40:31 +08:00
|
|
|
#endif
|