Skip to content

Commit

Permalink
Merge pull request #88 from jishminor/fix/perf_struct_size
Browse files Browse the repository at this point in the history
Set size of perf_attr_struct prior to getting pfm encoding
  • Loading branch information
gcongiu authored Nov 8, 2023
2 parents 70aeec3 + b514860 commit 57f70bb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/perf_event/pe_libpfm4_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ static struct native_event_t *allocate_native_event(
perf_arg.attr=&ntv_evt->attr;
perf_arg.fstr=&event_string;

// set the size of the perf attr struct before getting pfm encoding
ntv_evt->attr.size = sizeof(struct perf_event_attr);

/* use user provided name of the event to get the */
/* perf_event encoding and a fully qualified event string */
ret = pfm_get_os_event_encoding(name,
Expand Down

0 comments on commit 57f70bb

Please sign in to comment.