lkml.org 
[lkml]   [2020]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH v6 3/4] perf-stat: enable counting events for BPF programs
Date


> On Dec 29, 2020, at 9:46 AM, Song Liu <songliubraving@fb.com> wrote:
>
>>>

[...]

>
> [...]
>
>>> +static inline bool target__has_bpf(struct target *target)
>>> +{
>>> + return target->bpf_str;
>>> +}
>>> +
>>> static inline bool target__none(struct target *target)
>>> {
>>> return !target__has_task(target) && !target__has_cpu(target);
>>
>> Shouldn't it have && !target__has_bpf() too?

Actually, we don't need target__has_bpf() here. As -b requires setting up counters
system wide (in setup_system_wide()). If we add target__has_bpf() here, we will
need something like below, which I think it not necessary.

diff --git i/tools/perf/builtin-stat.c w/tools/perf/builtin-stat.c
index 09bffb3fbcdd4..853cec040191b 100644
--- i/tools/perf/builtin-stat.c
+++ w/tools/perf/builtin-stat.c
@@ -2081,7 +2081,7 @@ static void setup_system_wide(int forks)
* - there is workload specified but all requested
* events are system wide events
*/
- if (!target__none(&target))
+ if (!target__none(&target) && !target__has_bpf(&target))
return;

if (!forks)
diff --git i/tools/perf/util/target.h w/tools/perf/util/target.h
index f132c6c2eef81..295fb11f4daff 100644
--- i/tools/perf/util/target.h
+++ w/tools/perf/util/target.h
@@ -71,7 +71,8 @@ static inline bool target__has_bpf(struct target *target)

static inline bool target__none(struct target *target)
{
- return !target__has_task(target) && !target__has_cpu(target);
+ return !target__has_task(target) && !target__has_cpu(target) &&
+ !target__has_bpf(target);
}

static inline bool target__has_per_thread(struct target *target)

\
 
 \ /
  Last update: 2020-12-29 19:01    [W:0.121 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site