aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-record.c10
-rw-r--r--tools/perf/builtin-stat.c9
-rw-r--r--tools/perf/builtin-top.c13
-rw-r--r--tools/perf/util/Build1
-rw-r--r--tools/perf/util/drv_configs.c78
-rw-r--r--tools/perf/util/drv_configs.h26
-rw-r--r--tools/perf/util/pmu.h1
7 files changed, 0 insertions, 138 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 88ea11d57c6f..56e9d9e8c174 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -23,7 +23,6 @@
23#include "util/evlist.h" 23#include "util/evlist.h"
24#include "util/evsel.h" 24#include "util/evsel.h"
25#include "util/debug.h" 25#include "util/debug.h"
26#include "util/drv_configs.h"
27#include "util/session.h" 26#include "util/session.h"
28#include "util/tool.h" 27#include "util/tool.h"
29#include "util/symbol.h" 28#include "util/symbol.h"
@@ -567,7 +566,6 @@ static int record__open(struct record *rec)
567 struct perf_evlist *evlist = rec->evlist; 566 struct perf_evlist *evlist = rec->evlist;
568 struct perf_session *session = rec->session; 567 struct perf_session *session = rec->session;
569 struct record_opts *opts = &rec->opts; 568 struct record_opts *opts = &rec->opts;
570 struct perf_evsel_config_term *err_term;
571 int rc = 0; 569 int rc = 0;
572 570
573 /* 571 /*
@@ -620,14 +618,6 @@ try_again:
620 goto out; 618 goto out;
621 } 619 }
622 620
623 if (perf_evlist__apply_drv_configs(evlist, &pos, &err_term)) {
624 pr_err("failed to set config \"%s\" on event %s with %d (%s)\n",
625 err_term->val.drv_cfg, perf_evsel__name(pos), errno,
626 str_error_r(errno, msg, sizeof(msg)));
627 rc = -1;
628 goto out;
629 }
630
631 rc = record__mmap(rec); 621 rc = record__mmap(rec);
632 if (rc) 622 if (rc)
633 goto out; 623 goto out;
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e587808591e8..bb24f9c17f9a 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -52,7 +52,6 @@
52#include "util/evlist.h" 52#include "util/evlist.h"
53#include "util/evsel.h" 53#include "util/evsel.h"
54#include "util/debug.h" 54#include "util/debug.h"
55#include "util/drv_configs.h"
56#include "util/color.h" 55#include "util/color.h"
57#include "util/stat.h" 56#include "util/stat.h"
58#include "util/header.h" 57#include "util/header.h"
@@ -417,7 +416,6 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
417 int status = 0; 416 int status = 0;
418 const bool forks = (argc > 0); 417 const bool forks = (argc > 0);
419 bool is_pipe = STAT_RECORD ? perf_stat.data.is_pipe : false; 418 bool is_pipe = STAT_RECORD ? perf_stat.data.is_pipe : false;
420 struct perf_evsel_config_term *err_term;
421 419
422 if (interval) { 420 if (interval) {
423 ts.tv_sec = interval / USEC_PER_MSEC; 421 ts.tv_sec = interval / USEC_PER_MSEC;
@@ -514,13 +512,6 @@ try_again:
514 return -1; 512 return -1;
515 } 513 }
516 514
517 if (perf_evlist__apply_drv_configs(evsel_list, &counter, &err_term)) {
518 pr_err("failed to set config \"%s\" on event %s with %d (%s)\n",
519 err_term->val.drv_cfg, perf_evsel__name(counter), errno,
520 str_error_r(errno, msg, sizeof(msg)));
521 return -1;
522 }
523
524 if (STAT_RECORD) { 515 if (STAT_RECORD) {
525 int err, fd = perf_data__fd(&perf_stat.data); 516 int err, fd = perf_data__fd(&perf_stat.data);
526 517
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 619406339e4b..231a90daa958 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -25,7 +25,6 @@
25#include "util/bpf-event.h" 25#include "util/bpf-event.h"
26#include "util/config.h" 26#include "util/config.h"
27#include "util/color.h" 27#include "util/color.h"
28#include "util/drv_configs.h"
29#include "util/evlist.h" 28#include "util/evlist.h"
30#include "util/evsel.h" 29#include "util/evsel.h"
31#include "util/event.h" 30#include "util/event.h"
@@ -1186,10 +1185,6 @@ static void init_process_thread(struct perf_top *top)
1186 1185
1187static int __cmd_top(struct perf_top *top) 1186static int __cmd_top(struct perf_top *top)
1188{ 1187{
1189 char msg[512];
1190 struct perf_evsel *pos;
1191 struct perf_evsel_config_term *err_term;
1192 struct perf_evlist *evlist = top->evlist;
1193 struct record_opts *opts = &top->record_opts; 1188 struct record_opts *opts = &top->record_opts;
1194 pthread_t thread, thread_process; 1189 pthread_t thread, thread_process;
1195 int ret; 1190 int ret;
@@ -1240,14 +1235,6 @@ static int __cmd_top(struct perf_top *top)
1240 if (ret) 1235 if (ret)
1241 goto out_delete; 1236 goto out_delete;
1242 1237
1243 ret = perf_evlist__apply_drv_configs(evlist, &pos, &err_term);
1244 if (ret) {
1245 pr_err("failed to set config \"%s\" on event %s with %d (%s)\n",
1246 err_term->val.drv_cfg, perf_evsel__name(pos), errno,
1247 str_error_r(errno, msg, sizeof(msg)));
1248 goto out_delete;
1249 }
1250
1251 top->session->evlist = top->evlist; 1238 top->session->evlist = top->evlist;
1252 perf_session__set_id_hdr_size(top->session); 1239 perf_session__set_id_hdr_size(top->session);
1253 1240
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index b69d6294c88c..a36e6e5a6f4f 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -107,7 +107,6 @@ libperf-y += term.o
107libperf-y += help-unknown-cmd.o 107libperf-y += help-unknown-cmd.o
108libperf-y += mem-events.o 108libperf-y += mem-events.o
109libperf-y += vsprintf.o 109libperf-y += vsprintf.o
110libperf-y += drv_configs.o
111libperf-y += units.o 110libperf-y += units.o
112libperf-y += time-utils.o 111libperf-y += time-utils.o
113libperf-y += expr-bison.o 112libperf-y += expr-bison.o
diff --git a/tools/perf/util/drv_configs.c b/tools/perf/util/drv_configs.c
deleted file mode 100644
index eec754243f4d..000000000000
--- a/tools/perf/util/drv_configs.c
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * drv_configs.h: Interface to apply PMU specific configuration
3 * Copyright (c) 2016-2018, Linaro Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#include "drv_configs.h"
17#include "evlist.h"
18#include "evsel.h"
19#include "pmu.h"
20#include <errno.h>
21
22static int
23perf_evsel__apply_drv_configs(struct perf_evsel *evsel,
24 struct perf_evsel_config_term **err_term)
25{
26 bool found = false;
27 int err = 0;
28 struct perf_evsel_config_term *term;
29 struct perf_pmu *pmu = NULL;
30
31 while ((pmu = perf_pmu__scan(pmu)) != NULL)
32 if (pmu->type == evsel->attr.type) {
33 found = true;
34 break;
35 }
36
37 list_for_each_entry(term, &evsel->config_terms, list) {
38 if (term->type != PERF_EVSEL__CONFIG_TERM_DRV_CFG)
39 continue;
40
41 /*
42 * We have a configuration term, report an error if we
43 * can't find the PMU or if the PMU driver doesn't support
44 * cmd line driver configuration.
45 */
46 if (!found || !pmu->set_drv_config) {
47 err = -EINVAL;
48 *err_term = term;
49 break;
50 }
51
52 err = pmu->set_drv_config(term);
53 if (err) {
54 *err_term = term;
55 break;
56 }
57 }
58
59 return err;
60}
61
62int perf_evlist__apply_drv_configs(struct perf_evlist *evlist,
63 struct perf_evsel **err_evsel,
64 struct perf_evsel_config_term **err_term)
65{
66 struct perf_evsel *evsel;
67 int err = 0;
68
69 evlist__for_each_entry(evlist, evsel) {
70 err = perf_evsel__apply_drv_configs(evsel, err_term);
71 if (err) {
72 *err_evsel = evsel;
73 break;
74 }
75 }
76
77 return err;
78}
diff --git a/tools/perf/util/drv_configs.h b/tools/perf/util/drv_configs.h
deleted file mode 100644
index 32bc9babc2e0..000000000000
--- a/tools/perf/util/drv_configs.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * drv_configs.h: Interface to apply PMU specific configuration
3 * Copyright (c) 2016-2018, Linaro Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#ifndef __PERF_DRV_CONFIGS_H
17#define __PERF_DRV_CONFIGS_H
18
19#include "drv_configs.h"
20#include "evlist.h"
21#include "evsel.h"
22
23int perf_evlist__apply_drv_configs(struct perf_evlist *evlist,
24 struct perf_evsel **err_evsel,
25 struct perf_evsel_config_term **term);
26#endif
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 1c12a61ed0dc..47253c3daf55 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -31,7 +31,6 @@ struct perf_pmu {
31 struct list_head format; /* HEAD struct perf_pmu_format -> list */ 31 struct list_head format; /* HEAD struct perf_pmu_format -> list */
32 struct list_head aliases; /* HEAD struct perf_pmu_alias -> list */ 32 struct list_head aliases; /* HEAD struct perf_pmu_alias -> list */
33 struct list_head list; /* ELEM */ 33 struct list_head list; /* ELEM */
34 int (*set_drv_config) (struct perf_evsel_config_term *term);
35}; 34};
36 35
37struct perf_pmu_info { 36struct perf_pmu_info {