Robert Richter | 4e31902 | 2013-06-11 17:29:18 +0200 | [diff] [blame] | 1 | #include <traceevent/event-parse.h> |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 2 | #include "builtin.h" |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 3 | #include "util/color.h" |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 4 | #include "util/evlist.h" |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 5 | #include "util/machine.h" |
| 6 | #include "util/thread.h" |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 7 | #include "util/parse-options.h" |
| 8 | #include "util/thread_map.h" |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 9 | |
| 10 | #include <libaudit.h> |
| 11 | #include <stdlib.h> |
| 12 | |
| 13 | static struct syscall_fmt { |
| 14 | const char *name; |
Arnaldo Carvalho de Melo | aec1930 | 2012-09-27 13:16:00 -0300 | [diff] [blame] | 15 | const char *alias; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 16 | bool errmsg; |
| 17 | bool timeout; |
| 18 | } syscall_fmts[] = { |
Arnaldo Carvalho de Melo | 8b74526 | 2012-10-18 19:06:13 -0300 | [diff] [blame] | 19 | { .name = "access", .errmsg = true, }, |
Arnaldo Carvalho de Melo | aec1930 | 2012-09-27 13:16:00 -0300 | [diff] [blame] | 20 | { .name = "arch_prctl", .errmsg = true, .alias = "prctl", }, |
Arnaldo Carvalho de Melo | a14bb86 | 2013-07-30 16:38:23 -0300 | [diff] [blame^] | 21 | { .name = "connect", .errmsg = true, }, |
Arnaldo Carvalho de Melo | aec1930 | 2012-09-27 13:16:00 -0300 | [diff] [blame] | 22 | { .name = "fstat", .errmsg = true, .alias = "newfstat", }, |
| 23 | { .name = "fstatat", .errmsg = true, .alias = "newfstatat", }, |
| 24 | { .name = "futex", .errmsg = true, }, |
Arnaldo Carvalho de Melo | 8b74526 | 2012-10-18 19:06:13 -0300 | [diff] [blame] | 25 | { .name = "open", .errmsg = true, }, |
Arnaldo Carvalho de Melo | aec1930 | 2012-09-27 13:16:00 -0300 | [diff] [blame] | 26 | { .name = "poll", .errmsg = true, .timeout = true, }, |
| 27 | { .name = "ppoll", .errmsg = true, .timeout = true, }, |
| 28 | { .name = "read", .errmsg = true, }, |
| 29 | { .name = "recvfrom", .errmsg = true, }, |
| 30 | { .name = "select", .errmsg = true, .timeout = true, }, |
Arnaldo Carvalho de Melo | 8b74526 | 2012-10-18 19:06:13 -0300 | [diff] [blame] | 31 | { .name = "socket", .errmsg = true, }, |
Arnaldo Carvalho de Melo | aec1930 | 2012-09-27 13:16:00 -0300 | [diff] [blame] | 32 | { .name = "stat", .errmsg = true, .alias = "newstat", }, |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | static int syscall_fmt__cmp(const void *name, const void *fmtp) |
| 36 | { |
| 37 | const struct syscall_fmt *fmt = fmtp; |
| 38 | return strcmp(name, fmt->name); |
| 39 | } |
| 40 | |
| 41 | static struct syscall_fmt *syscall_fmt__find(const char *name) |
| 42 | { |
| 43 | const int nmemb = ARRAY_SIZE(syscall_fmts); |
| 44 | return bsearch(name, syscall_fmts, nmemb, sizeof(struct syscall_fmt), syscall_fmt__cmp); |
| 45 | } |
| 46 | |
| 47 | struct syscall { |
| 48 | struct event_format *tp_format; |
| 49 | const char *name; |
| 50 | struct syscall_fmt *fmt; |
| 51 | }; |
| 52 | |
Arnaldo Carvalho de Melo | 60c907a | 2012-10-24 17:24:47 -0200 | [diff] [blame] | 53 | static size_t fprintf_duration(unsigned long t, FILE *fp) |
| 54 | { |
| 55 | double duration = (double)t / NSEC_PER_MSEC; |
| 56 | size_t printed = fprintf(fp, "("); |
| 57 | |
| 58 | if (duration >= 1.0) |
| 59 | printed += color_fprintf(fp, PERF_COLOR_RED, "%6.3f ms", duration); |
| 60 | else if (duration >= 0.01) |
| 61 | printed += color_fprintf(fp, PERF_COLOR_YELLOW, "%6.3f ms", duration); |
| 62 | else |
| 63 | printed += color_fprintf(fp, PERF_COLOR_NORMAL, "%6.3f ms", duration); |
| 64 | return printed + fprintf(stdout, "): "); |
| 65 | } |
| 66 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 67 | struct thread_trace { |
| 68 | u64 entry_time; |
| 69 | u64 exit_time; |
| 70 | bool entry_pending; |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 71 | unsigned long nr_events; |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 72 | char *entry_str; |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 73 | double runtime_ms; |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | static struct thread_trace *thread_trace__new(void) |
| 77 | { |
| 78 | return zalloc(sizeof(struct thread_trace)); |
| 79 | } |
| 80 | |
| 81 | static struct thread_trace *thread__trace(struct thread *thread) |
| 82 | { |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 83 | struct thread_trace *ttrace; |
| 84 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 85 | if (thread == NULL) |
| 86 | goto fail; |
| 87 | |
| 88 | if (thread->priv == NULL) |
| 89 | thread->priv = thread_trace__new(); |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 90 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 91 | if (thread->priv == NULL) |
| 92 | goto fail; |
| 93 | |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 94 | ttrace = thread->priv; |
| 95 | ++ttrace->nr_events; |
| 96 | |
| 97 | return ttrace; |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 98 | fail: |
| 99 | color_fprintf(stdout, PERF_COLOR_RED, |
| 100 | "WARNING: not enough memory, dropping samples!\n"); |
| 101 | return NULL; |
| 102 | } |
| 103 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 104 | struct trace { |
| 105 | int audit_machine; |
| 106 | struct { |
| 107 | int max; |
| 108 | struct syscall *table; |
| 109 | } syscalls; |
| 110 | struct perf_record_opts opts; |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 111 | struct machine host; |
| 112 | u64 base_time; |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 113 | unsigned long nr_events; |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 114 | bool sched; |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 115 | bool multiple_threads; |
Arnaldo Carvalho de Melo | ae9ed03 | 2012-10-08 09:56:00 -0300 | [diff] [blame] | 116 | double duration_filter; |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 117 | double runtime_ms; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 118 | }; |
| 119 | |
Arnaldo Carvalho de Melo | ae9ed03 | 2012-10-08 09:56:00 -0300 | [diff] [blame] | 120 | static bool trace__filter_duration(struct trace *trace, double t) |
| 121 | { |
| 122 | return t < (trace->duration_filter * NSEC_PER_MSEC); |
| 123 | } |
| 124 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 125 | static size_t trace__fprintf_tstamp(struct trace *trace, u64 tstamp, FILE *fp) |
| 126 | { |
| 127 | double ts = (double)(tstamp - trace->base_time) / NSEC_PER_MSEC; |
| 128 | |
Arnaldo Carvalho de Melo | 60c907a | 2012-10-24 17:24:47 -0200 | [diff] [blame] | 129 | return fprintf(fp, "%10.3f ", ts); |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 130 | } |
| 131 | |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 132 | static bool done = false; |
| 133 | |
| 134 | static void sig_handler(int sig __maybe_unused) |
| 135 | { |
| 136 | done = true; |
| 137 | } |
| 138 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 139 | static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thread, |
Arnaldo Carvalho de Melo | 60c907a | 2012-10-24 17:24:47 -0200 | [diff] [blame] | 140 | u64 duration, u64 tstamp, FILE *fp) |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 141 | { |
| 142 | size_t printed = trace__fprintf_tstamp(trace, tstamp, fp); |
Arnaldo Carvalho de Melo | 60c907a | 2012-10-24 17:24:47 -0200 | [diff] [blame] | 143 | printed += fprintf_duration(duration, fp); |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 144 | |
| 145 | if (trace->multiple_threads) |
Adrian Hunter | 3805123 | 2013-07-04 16:20:31 +0300 | [diff] [blame] | 146 | printed += fprintf(fp, "%d ", thread->tid); |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 147 | |
| 148 | return printed; |
| 149 | } |
| 150 | |
| 151 | static int trace__process_event(struct machine *machine, union perf_event *event) |
| 152 | { |
| 153 | int ret = 0; |
| 154 | |
| 155 | switch (event->header.type) { |
| 156 | case PERF_RECORD_LOST: |
| 157 | color_fprintf(stdout, PERF_COLOR_RED, |
| 158 | "LOST %" PRIu64 " events!\n", event->lost.lost); |
| 159 | ret = machine__process_lost_event(machine, event); |
| 160 | default: |
| 161 | ret = machine__process_event(machine, event); |
| 162 | break; |
| 163 | } |
| 164 | |
| 165 | return ret; |
| 166 | } |
| 167 | |
| 168 | static int trace__tool_process(struct perf_tool *tool __maybe_unused, |
| 169 | union perf_event *event, |
| 170 | struct perf_sample *sample __maybe_unused, |
| 171 | struct machine *machine) |
| 172 | { |
| 173 | return trace__process_event(machine, event); |
| 174 | } |
| 175 | |
| 176 | static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist) |
| 177 | { |
| 178 | int err = symbol__init(); |
| 179 | |
| 180 | if (err) |
| 181 | return err; |
| 182 | |
| 183 | machine__init(&trace->host, "", HOST_KERNEL_ID); |
| 184 | machine__create_kernel_maps(&trace->host); |
| 185 | |
| 186 | if (perf_target__has_task(&trace->opts.target)) { |
| 187 | err = perf_event__synthesize_thread_map(NULL, evlist->threads, |
| 188 | trace__tool_process, |
| 189 | &trace->host); |
| 190 | } else { |
| 191 | err = perf_event__synthesize_threads(NULL, trace__tool_process, |
| 192 | &trace->host); |
| 193 | } |
| 194 | |
| 195 | if (err) |
| 196 | symbol__exit(); |
| 197 | |
| 198 | return err; |
| 199 | } |
| 200 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 201 | static int trace__read_syscall_info(struct trace *trace, int id) |
| 202 | { |
| 203 | char tp_name[128]; |
| 204 | struct syscall *sc; |
Arnaldo Carvalho de Melo | 3a53126 | 2012-10-20 12:39:03 -0300 | [diff] [blame] | 205 | const char *name = audit_syscall_to_name(id, trace->audit_machine); |
| 206 | |
| 207 | if (name == NULL) |
| 208 | return -1; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 209 | |
| 210 | if (id > trace->syscalls.max) { |
| 211 | struct syscall *nsyscalls = realloc(trace->syscalls.table, (id + 1) * sizeof(*sc)); |
| 212 | |
| 213 | if (nsyscalls == NULL) |
| 214 | return -1; |
| 215 | |
| 216 | if (trace->syscalls.max != -1) { |
| 217 | memset(nsyscalls + trace->syscalls.max + 1, 0, |
| 218 | (id - trace->syscalls.max) * sizeof(*sc)); |
| 219 | } else { |
| 220 | memset(nsyscalls, 0, (id + 1) * sizeof(*sc)); |
| 221 | } |
| 222 | |
| 223 | trace->syscalls.table = nsyscalls; |
| 224 | trace->syscalls.max = id; |
| 225 | } |
| 226 | |
| 227 | sc = trace->syscalls.table + id; |
Arnaldo Carvalho de Melo | 3a53126 | 2012-10-20 12:39:03 -0300 | [diff] [blame] | 228 | sc->name = name; |
| 229 | sc->fmt = syscall_fmt__find(sc->name); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 230 | |
Arnaldo Carvalho de Melo | aec1930 | 2012-09-27 13:16:00 -0300 | [diff] [blame] | 231 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name); |
| 232 | sc->tp_format = event_format__new("syscalls", tp_name); |
| 233 | |
| 234 | if (sc->tp_format == NULL && sc->fmt && sc->fmt->alias) { |
| 235 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->fmt->alias); |
| 236 | sc->tp_format = event_format__new("syscalls", tp_name); |
| 237 | } |
| 238 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 239 | return sc->tp_format != NULL ? 0 : -1; |
| 240 | } |
| 241 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 242 | static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size, |
| 243 | unsigned long *args) |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 244 | { |
| 245 | int i = 0; |
| 246 | size_t printed = 0; |
| 247 | |
| 248 | if (sc->tp_format != NULL) { |
| 249 | struct format_field *field; |
| 250 | |
| 251 | for (field = sc->tp_format->format.fields->next; field; field = field->next) { |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 252 | printed += scnprintf(bf + printed, size - printed, |
| 253 | "%s%s: %ld", printed ? ", " : "", |
| 254 | field->name, args[i++]); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 255 | } |
| 256 | } else { |
| 257 | while (i < 6) { |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 258 | printed += scnprintf(bf + printed, size - printed, |
| 259 | "%sarg%d: %ld", |
| 260 | printed ? ", " : "", i, args[i]); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 261 | ++i; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | return printed; |
| 266 | } |
| 267 | |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 268 | typedef int (*tracepoint_handler)(struct trace *trace, struct perf_evsel *evsel, |
| 269 | struct perf_sample *sample); |
| 270 | |
| 271 | static struct syscall *trace__syscall_info(struct trace *trace, |
| 272 | struct perf_evsel *evsel, |
| 273 | struct perf_sample *sample) |
| 274 | { |
| 275 | int id = perf_evsel__intval(evsel, sample, "id"); |
| 276 | |
| 277 | if (id < 0) { |
| 278 | printf("Invalid syscall %d id, skipping...\n", id); |
| 279 | return NULL; |
| 280 | } |
| 281 | |
| 282 | if ((id > trace->syscalls.max || trace->syscalls.table[id].name == NULL) && |
| 283 | trace__read_syscall_info(trace, id)) |
| 284 | goto out_cant_read; |
| 285 | |
| 286 | if ((id > trace->syscalls.max || trace->syscalls.table[id].name == NULL)) |
| 287 | goto out_cant_read; |
| 288 | |
| 289 | return &trace->syscalls.table[id]; |
| 290 | |
| 291 | out_cant_read: |
Arnaldo Carvalho de Melo | 814d7a4 | 2012-10-24 18:44:13 -0200 | [diff] [blame] | 292 | printf("Problems reading syscall %d", id); |
| 293 | if (id <= trace->syscalls.max && trace->syscalls.table[id].name != NULL) |
| 294 | printf("(%s)", trace->syscalls.table[id].name); |
| 295 | puts(" information"); |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 296 | return NULL; |
| 297 | } |
| 298 | |
| 299 | static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, |
| 300 | struct perf_sample *sample) |
| 301 | { |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 302 | char *msg; |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 303 | void *args; |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 304 | size_t printed = 0; |
| 305 | struct thread *thread = machine__findnew_thread(&trace->host, sample->tid); |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 306 | struct syscall *sc = trace__syscall_info(trace, evsel, sample); |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 307 | struct thread_trace *ttrace = thread__trace(thread); |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 308 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 309 | if (ttrace == NULL || sc == NULL) |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 310 | return -1; |
| 311 | |
| 312 | args = perf_evsel__rawptr(evsel, sample, "args"); |
| 313 | if (args == NULL) { |
| 314 | printf("Problems reading syscall arguments\n"); |
| 315 | return -1; |
| 316 | } |
| 317 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 318 | ttrace = thread->priv; |
| 319 | |
| 320 | if (ttrace->entry_str == NULL) { |
| 321 | ttrace->entry_str = malloc(1024); |
| 322 | if (!ttrace->entry_str) |
| 323 | return -1; |
| 324 | } |
| 325 | |
| 326 | ttrace->entry_time = sample->time; |
| 327 | msg = ttrace->entry_str; |
| 328 | printed += scnprintf(msg + printed, 1024 - printed, "%s(", sc->name); |
| 329 | |
| 330 | printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed, args); |
| 331 | |
| 332 | if (!strcmp(sc->name, "exit_group") || !strcmp(sc->name, "exit")) { |
Arnaldo Carvalho de Melo | ae9ed03 | 2012-10-08 09:56:00 -0300 | [diff] [blame] | 333 | if (!trace->duration_filter) { |
| 334 | trace__fprintf_entry_head(trace, thread, 1, sample->time, stdout); |
| 335 | printf("%-70s\n", ttrace->entry_str); |
| 336 | } |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 337 | } else |
| 338 | ttrace->entry_pending = true; |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 339 | |
| 340 | return 0; |
| 341 | } |
| 342 | |
| 343 | static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, |
| 344 | struct perf_sample *sample) |
| 345 | { |
| 346 | int ret; |
Arnaldo Carvalho de Melo | 60c907a | 2012-10-24 17:24:47 -0200 | [diff] [blame] | 347 | u64 duration = 0; |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 348 | struct thread *thread = machine__findnew_thread(&trace->host, sample->tid); |
| 349 | struct thread_trace *ttrace = thread__trace(thread); |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 350 | struct syscall *sc = trace__syscall_info(trace, evsel, sample); |
| 351 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 352 | if (ttrace == NULL || sc == NULL) |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 353 | return -1; |
| 354 | |
| 355 | ret = perf_evsel__intval(evsel, sample, "ret"); |
| 356 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 357 | ttrace = thread->priv; |
| 358 | |
| 359 | ttrace->exit_time = sample->time; |
| 360 | |
Arnaldo Carvalho de Melo | ae9ed03 | 2012-10-08 09:56:00 -0300 | [diff] [blame] | 361 | if (ttrace->entry_time) { |
Arnaldo Carvalho de Melo | 60c907a | 2012-10-24 17:24:47 -0200 | [diff] [blame] | 362 | duration = sample->time - ttrace->entry_time; |
Arnaldo Carvalho de Melo | ae9ed03 | 2012-10-08 09:56:00 -0300 | [diff] [blame] | 363 | if (trace__filter_duration(trace, duration)) |
| 364 | goto out; |
| 365 | } else if (trace->duration_filter) |
| 366 | goto out; |
Arnaldo Carvalho de Melo | 60c907a | 2012-10-24 17:24:47 -0200 | [diff] [blame] | 367 | |
| 368 | trace__fprintf_entry_head(trace, thread, duration, sample->time, stdout); |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 369 | |
| 370 | if (ttrace->entry_pending) { |
| 371 | printf("%-70s", ttrace->entry_str); |
| 372 | } else { |
| 373 | printf(" ... ["); |
| 374 | color_fprintf(stdout, PERF_COLOR_YELLOW, "continued"); |
| 375 | printf("]: %s()", sc->name); |
| 376 | } |
| 377 | |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 378 | if (ret < 0 && sc->fmt && sc->fmt->errmsg) { |
| 379 | char bf[256]; |
| 380 | const char *emsg = strerror_r(-ret, bf, sizeof(bf)), |
| 381 | *e = audit_errno_to_name(-ret); |
| 382 | |
| 383 | printf(") = -1 %s %s", e, emsg); |
| 384 | } else if (ret == 0 && sc->fmt && sc->fmt->timeout) |
| 385 | printf(") = 0 Timeout"); |
| 386 | else |
| 387 | printf(") = %d", ret); |
| 388 | |
| 389 | putchar('\n'); |
Arnaldo Carvalho de Melo | ae9ed03 | 2012-10-08 09:56:00 -0300 | [diff] [blame] | 390 | out: |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 391 | ttrace->entry_pending = false; |
| 392 | |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 393 | return 0; |
| 394 | } |
| 395 | |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 396 | static int trace__sched_stat_runtime(struct trace *trace, struct perf_evsel *evsel, |
| 397 | struct perf_sample *sample) |
| 398 | { |
| 399 | u64 runtime = perf_evsel__intval(evsel, sample, "runtime"); |
| 400 | double runtime_ms = (double)runtime / NSEC_PER_MSEC; |
| 401 | struct thread *thread = machine__findnew_thread(&trace->host, sample->tid); |
| 402 | struct thread_trace *ttrace = thread__trace(thread); |
| 403 | |
| 404 | if (ttrace == NULL) |
| 405 | goto out_dump; |
| 406 | |
| 407 | ttrace->runtime_ms += runtime_ms; |
| 408 | trace->runtime_ms += runtime_ms; |
| 409 | return 0; |
| 410 | |
| 411 | out_dump: |
| 412 | printf("%s: comm=%s,pid=%u,runtime=%" PRIu64 ",vruntime=%" PRIu64 ")\n", |
| 413 | evsel->name, |
| 414 | perf_evsel__strval(evsel, sample, "comm"), |
| 415 | (pid_t)perf_evsel__intval(evsel, sample, "pid"), |
| 416 | runtime, |
| 417 | perf_evsel__intval(evsel, sample, "vruntime")); |
| 418 | return 0; |
| 419 | } |
| 420 | |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 421 | static int trace__run(struct trace *trace, int argc, const char **argv) |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 422 | { |
Namhyung Kim | 334fe7a | 2013-03-11 16:43:12 +0900 | [diff] [blame] | 423 | struct perf_evlist *evlist = perf_evlist__new(); |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 424 | struct perf_evsel *evsel; |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 425 | int err = -1, i; |
| 426 | unsigned long before; |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 427 | const bool forks = argc > 0; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 428 | |
| 429 | if (evlist == NULL) { |
| 430 | printf("Not enough memory to run!\n"); |
| 431 | goto out; |
| 432 | } |
| 433 | |
Arnaldo Carvalho de Melo | 39876e7 | 2012-10-03 11:40:22 -0300 | [diff] [blame] | 434 | if (perf_evlist__add_newtp(evlist, "raw_syscalls", "sys_enter", trace__sys_enter) || |
| 435 | perf_evlist__add_newtp(evlist, "raw_syscalls", "sys_exit", trace__sys_exit)) { |
| 436 | printf("Couldn't read the raw_syscalls tracepoints information!\n"); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 437 | goto out_delete_evlist; |
| 438 | } |
| 439 | |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 440 | if (trace->sched && |
| 441 | perf_evlist__add_newtp(evlist, "sched", "sched_stat_runtime", |
| 442 | trace__sched_stat_runtime)) { |
| 443 | printf("Couldn't read the sched_stat_runtime tracepoint information!\n"); |
| 444 | goto out_delete_evlist; |
| 445 | } |
| 446 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 447 | err = perf_evlist__create_maps(evlist, &trace->opts.target); |
| 448 | if (err < 0) { |
| 449 | printf("Problems parsing the target to trace, check your options!\n"); |
| 450 | goto out_delete_evlist; |
| 451 | } |
| 452 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 453 | err = trace__symbols_init(trace, evlist); |
| 454 | if (err < 0) { |
| 455 | printf("Problems initializing symbol libraries!\n"); |
Namhyung Kim | 3beb086 | 2013-03-15 14:48:50 +0900 | [diff] [blame] | 456 | goto out_delete_maps; |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 457 | } |
| 458 | |
Arnaldo Carvalho de Melo | f77a951 | 2012-12-10 16:41:31 -0300 | [diff] [blame] | 459 | perf_evlist__config(evlist, &trace->opts); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 460 | |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 461 | signal(SIGCHLD, sig_handler); |
| 462 | signal(SIGINT, sig_handler); |
| 463 | |
| 464 | if (forks) { |
Namhyung Kim | 6ef73ec | 2013-03-11 16:43:15 +0900 | [diff] [blame] | 465 | err = perf_evlist__prepare_workload(evlist, &trace->opts.target, |
Namhyung Kim | 55e162e | 2013-03-11 16:43:17 +0900 | [diff] [blame] | 466 | argv, false, false); |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 467 | if (err < 0) { |
| 468 | printf("Couldn't run the workload!\n"); |
Namhyung Kim | 3beb086 | 2013-03-15 14:48:50 +0900 | [diff] [blame] | 469 | goto out_delete_maps; |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 470 | } |
| 471 | } |
| 472 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 473 | err = perf_evlist__open(evlist); |
| 474 | if (err < 0) { |
| 475 | printf("Couldn't create the events: %s\n", strerror(errno)); |
Namhyung Kim | 3beb086 | 2013-03-15 14:48:50 +0900 | [diff] [blame] | 476 | goto out_delete_maps; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | err = perf_evlist__mmap(evlist, UINT_MAX, false); |
| 480 | if (err < 0) { |
| 481 | printf("Couldn't mmap the events: %s\n", strerror(errno)); |
Namhyung Kim | 3beb086 | 2013-03-15 14:48:50 +0900 | [diff] [blame] | 482 | goto out_close_evlist; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 483 | } |
| 484 | |
| 485 | perf_evlist__enable(evlist); |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 486 | |
| 487 | if (forks) |
| 488 | perf_evlist__start_workload(evlist); |
| 489 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 490 | trace->multiple_threads = evlist->threads->map[0] == -1 || evlist->threads->nr > 1; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 491 | again: |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 492 | before = trace->nr_events; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 493 | |
| 494 | for (i = 0; i < evlist->nr_mmaps; i++) { |
| 495 | union perf_event *event; |
| 496 | |
| 497 | while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) { |
| 498 | const u32 type = event->header.type; |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 499 | tracepoint_handler handler; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 500 | struct perf_sample sample; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 501 | |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 502 | ++trace->nr_events; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 503 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 504 | err = perf_evlist__parse_sample(evlist, event, &sample); |
| 505 | if (err) { |
| 506 | printf("Can't parse sample, err = %d, skipping...\n", err); |
| 507 | continue; |
| 508 | } |
| 509 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 510 | if (trace->base_time == 0) |
| 511 | trace->base_time = sample.time; |
| 512 | |
| 513 | if (type != PERF_RECORD_SAMPLE) { |
| 514 | trace__process_event(&trace->host, event); |
| 515 | continue; |
| 516 | } |
| 517 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 518 | evsel = perf_evlist__id2evsel(evlist, sample.id); |
| 519 | if (evsel == NULL) { |
| 520 | printf("Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); |
| 521 | continue; |
| 522 | } |
| 523 | |
Arnaldo Carvalho de Melo | 752fde4 | 2012-10-06 18:43:19 -0300 | [diff] [blame] | 524 | if (sample.raw_data == NULL) { |
| 525 | printf("%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", |
| 526 | perf_evsel__name(evsel), sample.tid, |
| 527 | sample.cpu, sample.raw_size); |
| 528 | continue; |
| 529 | } |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 530 | |
Arnaldo Carvalho de Melo | ba3d7de | 2012-09-28 17:58:36 -0300 | [diff] [blame] | 531 | handler = evsel->handler.func; |
| 532 | handler(trace, evsel, &sample); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 533 | } |
| 534 | } |
| 535 | |
Arnaldo Carvalho de Melo | efd5745 | 2012-10-17 17:09:46 -0300 | [diff] [blame] | 536 | if (trace->nr_events == before) { |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 537 | if (done) |
Namhyung Kim | 3beb086 | 2013-03-15 14:48:50 +0900 | [diff] [blame] | 538 | goto out_unmap_evlist; |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 539 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 540 | poll(evlist->pollfd, evlist->nr_fds, -1); |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | if (done) |
| 544 | perf_evlist__disable(evlist); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 545 | |
| 546 | goto again; |
| 547 | |
Namhyung Kim | 3beb086 | 2013-03-15 14:48:50 +0900 | [diff] [blame] | 548 | out_unmap_evlist: |
| 549 | perf_evlist__munmap(evlist); |
| 550 | out_close_evlist: |
| 551 | perf_evlist__close(evlist); |
| 552 | out_delete_maps: |
| 553 | perf_evlist__delete_maps(evlist); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 554 | out_delete_evlist: |
| 555 | perf_evlist__delete(evlist); |
| 556 | out: |
| 557 | return err; |
| 558 | } |
| 559 | |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 560 | static size_t trace__fprintf_threads_header(FILE *fp) |
| 561 | { |
| 562 | size_t printed; |
| 563 | |
| 564 | printed = fprintf(fp, "\n _____________________________________________________________________\n"); |
| 565 | printed += fprintf(fp," __) Summary of events (__\n\n"); |
| 566 | printed += fprintf(fp," [ task - pid ] [ events ] [ ratio ] [ runtime ]\n"); |
| 567 | printed += fprintf(fp," _____________________________________________________________________\n\n"); |
| 568 | |
| 569 | return printed; |
| 570 | } |
| 571 | |
| 572 | static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp) |
| 573 | { |
| 574 | size_t printed = trace__fprintf_threads_header(fp); |
| 575 | struct rb_node *nd; |
| 576 | |
| 577 | for (nd = rb_first(&trace->host.threads); nd; nd = rb_next(nd)) { |
| 578 | struct thread *thread = rb_entry(nd, struct thread, rb_node); |
| 579 | struct thread_trace *ttrace = thread->priv; |
| 580 | const char *color; |
| 581 | double ratio; |
| 582 | |
| 583 | if (ttrace == NULL) |
| 584 | continue; |
| 585 | |
| 586 | ratio = (double)ttrace->nr_events / trace->nr_events * 100.0; |
| 587 | |
| 588 | color = PERF_COLOR_NORMAL; |
| 589 | if (ratio > 50.0) |
| 590 | color = PERF_COLOR_RED; |
| 591 | else if (ratio > 25.0) |
| 592 | color = PERF_COLOR_GREEN; |
| 593 | else if (ratio > 5.0) |
| 594 | color = PERF_COLOR_YELLOW; |
| 595 | |
| 596 | printed += color_fprintf(fp, color, "%20s", thread->comm); |
Adrian Hunter | 3805123 | 2013-07-04 16:20:31 +0300 | [diff] [blame] | 597 | printed += fprintf(fp, " - %-5d :%11lu [", thread->tid, ttrace->nr_events); |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 598 | printed += color_fprintf(fp, color, "%5.1f%%", ratio); |
| 599 | printed += fprintf(fp, " ] %10.3f ms\n", ttrace->runtime_ms); |
| 600 | } |
| 601 | |
| 602 | return printed; |
| 603 | } |
| 604 | |
Arnaldo Carvalho de Melo | ae9ed03 | 2012-10-08 09:56:00 -0300 | [diff] [blame] | 605 | static int trace__set_duration(const struct option *opt, const char *str, |
| 606 | int unset __maybe_unused) |
| 607 | { |
| 608 | struct trace *trace = opt->value; |
| 609 | |
| 610 | trace->duration_filter = atof(str); |
| 611 | return 0; |
| 612 | } |
| 613 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 614 | int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) |
| 615 | { |
| 616 | const char * const trace_usage[] = { |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 617 | "perf trace [<options>] [<command>]", |
| 618 | "perf trace [<options>] -- <command> [<options>]", |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 619 | NULL |
| 620 | }; |
| 621 | struct trace trace = { |
| 622 | .audit_machine = audit_detect_machine(), |
| 623 | .syscalls = { |
| 624 | . max = -1, |
| 625 | }, |
| 626 | .opts = { |
| 627 | .target = { |
| 628 | .uid = UINT_MAX, |
| 629 | .uses_mmap = true, |
| 630 | }, |
| 631 | .user_freq = UINT_MAX, |
| 632 | .user_interval = ULLONG_MAX, |
| 633 | .no_delay = true, |
| 634 | .mmap_pages = 1024, |
| 635 | }, |
| 636 | }; |
| 637 | const struct option trace_options[] = { |
| 638 | OPT_STRING('p', "pid", &trace.opts.target.pid, "pid", |
| 639 | "trace events on existing process id"), |
| 640 | OPT_STRING(0, "tid", &trace.opts.target.tid, "tid", |
| 641 | "trace events on existing thread id"), |
| 642 | OPT_BOOLEAN(0, "all-cpus", &trace.opts.target.system_wide, |
| 643 | "system-wide collection from all CPUs"), |
| 644 | OPT_STRING(0, "cpu", &trace.opts.target.cpu_list, "cpu", |
| 645 | "list of cpus to monitor"), |
| 646 | OPT_BOOLEAN(0, "no-inherit", &trace.opts.no_inherit, |
| 647 | "child tasks do not inherit counters"), |
| 648 | OPT_UINTEGER(0, "mmap-pages", &trace.opts.mmap_pages, |
| 649 | "number of mmap data pages"), |
| 650 | OPT_STRING(0, "uid", &trace.opts.target.uid_str, "user", |
| 651 | "user to profile"), |
Arnaldo Carvalho de Melo | ae9ed03 | 2012-10-08 09:56:00 -0300 | [diff] [blame] | 652 | OPT_CALLBACK(0, "duration", &trace, "float", |
| 653 | "show only events with duration > N.M ms", |
| 654 | trace__set_duration), |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 655 | OPT_BOOLEAN(0, "sched", &trace.sched, "show blocking scheduler events"), |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 656 | OPT_END() |
| 657 | }; |
| 658 | int err; |
Namhyung Kim | 32caf0d | 2012-10-05 14:02:13 +0900 | [diff] [blame] | 659 | char bf[BUFSIZ]; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 660 | |
| 661 | argc = parse_options(argc, argv, trace_options, trace_usage, 0); |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 662 | |
Namhyung Kim | 32caf0d | 2012-10-05 14:02:13 +0900 | [diff] [blame] | 663 | err = perf_target__validate(&trace.opts.target); |
| 664 | if (err) { |
| 665 | perf_target__strerror(&trace.opts.target, err, bf, sizeof(bf)); |
| 666 | printf("%s", bf); |
| 667 | return err; |
| 668 | } |
| 669 | |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 670 | err = perf_target__parse_uid(&trace.opts.target); |
| 671 | if (err) { |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 672 | perf_target__strerror(&trace.opts.target, err, bf, sizeof(bf)); |
| 673 | printf("%s", bf); |
| 674 | return err; |
| 675 | } |
| 676 | |
Namhyung Kim | f15eb53 | 2012-10-05 14:02:16 +0900 | [diff] [blame] | 677 | if (!argc && perf_target__none(&trace.opts.target)) |
Namhyung Kim | ee76120 | 2012-10-05 14:02:14 +0900 | [diff] [blame] | 678 | trace.opts.target.system_wide = true; |
| 679 | |
Arnaldo Carvalho de Melo | 1302d88 | 2012-10-17 17:13:12 -0300 | [diff] [blame] | 680 | err = trace__run(&trace, argc, argv); |
| 681 | |
| 682 | if (trace.sched && !err) |
| 683 | trace__fprintf_thread_summary(&trace, stdout); |
| 684 | |
| 685 | return err; |
Arnaldo Carvalho de Melo | 514f1c6 | 2012-09-26 20:05:56 -0300 | [diff] [blame] | 686 | } |