summaryrefslogtreecommitdiff
path: root/tools/perf/tests/evsel-tp-sched.c
blob: 1984b3bbfe15d2bc6f407e1e272d3f1a95046916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <linux/err.h>
#include <traceevent/event-parse.h>
#include "evsel.h"
#include "tests.h"
#include "debug.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(int subtest __maybe_unused)
{
	struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch");
	int ret = 0;

	if (IS_ERR(evsel)) {
		pr_debug("perf_evsel__newtp failed with %ld\n", PTR_ERR(evsel));
		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", sizeof(long), 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");

	if (IS_ERR(evsel)) {
		pr_debug("perf_evsel__newtp failed with %ld\n", PTR_ERR(evsel));
		return -1;
	}

	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, "target_cpu", 4, true))
		ret = -1;

	return ret;
}
ommit/net?id=dd41d33f0b033885211a5d6f3ee19e73238aa9ee'>openvswitch: Add force commit.Jarno Rajahalme1-2/+24 2017-02-09openvswitch: Add original direction conntrack tuple to sw_flow_key.Jarno Rajahalme7-46/+227 2017-02-09openvswitch: Inherit master's labels.Jarno Rajahalme1-14/+31 2017-02-09openvswitch: Refactor labels initialization.Jarno Rajahalme1-42/+62 2017-02-09openvswitch: Simplify labels length logic.Jarno Rajahalme1-11/+9 2017-02-09openvswitch: Unionize ovs_key_ct_label with a u32 array.Jarno Rajahalme1-7/+8 2017-02-09openvswitch: Do not trigger events for unconfirmed connections.Jarno Rajahalme1-6/+22 2017-02-09openvswitch: Use inverted tuple in ovs_ct_find_existing() if NATted.Jarno Rajahalme1-2/+22 2017-02-09openvswitch: Fix comments for skb->_nfctJarno Rajahalme1-7/+7 2017-02-09net: dsa: Fix duplicate object ruleFlorian Fainelli1-1/+0 2017-02-09sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Requ...Xin Long2-0/+106 2017-02-09sctp: add support for generating stream reconf add incoming/outgoing streams ...Xin Long1-0/+46 2017-02-09sctp: implement sender-side procedures for SSN/TSN Reset Request ParameterXin Long2-0/+69 2017-02-09sctp: add support for generating stream reconf ssn/tsn reset request chunkXin Long1-0/+29 2017-02-09sctp: streams should be recovered when it fails to send request.Xin Long1-2/+17 2017-02-08ipv4: fib: Notify about nexthop status changesIdo Schimmel1-0/+33 2017-02-08bridge: vlan tunnel id info range fill size calc cleanupsRoopa Prabhu1-18/+16 2017-02-08gro_cells: move to net/core/gro_cells.cEric Dumazet6-0/+100 2017-02-07Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller