pfm.c (9c3a985f88fa4de82bf4bda906095ce6444e9039) | pfm.c (1eaf496ed386934f1c2439a120fe84a05194f91a) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Support for libpfm4 event encoding. 4 * 5 * Copyright 2020 Google LLC. 6 */ 7#include "util/cpumap.h" 8#include "util/debug.h" 9#include "util/event.h" 10#include "util/evlist.h" 11#include "util/evsel.h" 12#include "util/parse-events.h" | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Support for libpfm4 event encoding. 4 * 5 * Copyright 2020 Google LLC. 6 */ 7#include "util/cpumap.h" 8#include "util/debug.h" 9#include "util/event.h" 10#include "util/evlist.h" 11#include "util/evsel.h" 12#include "util/parse-events.h" |
13#include "util/pmu.h" | 13#include "util/pmus.h" |
14#include "util/pfm.h" 15#include "util/strbuf.h" 16 17#include <string.h> 18#include <linux/kernel.h> 19#include <perfmon/pfmlib_perf_event.h> 20 21static void libpfm_initialize(void) --- 22 unchanged lines hidden (view full) --- 44 libpfm_initialize(); 45 46 p_orig = p = strdup(str); 47 if (!p) 48 return -1; 49 /* 50 * force loading of the PMU list 51 */ | 14#include "util/pfm.h" 15#include "util/strbuf.h" 16 17#include <string.h> 18#include <linux/kernel.h> 19#include <perfmon/pfmlib_perf_event.h> 20 21static void libpfm_initialize(void) --- 22 unchanged lines hidden (view full) --- 44 libpfm_initialize(); 45 46 p_orig = p = strdup(str); 47 if (!p) 48 return -1; 49 /* 50 * force loading of the PMU list 51 */ |
52 perf_pmu__scan(NULL); | 52 perf_pmus__scan(NULL); |
53 54 for (q = p; strsep(&p, ",{}"); q = p) { 55 sep = p ? str + (p - p_orig - 1) : ""; 56 if (*sep == '{') { 57 if (grp_evt > -1) { 58 ui__error( 59 "nested event groups not supported\n"); 60 goto error; --- 20 unchanged lines hidden (view full) --- 81 &attr, NULL, NULL); 82 83 if (ret != PFM_SUCCESS) { 84 ui__error("failed to parse event %s : %s\n", str, 85 pfm_strerror(ret)); 86 goto error; 87 } 88 | 53 54 for (q = p; strsep(&p, ",{}"); q = p) { 55 sep = p ? str + (p - p_orig - 1) : ""; 56 if (*sep == '{') { 57 if (grp_evt > -1) { 58 ui__error( 59 "nested event groups not supported\n"); 60 goto error; --- 20 unchanged lines hidden (view full) --- 81 &attr, NULL, NULL); 82 83 if (ret != PFM_SUCCESS) { 84 ui__error("failed to parse event %s : %s\n", str, 85 pfm_strerror(ret)); 86 goto error; 87 } 88 |
89 pmu = perf_pmu__find_by_type((unsigned int)attr.type); | 89 pmu = perf_pmus__find_by_type((unsigned int)attr.type); |
90 evsel = parse_events__add_event(evlist->core.nr_entries, 91 &attr, q, /*metric_id=*/NULL, 92 pmu); 93 if (evsel == NULL) 94 goto error; 95 96 evsel->is_libpfm_event = true; 97 --- 171 unchanged lines hidden --- | 90 evsel = parse_events__add_event(evlist->core.nr_entries, 91 &attr, q, /*metric_id=*/NULL, 92 pmu); 93 if (evsel == NULL) 94 goto error; 95 96 evsel->is_libpfm_event = true; 97 --- 171 unchanged lines hidden --- |