Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+29 -37
+2 -3
tools/perf/tests/evsel-roundtrip-name.c
··· 100 100 { 101 101 int err = 0, ret = 0; 102 102 103 - err = perf_evsel__name_array_test(perf_evsel__hw_names); 103 + err = perf_evsel__name_array_test(evsel__hw_names); 104 104 if (err) 105 105 ret = err; 106 106 107 - err = __perf_evsel__name_array_test(perf_evsel__sw_names, 108 - PERF_COUNT_SW_DUMMY + 1); 107 + err = __perf_evsel__name_array_test(evsel__sw_names, PERF_COUNT_SW_DUMMY + 1); 109 108 if (err) 110 109 ret = err; 111 110
+16 -19
tools/perf/util/evsel.c
··· 371 371 return ERR_PTR(err); 372 372 } 373 373 374 - const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX] = { 374 + const char *evsel__hw_names[PERF_COUNT_HW_MAX] = { 375 375 "cycles", 376 376 "instructions", 377 377 "cache-references", ··· 386 386 387 387 static const char *__evsel__hw_name(u64 config) 388 388 { 389 - if (config < PERF_COUNT_HW_MAX && perf_evsel__hw_names[config]) 390 - return perf_evsel__hw_names[config]; 389 + if (config < PERF_COUNT_HW_MAX && evsel__hw_names[config]) 390 + return evsel__hw_names[config]; 391 391 392 392 return "unknown-hardware"; 393 393 } ··· 434 434 return r + perf_evsel__add_modifiers(evsel, bf + r, size - r); 435 435 } 436 436 437 - const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX] = { 437 + const char *evsel__sw_names[PERF_COUNT_SW_MAX] = { 438 438 "cpu-clock", 439 439 "task-clock", 440 440 "page-faults", ··· 449 449 450 450 static const char *__evsel__sw_name(u64 config) 451 451 { 452 - if (config < PERF_COUNT_SW_MAX && perf_evsel__sw_names[config]) 453 - return perf_evsel__sw_names[config]; 452 + if (config < PERF_COUNT_SW_MAX && evsel__sw_names[config]) 453 + return evsel__sw_names[config]; 454 454 return "unknown-software"; 455 455 } 456 456 ··· 485 485 return r + perf_evsel__add_modifiers(evsel, bf + r, size - r); 486 486 } 487 487 488 - const char *perf_evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX] 489 - [PERF_EVSEL__MAX_ALIASES] = { 488 + const char *evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX][EVSEL__MAX_ALIASES] = { 490 489 { "L1-dcache", "l1-d", "l1d", "L1-data", }, 491 490 { "L1-icache", "l1-i", "l1i", "L1-instruction", }, 492 491 { "LLC", "L2", }, ··· 495 496 { "node", }, 496 497 }; 497 498 498 - const char *perf_evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX] 499 - [PERF_EVSEL__MAX_ALIASES] = { 499 + const char *evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX][EVSEL__MAX_ALIASES] = { 500 500 { "load", "loads", "read", }, 501 501 { "store", "stores", "write", }, 502 502 { "prefetch", "prefetches", "speculative-read", "speculative-load", }, 503 503 }; 504 504 505 - const char *perf_evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX] 506 - [PERF_EVSEL__MAX_ALIASES] = { 505 + const char *evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX][EVSEL__MAX_ALIASES] = { 507 506 { "refs", "Reference", "ops", "access", }, 508 507 { "misses", "miss", }, 509 508 }; ··· 517 520 * L1I : Read and prefetch only 518 521 * ITLB and BPU : Read-only 519 522 */ 520 - static unsigned long perf_evsel__hw_cache_stat[C(MAX)] = { 523 + static unsigned long evsel__hw_cache_stat[C(MAX)] = { 521 524 [C(L1D)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH), 522 525 [C(L1I)] = (CACHE_READ | CACHE_PREFETCH), 523 526 [C(LL)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH), ··· 529 532 530 533 bool evsel__is_cache_op_valid(u8 type, u8 op) 531 534 { 532 - if (perf_evsel__hw_cache_stat[type] & COP(op)) 535 + if (evsel__hw_cache_stat[type] & COP(op)) 533 536 return true; /* valid */ 534 537 else 535 538 return false; /* invalid */ ··· 538 541 int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size) 539 542 { 540 543 if (result) { 541 - return scnprintf(bf, size, "%s-%s-%s", perf_evsel__hw_cache[type][0], 542 - perf_evsel__hw_cache_op[op][0], 543 - perf_evsel__hw_cache_result[result][0]); 544 + return scnprintf(bf, size, "%s-%s-%s", evsel__hw_cache[type][0], 545 + evsel__hw_cache_op[op][0], 546 + evsel__hw_cache_result[result][0]); 544 547 } 545 548 546 - return scnprintf(bf, size, "%s-%s", perf_evsel__hw_cache[type][0], 547 - perf_evsel__hw_cache_op[op][1]); 549 + return scnprintf(bf, size, "%s-%s", evsel__hw_cache[type][0], 550 + evsel__hw_cache_op[op][1]); 548 551 } 549 552 550 553 static int __evsel__hw_cache_name(u64 config, char *bf, size_t size)
+6 -9
tools/perf/util/evsel.h
··· 198 198 199 199 bool evsel__is_cache_op_valid(u8 type, u8 op); 200 200 201 - #define PERF_EVSEL__MAX_ALIASES 8 201 + #define EVSEL__MAX_ALIASES 8 202 202 203 - extern const char *perf_evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX] 204 - [PERF_EVSEL__MAX_ALIASES]; 205 - extern const char *perf_evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX] 206 - [PERF_EVSEL__MAX_ALIASES]; 207 - extern const char *perf_evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX] 208 - [PERF_EVSEL__MAX_ALIASES]; 209 - extern const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX]; 210 - extern const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX]; 203 + extern const char *evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX][EVSEL__MAX_ALIASES]; 204 + extern const char *evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX][EVSEL__MAX_ALIASES]; 205 + extern const char *evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX][EVSEL__MAX_ALIASES]; 206 + extern const char *evsel__hw_names[PERF_COUNT_HW_MAX]; 207 + extern const char *evsel__sw_names[PERF_COUNT_SW_MAX]; 211 208 int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size); 212 209 const char *evsel__name(struct evsel *evsel); 213 210
+5 -6
tools/perf/util/parse-events.c
··· 399 399 return 0; 400 400 } 401 401 402 - static int parse_aliases(char *str, const char *names[][PERF_EVSEL__MAX_ALIASES], int size) 402 + static int parse_aliases(char *str, const char *names[][EVSEL__MAX_ALIASES], int size) 403 403 { 404 404 int i, j; 405 405 int n, longest = -1; 406 406 407 407 for (i = 0; i < size; i++) { 408 - for (j = 0; j < PERF_EVSEL__MAX_ALIASES && names[i][j]; j++) { 408 + for (j = 0; j < EVSEL__MAX_ALIASES && names[i][j]; j++) { 409 409 n = strlen(names[i][j]); 410 410 if (n > longest && !strncasecmp(str, names[i][j], n)) 411 411 longest = n; ··· 444 444 * No fallback - if we cannot get a clear cache type 445 445 * then bail out: 446 446 */ 447 - cache_type = parse_aliases(type, perf_evsel__hw_cache, 448 - PERF_COUNT_HW_CACHE_MAX); 447 + cache_type = parse_aliases(type, evsel__hw_cache, PERF_COUNT_HW_CACHE_MAX); 449 448 if (cache_type == -1) 450 449 return -EINVAL; 451 450 ··· 457 458 n += snprintf(name + n, MAX_NAME_LEN - n, "-%s", str); 458 459 459 460 if (cache_op == -1) { 460 - cache_op = parse_aliases(str, perf_evsel__hw_cache_op, 461 + cache_op = parse_aliases(str, evsel__hw_cache_op, 461 462 PERF_COUNT_HW_CACHE_OP_MAX); 462 463 if (cache_op >= 0) { 463 464 if (!evsel__is_cache_op_valid(cache_type, cache_op)) ··· 467 468 } 468 469 469 470 if (cache_result == -1) { 470 - cache_result = parse_aliases(str, perf_evsel__hw_cache_result, 471 + cache_result = parse_aliases(str, evsel__hw_cache_result, 471 472 PERF_COUNT_HW_CACHE_RESULT_MAX); 472 473 if (cache_result >= 0) 473 474 continue;