aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-sched.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2009-12-07 00:04:04 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-07 00:26:25 -0500
commitf48f669d42e133db839af16656fd720107ef6742 (patch)
tree0fbc78abb79390ba22c40b48e1684f1f8b5badcb /tools/perf/builtin-sched.c
parentd9541ed3241bb6c2b805d3ea0e87563cf2a0c5c3 (diff)
perf_event: Eliminate raw->size
raw->size is not used, this patch just cleans it up. Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <4B1C8CC4.4050007@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r--tools/perf/builtin-sched.c94
1 files changed, 42 insertions, 52 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 4655e16b929b..19f43faa9f81 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -628,11 +628,6 @@ static void test_calibrations(void)
628 printf("the sleep test took %Ld nsecs\n", T1-T0); 628 printf("the sleep test took %Ld nsecs\n", T1-T0);
629} 629}
630 630
631struct raw_event_sample {
632 u32 size;
633 char data[0];
634};
635
636#define FILL_FIELD(ptr, field, event, data) \ 631#define FILL_FIELD(ptr, field, event, data) \
637 ptr.field = (typeof(ptr.field)) raw_field_value(event, #field, data) 632 ptr.field = (typeof(ptr.field)) raw_field_value(event, #field, data)
638 633
@@ -1356,7 +1351,7 @@ static void sort_lat(void)
1356static struct trace_sched_handler *trace_handler; 1351static struct trace_sched_handler *trace_handler;
1357 1352
1358static void 1353static void
1359process_sched_wakeup_event(struct raw_event_sample *raw, 1354process_sched_wakeup_event(void *data,
1360 struct event *event, 1355 struct event *event,
1361 int cpu __used, 1356 int cpu __used,
1362 u64 timestamp __used, 1357 u64 timestamp __used,
@@ -1364,13 +1359,13 @@ process_sched_wakeup_event(struct raw_event_sample *raw,
1364{ 1359{
1365 struct trace_wakeup_event wakeup_event; 1360 struct trace_wakeup_event wakeup_event;
1366 1361
1367 FILL_COMMON_FIELDS(wakeup_event, event, raw->data); 1362 FILL_COMMON_FIELDS(wakeup_event, event, data);
1368 1363
1369 FILL_ARRAY(wakeup_event, comm, event, raw->data); 1364 FILL_ARRAY(wakeup_event, comm, event, data);
1370 FILL_FIELD(wakeup_event, pid, event, raw->data); 1365 FILL_FIELD(wakeup_event, pid, event, data);
1371 FILL_FIELD(wakeup_event, prio, event, raw->data); 1366 FILL_FIELD(wakeup_event, prio, event, data);
1372 FILL_FIELD(wakeup_event, success, event, raw->data); 1367 FILL_FIELD(wakeup_event, success, event, data);
1373 FILL_FIELD(wakeup_event, cpu, event, raw->data); 1368 FILL_FIELD(wakeup_event, cpu, event, data);
1374 1369
1375 if (trace_handler->wakeup_event) 1370 if (trace_handler->wakeup_event)
1376 trace_handler->wakeup_event(&wakeup_event, event, cpu, timestamp, thread); 1371 trace_handler->wakeup_event(&wakeup_event, event, cpu, timestamp, thread);
@@ -1469,7 +1464,7 @@ map_switch_event(struct trace_switch_event *switch_event,
1469 1464
1470 1465
1471static void 1466static void
1472process_sched_switch_event(struct raw_event_sample *raw, 1467process_sched_switch_event(void *data,
1473 struct event *event, 1468 struct event *event,
1474 int this_cpu, 1469 int this_cpu,
1475 u64 timestamp __used, 1470 u64 timestamp __used,
@@ -1477,15 +1472,15 @@ process_sched_switch_event(struct raw_event_sample *raw,
1477{ 1472{
1478 struct trace_switch_event switch_event; 1473 struct trace_switch_event switch_event;
1479 1474
1480 FILL_COMMON_FIELDS(switch_event, event, raw->data); 1475 FILL_COMMON_FIELDS(switch_event, event, data);
1481 1476
1482 FILL_ARRAY(switch_event, prev_comm, event, raw->data); 1477 FILL_ARRAY(switch_event, prev_comm, event, data);
1483 FILL_FIELD(switch_event, prev_pid, event, raw->data); 1478 FILL_FIELD(switch_event, prev_pid, event, data);
1484 FILL_FIELD(switch_event, prev_prio, event, raw->data); 1479 FILL_FIELD(switch_event, prev_prio, event, data);
1485 FILL_FIELD(switch_event, prev_state, event, raw->data); 1480 FILL_FIELD(switch_event, prev_state, event, data);
1486 FILL_ARRAY(switch_event, next_comm, event, raw->data); 1481 FILL_ARRAY(switch_event, next_comm, event, data);
1487 FILL_FIELD(switch_event, next_pid, event, raw->data); 1482 FILL_FIELD(switch_event, next_pid, event, data);
1488 FILL_FIELD(switch_event, next_prio, event, raw->data); 1483 FILL_FIELD(switch_event, next_prio, event, data);
1489 1484
1490 if (curr_pid[this_cpu] != (u32)-1) { 1485 if (curr_pid[this_cpu] != (u32)-1) {
1491 /* 1486 /*
@@ -1502,7 +1497,7 @@ process_sched_switch_event(struct raw_event_sample *raw,
1502} 1497}
1503 1498
1504static void 1499static void
1505process_sched_runtime_event(struct raw_event_sample *raw, 1500process_sched_runtime_event(void *data,
1506 struct event *event, 1501 struct event *event,
1507 int cpu __used, 1502 int cpu __used,
1508 u64 timestamp __used, 1503 u64 timestamp __used,
@@ -1510,17 +1505,17 @@ process_sched_runtime_event(struct raw_event_sample *raw,
1510{ 1505{
1511 struct trace_runtime_event runtime_event; 1506 struct trace_runtime_event runtime_event;
1512 1507
1513 FILL_ARRAY(runtime_event, comm, event, raw->data); 1508 FILL_ARRAY(runtime_event, comm, event, data);
1514 FILL_FIELD(runtime_event, pid, event, raw->data); 1509 FILL_FIELD(runtime_event, pid, event, data);
1515 FILL_FIELD(runtime_event, runtime, event, raw->data); 1510 FILL_FIELD(runtime_event, runtime, event, data);
1516 FILL_FIELD(runtime_event, vruntime, event, raw->data); 1511 FILL_FIELD(runtime_event, vruntime, event, data);
1517 1512
1518 if (trace_handler->runtime_event) 1513 if (trace_handler->runtime_event)
1519 trace_handler->runtime_event(&runtime_event, event, cpu, timestamp, thread); 1514 trace_handler->runtime_event(&runtime_event, event, cpu, timestamp, thread);
1520} 1515}
1521 1516
1522static void 1517static void
1523process_sched_fork_event(struct raw_event_sample *raw, 1518process_sched_fork_event(void *data,
1524 struct event *event, 1519 struct event *event,
1525 int cpu __used, 1520 int cpu __used,
1526 u64 timestamp __used, 1521 u64 timestamp __used,
@@ -1528,12 +1523,12 @@ process_sched_fork_event(struct raw_event_sample *raw,
1528{ 1523{
1529 struct trace_fork_event fork_event; 1524 struct trace_fork_event fork_event;
1530 1525
1531 FILL_COMMON_FIELDS(fork_event, event, raw->data); 1526 FILL_COMMON_FIELDS(fork_event, event, data);
1532 1527
1533 FILL_ARRAY(fork_event, parent_comm, event, raw->data); 1528 FILL_ARRAY(fork_event, parent_comm, event, data);
1534 FILL_FIELD(fork_event, parent_pid, event, raw->data); 1529 FILL_FIELD(fork_event, parent_pid, event, data);
1535 FILL_ARRAY(fork_event, child_comm, event, raw->data); 1530 FILL_ARRAY(fork_event, child_comm, event, data);
1536 FILL_FIELD(fork_event, child_pid, event, raw->data); 1531 FILL_FIELD(fork_event, child_pid, event, data);
1537 1532
1538 if (trace_handler->fork_event) 1533 if (trace_handler->fork_event)
1539 trace_handler->fork_event(&fork_event, event, cpu, timestamp, thread); 1534 trace_handler->fork_event(&fork_event, event, cpu, timestamp, thread);
@@ -1550,7 +1545,7 @@ process_sched_exit_event(struct event *event,
1550} 1545}
1551 1546
1552static void 1547static void
1553process_sched_migrate_task_event(struct raw_event_sample *raw, 1548process_sched_migrate_task_event(void *data,
1554 struct event *event, 1549 struct event *event,
1555 int cpu __used, 1550 int cpu __used,
1556 u64 timestamp __used, 1551 u64 timestamp __used,
@@ -1558,46 +1553,42 @@ process_sched_migrate_task_event(struct raw_event_sample *raw,
1558{ 1553{
1559 struct trace_migrate_task_event migrate_task_event; 1554 struct trace_migrate_task_event migrate_task_event;
1560 1555
1561 FILL_COMMON_FIELDS(migrate_task_event, event, raw->data); 1556 FILL_COMMON_FIELDS(migrate_task_event, event, data);
1562 1557
1563 FILL_ARRAY(migrate_task_event, comm, event, raw->data); 1558 FILL_ARRAY(migrate_task_event, comm, event, data);
1564 FILL_FIELD(migrate_task_event, pid, event, raw->data); 1559 FILL_FIELD(migrate_task_event, pid, event, data);
1565 FILL_FIELD(migrate_task_event, prio, event, raw->data); 1560 FILL_FIELD(migrate_task_event, prio, event, data);
1566 FILL_FIELD(migrate_task_event, cpu, event, raw->data); 1561 FILL_FIELD(migrate_task_event, cpu, event, data);
1567 1562
1568 if (trace_handler->migrate_task_event) 1563 if (trace_handler->migrate_task_event)
1569 trace_handler->migrate_task_event(&migrate_task_event, event, cpu, timestamp, thread); 1564 trace_handler->migrate_task_event(&migrate_task_event, event, cpu, timestamp, thread);
1570} 1565}
1571 1566
1572static void 1567static void
1573process_raw_event(event_t *raw_event __used, u32 size, void *data, 1568process_raw_event(event_t *raw_event __used, void *data,
1574 int cpu, u64 timestamp, struct thread *thread) 1569 int cpu, u64 timestamp, struct thread *thread)
1575{ 1570{
1576 struct raw_event_sample *raw;
1577 struct event *event; 1571 struct event *event;
1578 int type; 1572 int type;
1579 1573
1580 raw = malloc_or_die(sizeof(*raw)+size);
1581 raw->size = size;
1582 memcpy(raw->data, data, size);
1583 1574
1584 type = trace_parse_common_type(raw->data); 1575 type = trace_parse_common_type(data);
1585 event = trace_find_event(type); 1576 event = trace_find_event(type);
1586 1577
1587 if (!strcmp(event->name, "sched_switch")) 1578 if (!strcmp(event->name, "sched_switch"))
1588 process_sched_switch_event(raw, event, cpu, timestamp, thread); 1579 process_sched_switch_event(data, event, cpu, timestamp, thread);
1589 if (!strcmp(event->name, "sched_stat_runtime")) 1580 if (!strcmp(event->name, "sched_stat_runtime"))
1590 process_sched_runtime_event(raw, event, cpu, timestamp, thread); 1581 process_sched_runtime_event(data, event, cpu, timestamp, thread);
1591 if (!strcmp(event->name, "sched_wakeup")) 1582 if (!strcmp(event->name, "sched_wakeup"))
1592 process_sched_wakeup_event(raw, event, cpu, timestamp, thread); 1583 process_sched_wakeup_event(data, event, cpu, timestamp, thread);
1593 if (!strcmp(event->name, "sched_wakeup_new")) 1584 if (!strcmp(event->name, "sched_wakeup_new"))
1594 process_sched_wakeup_event(raw, event, cpu, timestamp, thread); 1585 process_sched_wakeup_event(data, event, cpu, timestamp, thread);
1595 if (!strcmp(event->name, "sched_process_fork")) 1586 if (!strcmp(event->name, "sched_process_fork"))
1596 process_sched_fork_event(raw, event, cpu, timestamp, thread); 1587 process_sched_fork_event(data, event, cpu, timestamp, thread);
1597 if (!strcmp(event->name, "sched_process_exit")) 1588 if (!strcmp(event->name, "sched_process_exit"))
1598 process_sched_exit_event(event, cpu, timestamp, thread); 1589 process_sched_exit_event(event, cpu, timestamp, thread);
1599 if (!strcmp(event->name, "sched_migrate_task")) 1590 if (!strcmp(event->name, "sched_migrate_task"))
1600 process_sched_migrate_task_event(raw, event, cpu, timestamp, thread); 1591 process_sched_migrate_task_event(data, event, cpu, timestamp, thread);
1601} 1592}
1602 1593
1603static int process_sample_event(event_t *event) 1594static int process_sample_event(event_t *event)
@@ -1633,8 +1624,7 @@ static int process_sample_event(event_t *event)
1633 if (profile_cpu != -1 && profile_cpu != (int)data.cpu) 1624 if (profile_cpu != -1 && profile_cpu != (int)data.cpu)
1634 return 0; 1625 return 0;
1635 1626
1636 process_raw_event(event, data.raw_size, data.raw_data, data.cpu, 1627 process_raw_event(event, data.raw_data, data.cpu, data.time, thread);
1637 data.time, thread);
1638 1628
1639 return 0; 1629 return 0;
1640} 1630}