perf evsel: Rename perf_evsel__config*() to evsel__config*()
[linux-2.6-microblaze.git] / tools / perf / util / evsel.c
index eb880ef..f88cf79 100644 (file)
@@ -686,9 +686,8 @@ int perf_evsel__group_desc(struct evsel *evsel, char *buf, size_t size)
        return ret;
 }
 
-static void __perf_evsel__config_callchain(struct evsel *evsel,
-                                          struct record_opts *opts,
-                                          struct callchain_param *param)
+static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *opts,
+                                     struct callchain_param *param)
 {
        bool function = perf_evsel__is_function_event(evsel);
        struct perf_event_attr *attr = &evsel->core.attr;
@@ -746,12 +745,11 @@ static void __perf_evsel__config_callchain(struct evsel *evsel,
        }
 }
 
-void perf_evsel__config_callchain(struct evsel *evsel,
-                                 struct record_opts *opts,
-                                 struct callchain_param *param)
+void evsel__config_callchain(struct evsel *evsel, struct record_opts *opts,
+                            struct callchain_param *param)
 {
        if (param->enabled)
-               return __perf_evsel__config_callchain(evsel, opts, param);
+               return __evsel__config_callchain(evsel, opts, param);
 }
 
 static void
@@ -832,7 +830,7 @@ static void apply_config_terms(struct evsel *evsel,
                case PERF_EVSEL__CONFIG_TERM_INHERIT:
                        /*
                         * attr->inherit should has already been set by
-                        * perf_evsel__config. If user explicitly set
+                        * evsel__config. If user explicitly set
                         * inherit using config terms, override global
                         * opt->no_inherit setting.
                         */
@@ -901,7 +899,7 @@ static void apply_config_terms(struct evsel *evsel,
                                perf_evsel__set_sample_bit(evsel, DATA_SRC);
                                evsel->core.attr.mmap_data = track;
                        }
-                       perf_evsel__config_callchain(evsel, opts, &param);
+                       evsel__config_callchain(evsel, opts, &param);
                }
        }
 }
@@ -953,8 +951,8 @@ struct perf_evsel_config_term *__perf_evsel__get_config_term(struct evsel *evsel
  *     enable/disable events specifically, as there's no
  *     initial traced exec call.
  */
-void perf_evsel__config(struct evsel *evsel, struct record_opts *opts,
-                       struct callchain_param *callchain)
+void evsel__config(struct evsel *evsel, struct record_opts *opts,
+                  struct callchain_param *callchain)
 {
        struct evsel *leader = evsel->leader;
        struct perf_event_attr *attr = &evsel->core.attr;
@@ -1002,25 +1000,6 @@ void perf_evsel__config(struct evsel *evsel, struct record_opts *opts,
                }
        }
 
-       /*
-        * Disable sampling for all group members other
-        * than leader in case leader 'leads' the sampling.
-        */
-       if ((leader != evsel) && leader->sample_read) {
-               attr->freq           = 0;
-               attr->sample_freq    = 0;
-               attr->sample_period  = 0;
-               attr->write_backward = 0;
-
-               /*
-                * We don't get sample for slave events, we make them
-                * when delivering group leader sample. Set the slave
-                * event to follow the master sample_type to ease up
-                * report.
-                */
-               attr->sample_type = leader->core.attr.sample_type;
-       }
-
        if (opts->no_samples)
                attr->sample_freq = 0;
 
@@ -1046,7 +1025,7 @@ void perf_evsel__config(struct evsel *evsel, struct record_opts *opts,
                evsel->core.attr.exclude_callchain_user = 1;
 
        if (callchain && callchain->enabled && !evsel->no_aux_samples)
-               perf_evsel__config_callchain(evsel, opts, callchain);
+               evsel__config_callchain(evsel, opts, callchain);
 
        if (opts->sample_intr_regs) {
                attr->sample_regs_intr = opts->sample_intr_regs;
@@ -1278,7 +1257,7 @@ static void perf_evsel__free_config_terms(struct evsel *evsel)
        }
 }
 
-void perf_evsel__exit(struct evsel *evsel)
+void evsel__exit(struct evsel *evsel)
 {
        assert(list_empty(&evsel->core.node));
        assert(evsel->evlist == NULL);
@@ -1298,12 +1277,12 @@ void perf_evsel__exit(struct evsel *evsel)
 
 void evsel__delete(struct evsel *evsel)
 {
-       perf_evsel__exit(evsel);
+       evsel__exit(evsel);
        free(evsel);
 }
 
-void perf_evsel__compute_deltas(struct evsel *evsel, int cpu, int thread,
-                               struct perf_counts_values *count)
+void evsel__compute_deltas(struct evsel *evsel, int cpu, int thread,
+                          struct perf_counts_values *count)
 {
        struct perf_counts_values tmp;
 
@@ -1459,7 +1438,7 @@ int __perf_evsel__read_on_cpu(struct evsel *evsel,
        if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0)
                return -errno;
 
-       perf_evsel__compute_deltas(evsel, cpu, thread, &count);
+       evsel__compute_deltas(evsel, cpu, thread, &count);
        perf_counts_values__scale(&count, scale, NULL);
        *perf_counts(evsel->counts, cpu, thread) = count;
        return 0;
@@ -2136,7 +2115,7 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event,
                }
        }
 
-       if (evsel__has_callchain(evsel)) {
+       if (type & PERF_SAMPLE_CALLCHAIN) {
                const u64 max_callchain_nr = UINT64_MAX / sizeof(u64);
 
                OVERFLOW_CHECK_u64(array);
@@ -2446,6 +2425,10 @@ bool perf_evsel__fallback(struct evsel *evsel, int err,
                char *new_name;
                const char *sep = ":";
 
+               /* If event has exclude user then don't exclude kernel. */
+               if (evsel->core.attr.exclude_user)
+                       return false;
+
                /* Is there already the separator in the name. */
                if (strchr(name, '/') ||
                    strchr(name, ':'))
@@ -2523,14 +2506,14 @@ int perf_evsel__open_strerror(struct evsel *evsel, struct target *target,
                 "You may not have permission to collect %sstats.\n\n"
                 "Consider tweaking /proc/sys/kernel/perf_event_paranoid,\n"
                 "which controls use of the performance events system by\n"
-                "unprivileged users (without CAP_SYS_ADMIN).\n\n"
+                "unprivileged users (without CAP_PERFMON or CAP_SYS_ADMIN).\n\n"
                 "The current value is %d:\n\n"
                 "  -1: Allow use of (almost) all events by all users\n"
                 "      Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK\n"
-                ">= 0: Disallow ftrace function tracepoint by users without CAP_SYS_ADMIN\n"
-                "      Disallow raw tracepoint access by users without CAP_SYS_ADMIN\n"
-                ">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n"
-                ">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN\n\n"
+                ">= 0: Disallow ftrace function tracepoint by users without CAP_PERFMON or CAP_SYS_ADMIN\n"
+                "      Disallow raw tracepoint access by users without CAP_SYS_PERFMON or CAP_SYS_ADMIN\n"
+                ">= 1: Disallow CPU event access by users without CAP_PERFMON or CAP_SYS_ADMIN\n"
+                ">= 2: Disallow kernel profiling by users without CAP_PERFMON or CAP_SYS_ADMIN\n\n"
                 "To make this setting permanent, edit /etc/sysctl.conf too, e.g.:\n\n"
                 "      kernel.perf_event_paranoid = -1\n" ,
                                 target->system_wide ? "system-wide " : "",