lkml.org 
[lkml]   [2023]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH V5 3/8] perf: Add branch_sample_call_stack
    Date
    From: Kan Liang <kan.liang@linux.intel.com>

    Add a helper function to check call stack sample type.

    The later patch will invoke the function in several places.

    Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
    ---

    No changes since V4

    arch/x86/events/core.c | 2 +-
    include/linux/perf_event.h | 5 +++++
    2 files changed, 6 insertions(+), 1 deletion(-)

    diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
    index 40c9af124128..09050641ce5d 100644
    --- a/arch/x86/events/core.c
    +++ b/arch/x86/events/core.c
    @@ -601,7 +601,7 @@ int x86_pmu_hw_config(struct perf_event *event)
    }
    }

    - if (event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK)
    + if (branch_sample_call_stack(event))
    event->attach_state |= PERF_ATTACH_TASK_DATA;

    /*
    diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
    index 7897ef066027..ac1a59c1f252 100644
    --- a/include/linux/perf_event.h
    +++ b/include/linux/perf_event.h
    @@ -1144,6 +1144,11 @@ static inline bool branch_sample_counters(const struct perf_event *event)
    return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_COUNTERS;
    }

    +static inline bool branch_sample_call_stack(const struct perf_event *event)
    +{
    + return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK;
    +}
    +
    struct perf_sample_data {
    /*
    * Fields set by perf_sample_data_init() unconditionally,
    --
    2.35.1
    \
     
     \ /
      Last update: 2023-10-25 22:17    [W:4.856 / U:0.168 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site