-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf tools: Add event_update event unit type
Adding unit type 'event update' event, that stores/transfer events unit name. The unit name is part of the perf stat output data. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Kan Liang <kan.liang@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1445784728-21732-22-git-send-email-jolsa@kernel.org [ Rename __alloc() to __new() for consistency ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Jiri Olsa
authored and
Arnaldo Carvalho de Melo
committed
Dec 17, 2015
1 parent
ffe7772
commit a6e5281
Showing
7 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <linux/compiler.h> | ||
#include "evlist.h" | ||
#include "evsel.h" | ||
#include "machine.h" | ||
#include "tests.h" | ||
#include "debug.h" | ||
|
||
static int process_event_unit(struct perf_tool *tool __maybe_unused, | ||
union perf_event *event, | ||
struct perf_sample *sample __maybe_unused, | ||
struct machine *machine __maybe_unused) | ||
{ | ||
struct event_update_event *ev = (struct event_update_event *) event; | ||
|
||
TEST_ASSERT_VAL("wrong id", ev->id == 123); | ||
TEST_ASSERT_VAL("wrong id", ev->type == PERF_EVENT_UPDATE__UNIT); | ||
TEST_ASSERT_VAL("wrong unit", !strcmp(ev->data, "KRAVA")); | ||
return 0; | ||
} | ||
|
||
int test__event_update(int subtest __maybe_unused) | ||
{ | ||
struct perf_evlist *evlist; | ||
struct perf_evsel *evsel; | ||
|
||
evlist = perf_evlist__new_default(); | ||
TEST_ASSERT_VAL("failed to get evlist", evlist); | ||
|
||
evsel = perf_evlist__first(evlist); | ||
|
||
TEST_ASSERT_VAL("failed to allos ids", | ||
!perf_evsel__alloc_id(evsel, 1, 1)); | ||
|
||
perf_evlist__id_add(evlist, evsel, 0, 0, 123); | ||
|
||
evsel->unit = strdup("KRAVA"); | ||
|
||
TEST_ASSERT_VAL("failed to synthesize attr update unit", | ||
!perf_event__synthesize_event_update_unit(NULL, evsel, process_event_unit)); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters