auxtrace.c (9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e) | auxtrace.c (1eaf496ed386934f1c2439a120fe84a05194f91a) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright(C) 2015 Linaro Limited. All rights reserved. 4 * Author: Mathieu Poirier <mathieu.poirier@linaro.org> 5 */ 6 7#include <dirent.h> 8#include <stdbool.h> 9#include <linux/coresight-pmu.h> 10#include <linux/zalloc.h> 11#include <api/fs/fs.h> 12 13#include "../../../util/auxtrace.h" 14#include "../../../util/debug.h" 15#include "../../../util/evlist.h" 16#include "../../../util/pmu.h" | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright(C) 2015 Linaro Limited. All rights reserved. 4 * Author: Mathieu Poirier <mathieu.poirier@linaro.org> 5 */ 6 7#include <dirent.h> 8#include <stdbool.h> 9#include <linux/coresight-pmu.h> 10#include <linux/zalloc.h> 11#include <api/fs/fs.h> 12 13#include "../../../util/auxtrace.h" 14#include "../../../util/debug.h" 15#include "../../../util/evlist.h" 16#include "../../../util/pmu.h" |
17#include "../../../util/pmus.h" |
|
17#include "cs-etm.h" 18#include "arm-spe.h" 19#include "hisi-ptt.h" 20 21static struct perf_pmu **find_all_arm_spe_pmus(int *nr_spes, int *err) 22{ 23 struct perf_pmu **arm_spe_pmus = NULL; 24 int ret, i, nr_cpus = sysconf(_SC_NPROCESSORS_CONF); --- 10 unchanged lines hidden (view full) --- 35 for (i = 0; i < nr_cpus; i++) { 36 ret = sprintf(arm_spe_pmu_name, "%s%d", ARM_SPE_PMU_NAME, i); 37 if (ret < 0) { 38 pr_err("sprintf failed\n"); 39 *err = -ENOMEM; 40 return NULL; 41 } 42 | 18#include "cs-etm.h" 19#include "arm-spe.h" 20#include "hisi-ptt.h" 21 22static struct perf_pmu **find_all_arm_spe_pmus(int *nr_spes, int *err) 23{ 24 struct perf_pmu **arm_spe_pmus = NULL; 25 int ret, i, nr_cpus = sysconf(_SC_NPROCESSORS_CONF); --- 10 unchanged lines hidden (view full) --- 36 for (i = 0; i < nr_cpus; i++) { 37 ret = sprintf(arm_spe_pmu_name, "%s%d", ARM_SPE_PMU_NAME, i); 38 if (ret < 0) { 39 pr_err("sprintf failed\n"); 40 *err = -ENOMEM; 41 return NULL; 42 } 43 |
43 arm_spe_pmus[*nr_spes] = perf_pmu__find(arm_spe_pmu_name); | 44 arm_spe_pmus[*nr_spes] = perf_pmus__find(arm_spe_pmu_name); |
44 if (arm_spe_pmus[*nr_spes]) { 45 pr_debug2("%s %d: arm_spe_pmu %d type %d name %s\n", 46 __func__, __LINE__, *nr_spes, 47 arm_spe_pmus[*nr_spes]->type, 48 arm_spe_pmus[*nr_spes]->name); 49 (*nr_spes)++; 50 } 51 } --- 30 unchanged lines hidden (view full) --- 82 pr_err("hisi_ptt alloc failed\n"); 83 *err = -ENOMEM; 84 goto out; 85 } 86 87 rewinddir(dir); 88 while ((dent = readdir(dir))) { 89 if (strstr(dent->d_name, HISI_PTT_PMU_NAME) && idx < *nr_ptts) { | 45 if (arm_spe_pmus[*nr_spes]) { 46 pr_debug2("%s %d: arm_spe_pmu %d type %d name %s\n", 47 __func__, __LINE__, *nr_spes, 48 arm_spe_pmus[*nr_spes]->type, 49 arm_spe_pmus[*nr_spes]->name); 50 (*nr_spes)++; 51 } 52 } --- 30 unchanged lines hidden (view full) --- 83 pr_err("hisi_ptt alloc failed\n"); 84 *err = -ENOMEM; 85 goto out; 86 } 87 88 rewinddir(dir); 89 while ((dent = readdir(dir))) { 90 if (strstr(dent->d_name, HISI_PTT_PMU_NAME) && idx < *nr_ptts) { |
90 hisi_ptt_pmus[idx] = perf_pmu__find(dent->d_name); | 91 hisi_ptt_pmus[idx] = perf_pmus__find(dent->d_name); |
91 if (hisi_ptt_pmus[idx]) 92 idx++; 93 } 94 } 95 96out: 97 closedir(dir); 98 return hisi_ptt_pmus; --- 27 unchanged lines hidden (view full) --- 126 struct perf_pmu *found_ptt = NULL; 127 int auxtrace_event_cnt = 0; 128 int nr_spes = 0; 129 int nr_ptts = 0; 130 131 if (!evlist) 132 return NULL; 133 | 92 if (hisi_ptt_pmus[idx]) 93 idx++; 94 } 95 } 96 97out: 98 closedir(dir); 99 return hisi_ptt_pmus; --- 27 unchanged lines hidden (view full) --- 127 struct perf_pmu *found_ptt = NULL; 128 int auxtrace_event_cnt = 0; 129 int nr_spes = 0; 130 int nr_ptts = 0; 131 132 if (!evlist) 133 return NULL; 134 |
134 cs_etm_pmu = perf_pmu__find(CORESIGHT_ETM_PMU_NAME); | 135 cs_etm_pmu = perf_pmus__find(CORESIGHT_ETM_PMU_NAME); |
135 arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err); 136 hisi_ptt_pmus = find_all_hisi_ptt_pmus(&nr_ptts, err); 137 138 evlist__for_each_entry(evlist, evsel) { 139 if (cs_etm_pmu && !found_etm) 140 found_etm = find_pmu_for_event(&cs_etm_pmu, 1, evsel); 141 142 if (arm_spe_pmus && !found_spe) --- 76 unchanged lines hidden --- | 136 arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err); 137 hisi_ptt_pmus = find_all_hisi_ptt_pmus(&nr_ptts, err); 138 139 evlist__for_each_entry(evlist, evsel) { 140 if (cs_etm_pmu && !found_etm) 141 found_etm = find_pmu_for_event(&cs_etm_pmu, 1, evsel); 142 143 if (arm_spe_pmus && !found_spe) --- 76 unchanged lines hidden --- |