parse-events.c (a713ca234ea9d946235ac7248995c5fddfd9e523) parse-events.c (b194c9cd09dd98af76beaa32a041af674260d730)
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>

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

397
398 evsel = __add_event(list, idx, &attr, /*init_attr=*/true, /*name=*/NULL,
399 /*metric_id=*/NULL, /*pmu=*/NULL,
400 /*config_terms=*/NULL, /*auto_merge_stats=*/false,
401 /*cpu_list=*/"0");
402 if (!evsel)
403 return -ENOMEM;
404 evsel->tool_event = tool_event;
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>

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

397
398 evsel = __add_event(list, idx, &attr, /*init_attr=*/true, /*name=*/NULL,
399 /*metric_id=*/NULL, /*pmu=*/NULL,
400 /*config_terms=*/NULL, /*auto_merge_stats=*/false,
401 /*cpu_list=*/"0");
402 if (!evsel)
403 return -ENOMEM;
404 evsel->tool_event = tool_event;
405 if (tool_event == PERF_TOOL_DURATION_TIME)
406 evsel->unit = "ns";
405 if (tool_event == PERF_TOOL_DURATION_TIME) {
406 free((char *)evsel->unit);
407 evsel->unit = strdup("ns");
408 }
407 return 0;
408}
409
410static int parse_aliases(char *str, const char *names[][EVSEL__MAX_ALIASES], int size)
411{
412 int i, j;
413 int n, longest = -1;
414

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

1625
1626 evsel->pmu_name = name ? strdup(name) : NULL;
1627 evsel->use_uncore_alias = use_uncore_alias;
1628 evsel->percore = config_term_percore(&evsel->config_terms);
1629
1630 if (parse_state->fake_pmu)
1631 return 0;
1632
409 return 0;
410}
411
412static int parse_aliases(char *str, const char *names[][EVSEL__MAX_ALIASES], int size)
413{
414 int i, j;
415 int n, longest = -1;
416

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

1627
1628 evsel->pmu_name = name ? strdup(name) : NULL;
1629 evsel->use_uncore_alias = use_uncore_alias;
1630 evsel->percore = config_term_percore(&evsel->config_terms);
1631
1632 if (parse_state->fake_pmu)
1633 return 0;
1634
1633 evsel->unit = info.unit;
1635 free((char *)evsel->unit);
1636 evsel->unit = strdup(info.unit);
1634 evsel->scale = info.scale;
1635 evsel->per_pkg = info.per_pkg;
1636 evsel->snapshot = info.snapshot;
1637 evsel->metric_expr = info.metric_expr;
1638 evsel->metric_name = info.metric_name;
1639 return 0;
1640}
1641

--- 1763 unchanged lines hidden ---
1637 evsel->scale = info.scale;
1638 evsel->per_pkg = info.per_pkg;
1639 evsel->snapshot = info.snapshot;
1640 evsel->metric_expr = info.metric_expr;
1641 evsel->metric_name = info.metric_name;
1642 return 0;
1643}
1644

--- 1763 unchanged lines hidden ---