builtin-sched.c (b5fae128e41021889777f8ead810cbd2a8b249fc) builtin-sched.c (1fc35b29b4098aa3bf9fc9acb4c1615d0b5dd95d)
1#include "builtin.h"
2#include "perf.h"
3
4#include "util/util.h"
5#include "util/cache.h"
6#include "util/symbol.h"
7#include "util/thread.h"
8#include "util/header.h"

--- 1642 unchanged lines hidden (view full) ---

1651 }
1652 }
1653
1654 free(str);
1655
1656 sort_dimension__add((char *)"pid", &cmp_pid);
1657}
1658
1#include "builtin.h"
2#include "perf.h"
3
4#include "util/util.h"
5#include "util/cache.h"
6#include "util/symbol.h"
7#include "util/thread.h"
8#include "util/header.h"

--- 1642 unchanged lines hidden (view full) ---

1651 }
1652 }
1653
1654 free(str);
1655
1656 sort_dimension__add((char *)"pid", &cmp_pid);
1657}
1658
1659static const char *record_args[] = {
1660 "record",
1661 "-a",
1662 "-R",
1663 "-c", "1",
1664 "-e", "sched:sched_switch:r",
1665 "-e", "sched:sched_stat_wait:r",
1666 "-e", "sched:sched_stat_sleep:r",
1667 "-e", "sched:sched_stat_iowait:r",
1668 "-e", "sched:sched_process_exit:r",
1669 "-e", "sched:sched_process_fork:r",
1670 "-e", "sched:sched_wakeup:r",
1671 "-e", "sched:sched_migrate_task:r",
1672};
1673
1674static int __cmd_record(int argc, const char **argv)
1675{
1676 unsigned int rec_argc, i, j;
1677 const char **rec_argv;
1678
1679 rec_argc = ARRAY_SIZE(record_args) + argc - 1;
1680 rec_argv = calloc(rec_argc + 1, sizeof(char *));
1681
1682 for (i = 0; i < ARRAY_SIZE(record_args); i++)
1683 rec_argv[i] = strdup(record_args[i]);
1684
1685 for (j = 1; j < (unsigned int)argc; j++, i++)
1686 rec_argv[i] = argv[j];
1687
1688 BUG_ON(i != rec_argc);
1689
1690 return cmd_record(i, rec_argv, NULL);
1691}
1692
1659int cmd_sched(int argc, const char **argv, const char *prefix __used)
1660{
1661 symbol__init();
1662 page_size = getpagesize();
1663
1664 argc = parse_options(argc, argv, sched_options, sched_usage,
1665 PARSE_OPT_STOP_AT_NON_OPTION);
1666 if (!argc)
1667 usage_with_options(sched_usage, sched_options);
1668
1693int cmd_sched(int argc, const char **argv, const char *prefix __used)
1694{
1695 symbol__init();
1696 page_size = getpagesize();
1697
1698 argc = parse_options(argc, argv, sched_options, sched_usage,
1699 PARSE_OPT_STOP_AT_NON_OPTION);
1700 if (!argc)
1701 usage_with_options(sched_usage, sched_options);
1702
1669 if (!strncmp(argv[0], "lat", 3)) {
1703 if (!strncmp(argv[0], "rec", 3)) {
1704 return __cmd_record(argc, argv);
1705 } else if (!strncmp(argv[0], "lat", 3)) {
1670 trace_handler = &lat_ops;
1671 if (argc > 1) {
1672 argc = parse_options(argc, argv, latency_options, latency_usage, 0);
1673 if (argc)
1674 usage_with_options(latency_usage, latency_options);
1675 }
1676 setup_sorting();
1677 __cmd_lat();

--- 4 unchanged lines hidden (view full) ---

1682 if (argc)
1683 usage_with_options(replay_usage, replay_options);
1684 }
1685 __cmd_replay();
1686 } else {
1687 usage_with_options(sched_usage, sched_options);
1688 }
1689
1706 trace_handler = &lat_ops;
1707 if (argc > 1) {
1708 argc = parse_options(argc, argv, latency_options, latency_usage, 0);
1709 if (argc)
1710 usage_with_options(latency_usage, latency_options);
1711 }
1712 setup_sorting();
1713 __cmd_lat();

--- 4 unchanged lines hidden (view full) ---

1718 if (argc)
1719 usage_with_options(replay_usage, replay_options);
1720 }
1721 __cmd_replay();
1722 } else {
1723 usage_with_options(sched_usage, sched_options);
1724 }
1725
1690
1691 return 0;
1692}
1726 return 0;
1727}