-
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.
yaml --- r: 339016 b: refs/heads/master c: 5e24a09 h: refs/heads/master v: v3
- Loading branch information
Jiri Olsa
authored and
Arnaldo Carvalho de Melo
committed
Nov 14, 2012
1 parent
f4f7847
commit d94aa9c
Showing
5 changed files
with
88 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: cfffae2ef7029d38e71d337fbc2a9c6cf1fa5aaf | ||
refs/heads/master: 5e24a0904ed4029f6778a214b6fe41b9265fd620 |
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,84 @@ | ||
#include "evsel.h" | ||
#include "tests.h" | ||
#include "event-parse.h" | ||
|
||
static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, | ||
int size, bool should_be_signed) | ||
{ | ||
struct format_field *field = perf_evsel__field(evsel, name); | ||
int is_signed; | ||
int ret = 0; | ||
|
||
if (field == NULL) { | ||
pr_debug("%s: \"%s\" field not found!\n", evsel->name, name); | ||
return -1; | ||
} | ||
|
||
is_signed = !!(field->flags | FIELD_IS_SIGNED); | ||
if (should_be_signed && !is_signed) { | ||
pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n", | ||
evsel->name, name, is_signed, should_be_signed); | ||
ret = -1; | ||
} | ||
|
||
if (field->size != size) { | ||
pr_debug("%s: \"%s\" size (%d) should be %d!\n", | ||
evsel->name, name, field->size, size); | ||
ret = -1; | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
int test__perf_evsel__tp_sched_test(void) | ||
{ | ||
struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch", 0); | ||
int ret = 0; | ||
|
||
if (evsel == NULL) { | ||
pr_debug("perf_evsel__new\n"); | ||
return -1; | ||
} | ||
|
||
if (perf_evsel__test_field(evsel, "prev_comm", 16, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "prev_pid", 4, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "prev_prio", 4, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "prev_state", 8, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "next_comm", 16, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "next_pid", 4, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "next_prio", 4, true)) | ||
ret = -1; | ||
|
||
perf_evsel__delete(evsel); | ||
|
||
evsel = perf_evsel__newtp("sched", "sched_wakeup", 0); | ||
|
||
if (perf_evsel__test_field(evsel, "comm", 16, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "pid", 4, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "prio", 4, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "success", 4, true)) | ||
ret = -1; | ||
|
||
if (perf_evsel__test_field(evsel, "target_cpu", 4, true)) | ||
ret = -1; | ||
|
||
return ret; | ||
} |
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