mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 13:58:46 +00:00
4d61aef93d
Document the data structures maintained by metricgroup.c and used by stat-shadow.c for metric output. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Andi Kleen <ak@linux.intel.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Antonov <alexander.antonov@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andrew Kilroy <andrew.kilroy@arm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Changbin Du <changbin.du@intel.com> Cc: Denys Zagorui <dzagorui@cisco.com> Cc: Fabian Hemmer <copy@copy.sh> Cc: Felix Fietkau <nbd@nbd.name> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jacob Keller <jacob.e.keller@intel.com> Cc: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Joakim Zhang <qiangqing.zhang@nxp.com> Cc: John Garry <john.garry@huawei.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Kees Kook <keescook@chromium.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nicholas Fraser <nfraser@codeweavers.com> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Paul Clarke <pc@us.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Riccardo Mancini <rickyman7@gmail.com> Cc: Sami Tolvanen <samitolvanen@google.com> Cc: ShihCheng Tu <mrtoastcheng@gmail.com> Cc: Song Liu <songliubraving@fb.com> Cc: Stephane Eranian <eranian@google.com> Cc: Sumanth Korikkar <sumanthk@linux.ibm.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Wan Jiabing <wanjiabing@vivo.com> Cc: Zhen Lei <thunder.leizhen@huawei.com> Link: https://lore.kernel.org/r/20211015172132.1162559-11-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
92 lines
3.0 KiB
C
92 lines
3.0 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
#ifndef METRICGROUP_H
|
|
#define METRICGROUP_H 1
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/rbtree.h>
|
|
#include <stdbool.h>
|
|
#include "pmu-events/pmu-events.h"
|
|
|
|
struct evlist;
|
|
struct evsel;
|
|
struct option;
|
|
struct rblist;
|
|
struct pmu_events_map;
|
|
struct cgroup;
|
|
|
|
/**
|
|
* A node in a rblist keyed by the evsel. The global rblist of metric events
|
|
* generally exists in perf_stat_config. The evsel is looked up in the rblist
|
|
* yielding a list of metric_expr.
|
|
*/
|
|
struct metric_event {
|
|
struct rb_node nd;
|
|
struct evsel *evsel;
|
|
struct list_head head; /* list of metric_expr */
|
|
};
|
|
|
|
/**
|
|
* A metric referenced by a metric_expr. When parsing a metric expression IDs
|
|
* will be looked up, matching either a value (from metric_events) or a
|
|
* metric_ref. A metric_ref will then be parsed recursively. The metric_refs and
|
|
* metric_events need to be known before parsing so that their values may be
|
|
* placed in the parse context for lookup.
|
|
*/
|
|
struct metric_ref {
|
|
const char *metric_name;
|
|
const char *metric_expr;
|
|
};
|
|
|
|
/**
|
|
* One in a list of metric_expr associated with an evsel. The data is used to
|
|
* generate a metric value during stat output.
|
|
*/
|
|
struct metric_expr {
|
|
struct list_head nd;
|
|
/** The expression to parse, for example, "instructions/cycles". */
|
|
const char *metric_expr;
|
|
/** The name of the meric such as "IPC". */
|
|
const char *metric_name;
|
|
/**
|
|
* The "ScaleUnit" that scales and adds a unit to the metric during
|
|
* output. For example, "6.4e-05MiB" means to scale the resulting metric
|
|
* by 6.4e-05 (typically converting a unit like cache lines to something
|
|
* more human intelligible) and then add "MiB" afterward when displayed.
|
|
*/
|
|
const char *metric_unit;
|
|
/** Null terminated array of events used by the metric. */
|
|
struct evsel **metric_events;
|
|
/** Null terminated array of referenced metrics. */
|
|
struct metric_ref *metric_refs;
|
|
/** A value substituted for '?' during parsing. */
|
|
int runtime;
|
|
};
|
|
|
|
struct metric_event *metricgroup__lookup(struct rblist *metric_events,
|
|
struct evsel *evsel,
|
|
bool create);
|
|
int metricgroup__parse_groups(const struct option *opt,
|
|
const char *str,
|
|
bool metric_no_group,
|
|
bool metric_no_merge,
|
|
struct rblist *metric_events);
|
|
const struct pmu_event *metricgroup__find_metric(const char *metric,
|
|
const struct pmu_events_map *map);
|
|
int metricgroup__parse_groups_test(struct evlist *evlist,
|
|
const struct pmu_events_map *map,
|
|
const char *str,
|
|
bool metric_no_group,
|
|
bool metric_no_merge,
|
|
struct rblist *metric_events);
|
|
|
|
void metricgroup__print(bool metrics, bool groups, char *filter,
|
|
bool raw, bool details);
|
|
bool metricgroup__has_metric(const char *metric);
|
|
int arch_get_runtimeparam(const struct pmu_event *pe __maybe_unused);
|
|
void metricgroup__rblist_exit(struct rblist *metric_events);
|
|
|
|
int metricgroup__copy_metric_events(struct evlist *evlist, struct cgroup *cgrp,
|
|
struct rblist *new_metric_events,
|
|
struct rblist *old_metric_events);
|
|
#endif
|