builtin-trace.c (49af9e93adfa11d50435aa079299a765843532fc) builtin-trace.c (50c95cbd70808aa2e5ba8d79e503456f1da37aeb)
1#include <traceevent/event-parse.h>
2#include "builtin.h"
3#include "util/color.h"
4#include "util/debug.h"
5#include "util/evlist.h"
6#include "util/machine.h"
7#include "util/session.h"
8#include "util/thread.h"

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

721 FILE *output;
722 unsigned long nr_events;
723 struct strlist *ev_qualifier;
724 bool not_ev_qualifier;
725 struct intlist *tid_list;
726 struct intlist *pid_list;
727 bool sched;
728 bool multiple_threads;
1#include <traceevent/event-parse.h>
2#include "builtin.h"
3#include "util/color.h"
4#include "util/debug.h"
5#include "util/evlist.h"
6#include "util/machine.h"
7#include "util/session.h"
8#include "util/thread.h"

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

721 FILE *output;
722 unsigned long nr_events;
723 struct strlist *ev_qualifier;
724 bool not_ev_qualifier;
725 struct intlist *tid_list;
726 struct intlist *pid_list;
727 bool sched;
728 bool multiple_threads;
729 bool show_comm;
729 double duration_filter;
730 double runtime_ms;
731};
732
733static bool trace__filter_duration(struct trace *trace, double t)
734{
735 return t < (trace->duration_filter * NSEC_PER_MSEC);
736}

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

750}
751
752static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thread,
753 u64 duration, u64 tstamp, FILE *fp)
754{
755 size_t printed = trace__fprintf_tstamp(trace, tstamp, fp);
756 printed += fprintf_duration(duration, fp);
757
730 double duration_filter;
731 double runtime_ms;
732};
733
734static bool trace__filter_duration(struct trace *trace, double t)
735{
736 return t < (trace->duration_filter * NSEC_PER_MSEC);
737}

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

751}
752
753static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thread,
754 u64 duration, u64 tstamp, FILE *fp)
755{
756 size_t printed = trace__fprintf_tstamp(trace, tstamp, fp);
757 printed += fprintf_duration(duration, fp);
758
758 if (trace->multiple_threads)
759 if (trace->multiple_threads) {
760 if (trace->show_comm)
761 printed += fprintf(fp, "%.14s/", thread->comm);
759 printed += fprintf(fp, "%d ", thread->tid);
762 printed += fprintf(fp, "%d ", thread->tid);
763 }
760
761 return printed;
762}
763
764static int trace__process_event(struct trace *trace, struct machine *machine,
765 union perf_event *event)
766{
767 int ret = 0;

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

1498 .uses_mmap = true,
1499 },
1500 .user_freq = UINT_MAX,
1501 .user_interval = ULLONG_MAX,
1502 .no_delay = true,
1503 .mmap_pages = 1024,
1504 },
1505 .output = stdout,
764
765 return printed;
766}
767
768static int trace__process_event(struct trace *trace, struct machine *machine,
769 union perf_event *event)
770{
771 int ret = 0;

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

1502 .uses_mmap = true,
1503 },
1504 .user_freq = UINT_MAX,
1505 .user_interval = ULLONG_MAX,
1506 .no_delay = true,
1507 .mmap_pages = 1024,
1508 },
1509 .output = stdout,
1510 .show_comm = true,
1506 };
1507 const char *output_name = NULL;
1508 const char *ev_qualifier_str = NULL;
1509 const struct option trace_options[] = {
1511 };
1512 const char *output_name = NULL;
1513 const char *ev_qualifier_str = NULL;
1514 const struct option trace_options[] = {
1515 OPT_BOOLEAN(0, "comm", &trace.show_comm,
1516 "show the thread COMM next to its id"),
1510 OPT_STRING('e', "expr", &ev_qualifier_str, "expr",
1511 "list of events to trace"),
1512 OPT_STRING('o', "output", &output_name, "file", "output file name"),
1513 OPT_STRING('i', "input", &input_name, "file", "Analyze events in file"),
1514 OPT_STRING('p', "pid", &trace.opts.target.pid, "pid",
1515 "trace events on existing process id"),
1516 OPT_STRING('t', "tid", &trace.opts.target.tid, "tid",
1517 "trace events on existing thread id"),

--- 78 unchanged lines hidden ---
1517 OPT_STRING('e', "expr", &ev_qualifier_str, "expr",
1518 "list of events to trace"),
1519 OPT_STRING('o', "output", &output_name, "file", "output file name"),
1520 OPT_STRING('i', "input", &input_name, "file", "Analyze events in file"),
1521 OPT_STRING('p', "pid", &trace.opts.target.pid, "pid",
1522 "trace events on existing process id"),
1523 OPT_STRING('t', "tid", &trace.opts.target.tid, "tid",
1524 "trace events on existing thread id"),

--- 78 unchanged lines hidden ---