builtin-trace.c (fbf8a1e12c3ba3afdf0804bc80f5f13dfec1cffe) builtin-trace.c (0a6545bda2756807a089c64352edfc5628c57e6c)
1/*
2 * builtin-trace.c
3 *
4 * Builtin 'trace' command:
5 *
6 * Display a continuously updated trace of any workload, CPU, specific PID,
7 * system wide, etc. Default format is loosely strace like, but any other
8 * event may be specified using --event.

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

107 unsigned int min_stack;
108 bool not_ev_qualifier;
109 bool live;
110 bool full_time;
111 bool sched;
112 bool multiple_threads;
113 bool summary;
114 bool summary_only;
1/*
2 * builtin-trace.c
3 *
4 * Builtin 'trace' command:
5 *
6 * Display a continuously updated trace of any workload, CPU, specific PID,
7 * system wide, etc. Default format is loosely strace like, but any other
8 * event may be specified using --event.

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

107 unsigned int min_stack;
108 bool not_ev_qualifier;
109 bool live;
110 bool full_time;
111 bool sched;
112 bool multiple_threads;
113 bool summary;
114 bool summary_only;
115 bool failure_only;
115 bool show_comm;
116 bool print_sample;
117 bool show_tool_stats;
118 bool trace_syscalls;
119 bool kernel_syscallchains;
120 bool force;
121 bool vfs_getname;
122 int trace_pgfaults;

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

1560 update_stats(stats, duration);
1561}
1562
1563static int trace__printf_interrupted_entry(struct trace *trace)
1564{
1565 struct thread_trace *ttrace;
1566 size_t printed;
1567
116 bool show_comm;
117 bool print_sample;
118 bool show_tool_stats;
119 bool trace_syscalls;
120 bool kernel_syscallchains;
121 bool force;
122 bool vfs_getname;
123 int trace_pgfaults;

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

1561 update_stats(stats, duration);
1562}
1563
1564static int trace__printf_interrupted_entry(struct trace *trace)
1565{
1566 struct thread_trace *ttrace;
1567 size_t printed;
1568
1568 if (trace->current == NULL)
1569 if (trace->failure_only || trace->current == NULL)
1569 return 0;
1570
1571 ttrace = thread__priv(trace->current);
1572
1573 if (!ttrace->entry_pending)
1574 return 0;
1575
1576 printed = trace__fprintf_entry_head(trace, trace->current, 0, false, ttrace->entry_time, trace->output);

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

1633 ttrace->entry_time = sample->time;
1634 msg = ttrace->entry_str;
1635 printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name);
1636
1637 printed += syscall__scnprintf_args(sc, msg + printed, trace__entry_str_size - printed,
1638 args, trace, thread);
1639
1640 if (sc->is_exit) {
1570 return 0;
1571
1572 ttrace = thread__priv(trace->current);
1573
1574 if (!ttrace->entry_pending)
1575 return 0;
1576
1577 printed = trace__fprintf_entry_head(trace, trace->current, 0, false, ttrace->entry_time, trace->output);

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

1634 ttrace->entry_time = sample->time;
1635 msg = ttrace->entry_str;
1636 printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name);
1637
1638 printed += syscall__scnprintf_args(sc, msg + printed, trace__entry_str_size - printed,
1639 args, trace, thread);
1640
1641 if (sc->is_exit) {
1641 if (!(trace->duration_filter || trace->summary_only || trace->min_stack)) {
1642 if (!(trace->duration_filter || trace->summary_only || trace->failure_only || trace->min_stack)) {
1642 trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output);
1643 fprintf(trace->output, "%-70s)\n", ttrace->entry_str);
1644 }
1645 } else {
1646 ttrace->entry_pending = true;
1647 /* See trace__vfs_getname & trace__sys_exit */
1648 ttrace->filename.pending_open = false;
1649 }

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

1737 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
1738 if (callchain_ret == 0) {
1739 if (callchain_cursor.nr < trace->min_stack)
1740 goto out;
1741 callchain_ret = 1;
1742 }
1743 }
1744
1643 trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output);
1644 fprintf(trace->output, "%-70s)\n", ttrace->entry_str);
1645 }
1646 } else {
1647 ttrace->entry_pending = true;
1648 /* See trace__vfs_getname & trace__sys_exit */
1649 ttrace->filename.pending_open = false;
1650 }

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

1738 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
1739 if (callchain_ret == 0) {
1740 if (callchain_cursor.nr < trace->min_stack)
1741 goto out;
1742 callchain_ret = 1;
1743 }
1744 }
1745
1745 if (trace->summary_only)
1746 if (trace->summary_only || (ret >= 0 && trace->failure_only))
1746 goto out;
1747
1748 trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace->output);
1749
1750 if (ttrace->entry_pending) {
1751 fprintf(trace->output, "%-70s", ttrace->entry_str);
1752 } else {
1753 fprintf(trace->output, " ... [");

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

3082 "user to profile"),
3083 OPT_CALLBACK(0, "duration", &trace, "float",
3084 "show only events with duration > N.M ms",
3085 trace__set_duration),
3086 OPT_BOOLEAN(0, "sched", &trace.sched, "show blocking scheduler events"),
3087 OPT_INCR('v', "verbose", &verbose, "be more verbose"),
3088 OPT_BOOLEAN('T', "time", &trace.full_time,
3089 "Show full timestamp, not time relative to first start"),
1747 goto out;
1748
1749 trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace->output);
1750
1751 if (ttrace->entry_pending) {
1752 fprintf(trace->output, "%-70s", ttrace->entry_str);
1753 } else {
1754 fprintf(trace->output, " ... [");

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

3083 "user to profile"),
3084 OPT_CALLBACK(0, "duration", &trace, "float",
3085 "show only events with duration > N.M ms",
3086 trace__set_duration),
3087 OPT_BOOLEAN(0, "sched", &trace.sched, "show blocking scheduler events"),
3088 OPT_INCR('v', "verbose", &verbose, "be more verbose"),
3089 OPT_BOOLEAN('T', "time", &trace.full_time,
3090 "Show full timestamp, not time relative to first start"),
3091 OPT_BOOLEAN(0, "failure", &trace.failure_only,
3092 "Show only syscalls that failed"),
3090 OPT_BOOLEAN('s', "summary", &trace.summary_only,
3091 "Show only syscall summary with statistics"),
3092 OPT_BOOLEAN('S', "with-summary", &trace.summary,
3093 "Show all syscalls and summary with statistics"),
3094 OPT_CALLBACK_DEFAULT('F', "pf", &trace.trace_pgfaults, "all|maj|min",
3095 "Trace pagefaults", parse_pagefaults, "maj"),
3096 OPT_BOOLEAN(0, "syscalls", &trace.trace_syscalls, "Trace syscalls"),
3097 OPT_BOOLEAN('f', "force", &trace.force, "don't complain, do it"),

--- 143 unchanged lines hidden ---
3093 OPT_BOOLEAN('s', "summary", &trace.summary_only,
3094 "Show only syscall summary with statistics"),
3095 OPT_BOOLEAN('S', "with-summary", &trace.summary,
3096 "Show all syscalls and summary with statistics"),
3097 OPT_CALLBACK_DEFAULT('F', "pf", &trace.trace_pgfaults, "all|maj|min",
3098 "Trace pagefaults", parse_pagefaults, "maj"),
3099 OPT_BOOLEAN(0, "syscalls", &trace.trace_syscalls, "Trace syscalls"),
3100 OPT_BOOLEAN('f', "force", &trace.force, "don't complain, do it"),

--- 143 unchanged lines hidden ---