parse-events.c (6870112c46c867f50cd27570860a05bd82614b5c) parse-events.c (387ad33fe710758a8e1b860819a7452bceb4329a)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/hw_breakpoint.h>
3#include <linux/err.h>
4#include <linux/zalloc.h>
5#include <dirent.h>
6#include <errno.h>
7#include <sys/ioctl.h>
8#include <sys/types.h>

--- 1436 unchanged lines hidden (view full) ---

1445
1446 list_for_each_entry(term, head_config, list) {
1447 fprintf(stderr, "%s,", term->config);
1448 }
1449 }
1450 fprintf(stderr, "' that may result in non-fatal errors\n");
1451 }
1452
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/hw_breakpoint.h>
3#include <linux/err.h>
4#include <linux/zalloc.h>
5#include <dirent.h>
6#include <errno.h>
7#include <sys/ioctl.h>
8#include <sys/types.h>

--- 1436 unchanged lines hidden (view full) ---

1445
1446 list_for_each_entry(term, head_config, list) {
1447 fprintf(stderr, "%s,", term->config);
1448 }
1449 }
1450 fprintf(stderr, "' that may result in non-fatal errors\n");
1451 }
1452
1453 pmu = perf_pmu__find(name);
1453 pmu = parse_state->fake_pmu ?: perf_pmu__find(name);
1454 if (!pmu) {
1455 char *err_str;
1456
1457 if (asprintf(&err_str,
1458 "Cannot find PMU `%s'. Missing kernel support?",
1459 name) >= 0)
1460 parse_events__handle_error(err, 0, err_str, NULL);
1461 return -EINVAL;

--- 16 unchanged lines hidden (view full) ---

1478 evsel->pmu_name = name ? strdup(name) : NULL;
1479 evsel->use_uncore_alias = use_uncore_alias;
1480 return 0;
1481 } else {
1482 return -ENOMEM;
1483 }
1484 }
1485
1454 if (!pmu) {
1455 char *err_str;
1456
1457 if (asprintf(&err_str,
1458 "Cannot find PMU `%s'. Missing kernel support?",
1459 name) >= 0)
1460 parse_events__handle_error(err, 0, err_str, NULL);
1461 return -EINVAL;

--- 16 unchanged lines hidden (view full) ---

1478 evsel->pmu_name = name ? strdup(name) : NULL;
1479 evsel->use_uncore_alias = use_uncore_alias;
1480 return 0;
1481 } else {
1482 return -ENOMEM;
1483 }
1484 }
1485
1486 if (perf_pmu__check_alias(pmu, head_config, &info))
1486 if (!parse_state->fake_pmu && perf_pmu__check_alias(pmu, head_config, &info))
1487 return -EINVAL;
1488
1489 if (verbose > 1) {
1490 fprintf(stderr, "After aliases, add event pmu '%s' with '",
1491 name);
1492 if (head_config) {
1493 struct parse_events_term *term;
1494

--- 16 unchanged lines hidden (view full) ---

1511
1512 /*
1513 * When using default config, record which bits of attr->config were
1514 * changed by the user.
1515 */
1516 if (pmu->default_config && get_config_chgs(pmu, head_config, &config_terms))
1517 return -ENOMEM;
1518
1487 return -EINVAL;
1488
1489 if (verbose > 1) {
1490 fprintf(stderr, "After aliases, add event pmu '%s' with '",
1491 name);
1492 if (head_config) {
1493 struct parse_events_term *term;
1494

--- 16 unchanged lines hidden (view full) ---

1511
1512 /*
1513 * When using default config, record which bits of attr->config were
1514 * changed by the user.
1515 */
1516 if (pmu->default_config && get_config_chgs(pmu, head_config, &config_terms))
1517 return -ENOMEM;
1518
1519 if (perf_pmu__config(pmu, &attr, head_config, parse_state->error)) {
1519 if (!parse_state->fake_pmu && perf_pmu__config(pmu, &attr, head_config, parse_state->error)) {
1520 struct evsel_config_term *pos, *tmp;
1521
1522 list_for_each_entry_safe(pos, tmp, &config_terms, list) {
1523 list_del_init(&pos->list);
1524 if (pos->free_str)
1525 zfree(&pos->val.str);
1526 free(pos);
1527 }

--- 1585 unchanged lines hidden ---
1520 struct evsel_config_term *pos, *tmp;
1521
1522 list_for_each_entry_safe(pos, tmp, &config_terms, list) {
1523 list_del_init(&pos->list);
1524 if (pos->free_str)
1525 zfree(&pos->val.str);
1526 free(pos);
1527 }

--- 1585 unchanged lines hidden ---