forked from luck/tmp_suning_uos_patched
perf evsel: Rename perf_evsel__[hs]w_cache* to evsel__[hs]w_cache*
As those are 'struct evsel' methods, not part of tools/lib/perf/, aka libperf, to whom the perf_ prefix belongs. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
8f6725a2c9
commit
c64e85e14b
|
@ -100,12 +100,11 @@ int test__perf_evsel__roundtrip_name_test(struct test *test __maybe_unused, int
|
||||||
{
|
{
|
||||||
int err = 0, ret = 0;
|
int err = 0, ret = 0;
|
||||||
|
|
||||||
err = perf_evsel__name_array_test(perf_evsel__hw_names);
|
err = perf_evsel__name_array_test(evsel__hw_names);
|
||||||
if (err)
|
if (err)
|
||||||
ret = err;
|
ret = err;
|
||||||
|
|
||||||
err = __perf_evsel__name_array_test(perf_evsel__sw_names,
|
err = __perf_evsel__name_array_test(evsel__sw_names, PERF_COUNT_SW_DUMMY + 1);
|
||||||
PERF_COUNT_SW_DUMMY + 1);
|
|
||||||
if (err)
|
if (err)
|
||||||
ret = err;
|
ret = err;
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ struct evsel *evsel__newtp_idx(const char *sys, const char *name, int idx)
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX] = {
|
const char *evsel__hw_names[PERF_COUNT_HW_MAX] = {
|
||||||
"cycles",
|
"cycles",
|
||||||
"instructions",
|
"instructions",
|
||||||
"cache-references",
|
"cache-references",
|
||||||
|
@ -386,8 +386,8 @@ const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX] = {
|
||||||
|
|
||||||
static const char *__evsel__hw_name(u64 config)
|
static const char *__evsel__hw_name(u64 config)
|
||||||
{
|
{
|
||||||
if (config < PERF_COUNT_HW_MAX && perf_evsel__hw_names[config])
|
if (config < PERF_COUNT_HW_MAX && evsel__hw_names[config])
|
||||||
return perf_evsel__hw_names[config];
|
return evsel__hw_names[config];
|
||||||
|
|
||||||
return "unknown-hardware";
|
return "unknown-hardware";
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ static int evsel__hw_name(struct evsel *evsel, char *bf, size_t size)
|
||||||
return r + perf_evsel__add_modifiers(evsel, bf + r, size - r);
|
return r + perf_evsel__add_modifiers(evsel, bf + r, size - r);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX] = {
|
const char *evsel__sw_names[PERF_COUNT_SW_MAX] = {
|
||||||
"cpu-clock",
|
"cpu-clock",
|
||||||
"task-clock",
|
"task-clock",
|
||||||
"page-faults",
|
"page-faults",
|
||||||
|
@ -449,8 +449,8 @@ const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX] = {
|
||||||
|
|
||||||
static const char *__evsel__sw_name(u64 config)
|
static const char *__evsel__sw_name(u64 config)
|
||||||
{
|
{
|
||||||
if (config < PERF_COUNT_SW_MAX && perf_evsel__sw_names[config])
|
if (config < PERF_COUNT_SW_MAX && evsel__sw_names[config])
|
||||||
return perf_evsel__sw_names[config];
|
return evsel__sw_names[config];
|
||||||
return "unknown-software";
|
return "unknown-software";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,8 +485,7 @@ static int evsel__bp_name(struct evsel *evsel, char *bf, size_t size)
|
||||||
return r + perf_evsel__add_modifiers(evsel, bf + r, size - r);
|
return r + perf_evsel__add_modifiers(evsel, bf + r, size - r);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *perf_evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX]
|
const char *evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX][EVSEL__MAX_ALIASES] = {
|
||||||
[PERF_EVSEL__MAX_ALIASES] = {
|
|
||||||
{ "L1-dcache", "l1-d", "l1d", "L1-data", },
|
{ "L1-dcache", "l1-d", "l1d", "L1-data", },
|
||||||
{ "L1-icache", "l1-i", "l1i", "L1-instruction", },
|
{ "L1-icache", "l1-i", "l1i", "L1-instruction", },
|
||||||
{ "LLC", "L2", },
|
{ "LLC", "L2", },
|
||||||
|
@ -496,15 +495,13 @@ const char *perf_evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX]
|
||||||
{ "node", },
|
{ "node", },
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *perf_evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX]
|
const char *evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX][EVSEL__MAX_ALIASES] = {
|
||||||
[PERF_EVSEL__MAX_ALIASES] = {
|
|
||||||
{ "load", "loads", "read", },
|
{ "load", "loads", "read", },
|
||||||
{ "store", "stores", "write", },
|
{ "store", "stores", "write", },
|
||||||
{ "prefetch", "prefetches", "speculative-read", "speculative-load", },
|
{ "prefetch", "prefetches", "speculative-read", "speculative-load", },
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *perf_evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX]
|
const char *evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX][EVSEL__MAX_ALIASES] = {
|
||||||
[PERF_EVSEL__MAX_ALIASES] = {
|
|
||||||
{ "refs", "Reference", "ops", "access", },
|
{ "refs", "Reference", "ops", "access", },
|
||||||
{ "misses", "miss", },
|
{ "misses", "miss", },
|
||||||
};
|
};
|
||||||
|
@ -520,7 +517,7 @@ const char *perf_evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX]
|
||||||
* L1I : Read and prefetch only
|
* L1I : Read and prefetch only
|
||||||
* ITLB and BPU : Read-only
|
* ITLB and BPU : Read-only
|
||||||
*/
|
*/
|
||||||
static unsigned long perf_evsel__hw_cache_stat[C(MAX)] = {
|
static unsigned long evsel__hw_cache_stat[C(MAX)] = {
|
||||||
[C(L1D)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
|
[C(L1D)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
|
||||||
[C(L1I)] = (CACHE_READ | CACHE_PREFETCH),
|
[C(L1I)] = (CACHE_READ | CACHE_PREFETCH),
|
||||||
[C(LL)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
|
[C(LL)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
|
||||||
|
@ -532,7 +529,7 @@ static unsigned long perf_evsel__hw_cache_stat[C(MAX)] = {
|
||||||
|
|
||||||
bool evsel__is_cache_op_valid(u8 type, u8 op)
|
bool evsel__is_cache_op_valid(u8 type, u8 op)
|
||||||
{
|
{
|
||||||
if (perf_evsel__hw_cache_stat[type] & COP(op))
|
if (evsel__hw_cache_stat[type] & COP(op))
|
||||||
return true; /* valid */
|
return true; /* valid */
|
||||||
else
|
else
|
||||||
return false; /* invalid */
|
return false; /* invalid */
|
||||||
|
@ -541,13 +538,13 @@ bool evsel__is_cache_op_valid(u8 type, u8 op)
|
||||||
int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size)
|
int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size)
|
||||||
{
|
{
|
||||||
if (result) {
|
if (result) {
|
||||||
return scnprintf(bf, size, "%s-%s-%s", perf_evsel__hw_cache[type][0],
|
return scnprintf(bf, size, "%s-%s-%s", evsel__hw_cache[type][0],
|
||||||
perf_evsel__hw_cache_op[op][0],
|
evsel__hw_cache_op[op][0],
|
||||||
perf_evsel__hw_cache_result[result][0]);
|
evsel__hw_cache_result[result][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return scnprintf(bf, size, "%s-%s", perf_evsel__hw_cache[type][0],
|
return scnprintf(bf, size, "%s-%s", evsel__hw_cache[type][0],
|
||||||
perf_evsel__hw_cache_op[op][1]);
|
evsel__hw_cache_op[op][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __evsel__hw_cache_name(u64 config, char *bf, size_t size)
|
static int __evsel__hw_cache_name(u64 config, char *bf, size_t size)
|
||||||
|
|
|
@ -198,16 +198,13 @@ void evsel__calc_id_pos(struct evsel *evsel);
|
||||||
|
|
||||||
bool evsel__is_cache_op_valid(u8 type, u8 op);
|
bool evsel__is_cache_op_valid(u8 type, u8 op);
|
||||||
|
|
||||||
#define PERF_EVSEL__MAX_ALIASES 8
|
#define EVSEL__MAX_ALIASES 8
|
||||||
|
|
||||||
extern const char *perf_evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX]
|
extern const char *evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX][EVSEL__MAX_ALIASES];
|
||||||
[PERF_EVSEL__MAX_ALIASES];
|
extern const char *evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX][EVSEL__MAX_ALIASES];
|
||||||
extern const char *perf_evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX]
|
extern const char *evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX][EVSEL__MAX_ALIASES];
|
||||||
[PERF_EVSEL__MAX_ALIASES];
|
extern const char *evsel__hw_names[PERF_COUNT_HW_MAX];
|
||||||
extern const char *perf_evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX]
|
extern const char *evsel__sw_names[PERF_COUNT_SW_MAX];
|
||||||
[PERF_EVSEL__MAX_ALIASES];
|
|
||||||
extern const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX];
|
|
||||||
extern const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX];
|
|
||||||
int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size);
|
int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size);
|
||||||
const char *evsel__name(struct evsel *evsel);
|
const char *evsel__name(struct evsel *evsel);
|
||||||
|
|
||||||
|
|
|
@ -399,13 +399,13 @@ static int add_event_tool(struct list_head *list, int *idx,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_aliases(char *str, const char *names[][PERF_EVSEL__MAX_ALIASES], int size)
|
static int parse_aliases(char *str, const char *names[][EVSEL__MAX_ALIASES], int size)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int n, longest = -1;
|
int n, longest = -1;
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
for (j = 0; j < PERF_EVSEL__MAX_ALIASES && names[i][j]; j++) {
|
for (j = 0; j < EVSEL__MAX_ALIASES && names[i][j]; j++) {
|
||||||
n = strlen(names[i][j]);
|
n = strlen(names[i][j]);
|
||||||
if (n > longest && !strncasecmp(str, names[i][j], n))
|
if (n > longest && !strncasecmp(str, names[i][j], n))
|
||||||
longest = n;
|
longest = n;
|
||||||
|
@ -444,8 +444,7 @@ int parse_events_add_cache(struct list_head *list, int *idx,
|
||||||
* No fallback - if we cannot get a clear cache type
|
* No fallback - if we cannot get a clear cache type
|
||||||
* then bail out:
|
* then bail out:
|
||||||
*/
|
*/
|
||||||
cache_type = parse_aliases(type, perf_evsel__hw_cache,
|
cache_type = parse_aliases(type, evsel__hw_cache, PERF_COUNT_HW_CACHE_MAX);
|
||||||
PERF_COUNT_HW_CACHE_MAX);
|
|
||||||
if (cache_type == -1)
|
if (cache_type == -1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -458,7 +457,7 @@ int parse_events_add_cache(struct list_head *list, int *idx,
|
||||||
n += snprintf(name + n, MAX_NAME_LEN - n, "-%s", str);
|
n += snprintf(name + n, MAX_NAME_LEN - n, "-%s", str);
|
||||||
|
|
||||||
if (cache_op == -1) {
|
if (cache_op == -1) {
|
||||||
cache_op = parse_aliases(str, perf_evsel__hw_cache_op,
|
cache_op = parse_aliases(str, evsel__hw_cache_op,
|
||||||
PERF_COUNT_HW_CACHE_OP_MAX);
|
PERF_COUNT_HW_CACHE_OP_MAX);
|
||||||
if (cache_op >= 0) {
|
if (cache_op >= 0) {
|
||||||
if (!evsel__is_cache_op_valid(cache_type, cache_op))
|
if (!evsel__is_cache_op_valid(cache_type, cache_op))
|
||||||
|
@ -468,7 +467,7 @@ int parse_events_add_cache(struct list_head *list, int *idx,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache_result == -1) {
|
if (cache_result == -1) {
|
||||||
cache_result = parse_aliases(str, perf_evsel__hw_cache_result,
|
cache_result = parse_aliases(str, evsel__hw_cache_result,
|
||||||
PERF_COUNT_HW_CACHE_RESULT_MAX);
|
PERF_COUNT_HW_CACHE_RESULT_MAX);
|
||||||
if (cache_result >= 0)
|
if (cache_result >= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user