Lines Matching refs:ttrace
1287 struct thread_trace *ttrace = zalloc(sizeof(struct thread_trace)); in thread_trace__new() local
1289 if (ttrace) { in thread_trace__new()
1290 ttrace->files.max = -1; in thread_trace__new()
1291 ttrace->syscall_stats = intlist__new(NULL); in thread_trace__new()
1294 return ttrace; in thread_trace__new()
1299 struct thread_trace *ttrace; in thread__trace() local
1310 ttrace = thread__priv(thread); in thread__trace()
1311 ++ttrace->nr_events; in thread__trace()
1313 return ttrace; in thread__trace()
1324 struct thread_trace *ttrace = thread__priv(arg->thread); in syscall_arg__set_ret_scnprintf() local
1326 ttrace->ret_scnprintf = ret_scnprintf; in syscall_arg__set_ret_scnprintf()
1334 static struct file *thread_trace__files_entry(struct thread_trace *ttrace, int fd) in thread_trace__files_entry() argument
1339 if (fd > ttrace->files.max) { in thread_trace__files_entry()
1340 struct file *nfiles = realloc(ttrace->files.table, (fd + 1) * sizeof(struct file)); in thread_trace__files_entry()
1345 if (ttrace->files.max != -1) { in thread_trace__files_entry()
1346 memset(nfiles + ttrace->files.max + 1, 0, in thread_trace__files_entry()
1347 (fd - ttrace->files.max) * sizeof(struct file)); in thread_trace__files_entry()
1352 ttrace->files.table = nfiles; in thread_trace__files_entry()
1353 ttrace->files.max = fd; in thread_trace__files_entry()
1356 return ttrace->files.table + fd; in thread_trace__files_entry()
1366 struct thread_trace *ttrace = thread__priv(thread); in trace__set_fd_pathname() local
1367 struct file *file = thread_trace__files_entry(ttrace, fd); in trace__set_fd_pathname()
1410 struct thread_trace *ttrace = thread__priv(thread); in thread__fd_path() local
1412 if (ttrace == NULL || trace->fd_path_disabled) in thread__fd_path()
1418 if ((fd > ttrace->files.max || ttrace->files.table[fd].pathname == NULL)) { in thread__fd_path()
1426 return ttrace->files.table[fd].pathname; in thread__fd_path()
1463 struct thread_trace *ttrace = thread__priv(arg->thread); in syscall_arg__scnprintf_close_fd() local
1465 if (ttrace && fd >= 0 && fd <= ttrace->files.max) in syscall_arg__scnprintf_close_fd()
1466 zfree(&ttrace->files.table[fd].pathname); in syscall_arg__scnprintf_close_fd()
1474 struct thread_trace *ttrace = thread__priv(thread); in thread__set_filename_pos() local
1476 ttrace->filename.ptr = ptr; in thread__set_filename_pos()
1477 ttrace->filename.entry_str_pos = bf - ttrace->entry_str; in thread__set_filename_pos()
2014 struct thread_trace *ttrace = thread__priv(thread); in syscall__scnprintf_args() local
2021 ttrace->ret_scnprintf = NULL; in syscall__scnprintf_args()
2160 static void thread__update_stats(struct thread *thread, struct thread_trace *ttrace, argument
2167 inode = intlist__findnew(ttrace->syscall_stats, id);
2181 if (ttrace->entry_time && sample->time > ttrace->entry_time)
2182 duration = sample->time - ttrace->entry_time;
2214 struct thread_trace *ttrace; local
2221 ttrace = thread__priv(trace->current);
2223 if (!ttrace->entry_pending)
2226 …printed = trace__fprintf_entry_head(trace, trace->current, 0, false, ttrace->entry_time, trace->o…
2227 printed += len = fprintf(trace->output, "%s)", ttrace->entry_str);
2234 ttrace->entry_pending = false;
2303 struct thread_trace *ttrace; local
2309 ttrace = thread__trace(thread, trace->output);
2310 if (ttrace == NULL)
2317 if (ttrace->entry_str == NULL) {
2318 ttrace->entry_str = malloc(trace__entry_str_size);
2319 if (!ttrace->entry_str)
2337 ttrace->entry_time = sample->time;
2338 msg = ttrace->entry_str;
2348 trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output);
2349 printed = fprintf(trace->output, "%s)", ttrace->entry_str);
2355 ttrace->entry_pending = true;
2357 ttrace->filename.pending_open = false;
2373 struct thread_trace *ttrace; local
2385 ttrace = thread__trace(thread, trace->output);
2390 if (ttrace == NULL)
2450 struct thread_trace *ttrace; local
2456 ttrace = thread__trace(thread, trace->output);
2457 if (ttrace == NULL)
2465 thread__update_stats(thread, ttrace, id, sample, ret, trace->errno_summary);
2467 if (!trace->fd_path_disabled && sc->is_open && ret >= 0 && ttrace->filename.pending_open) {
2468 trace__set_fd_pathname(thread, ret, ttrace->filename.name);
2469 ttrace->filename.pending_open = false;
2473 if (ttrace->entry_time) {
2474 duration = sample->time - ttrace->entry_time;
2493 …trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace-…
2495 if (ttrace->entry_pending) {
2496 printed = fprintf(trace->output, "%s", ttrace->entry_str);
2528 else if (ttrace->ret_scnprintf) {
2535 ttrace->ret_scnprintf(bf, sizeof(bf), &arg);
2536 ttrace->ret_scnprintf = NULL;
2566 ttrace->entry_pending = false;
2578 struct thread_trace *ttrace; local
2587 ttrace = thread__priv(thread);
2588 if (!ttrace)
2595 if (ttrace->filename.namelen < filename_len) {
2596 char *f = realloc(ttrace->filename.name, filename_len + 1);
2601 ttrace->filename.namelen = filename_len;
2602 ttrace->filename.name = f;
2605 strcpy(ttrace->filename.name, filename);
2606 ttrace->filename.pending_open = true;
2608 if (!ttrace->filename.ptr)
2611 entry_str_len = strlen(ttrace->entry_str);
2621 to_move = entry_str_len - ttrace->filename.entry_str_pos + 1; /* \0 */
2622 pos = ttrace->entry_str + ttrace->filename.entry_str_pos;
2626 ttrace->filename.ptr = 0;
2627 ttrace->filename.entry_str_pos = 0;
2643 struct thread_trace *ttrace = thread__trace(thread, trace->output); local
2645 if (ttrace == NULL)
2648 ttrace->runtime_ms += runtime_ms;
2882 struct thread_trace *ttrace; local
2897 ttrace = thread__trace(thread, trace->output);
2898 if (ttrace == NULL)
2902 ttrace->pfmaj++;
2904 ttrace->pfmin++;
4343 static size_t thread__dump_stats(struct thread_trace *ttrace, argument
4349 DECLARE_RESORT_RB_INTLIST(syscall_stats, ttrace->syscall_stats);
4399 struct thread_trace *ttrace = thread__priv(thread); local
4402 if (ttrace == NULL)
4405 ratio = (double)ttrace->nr_events / trace->nr_events * 100.0;
4408 printed += fprintf(fp, "%lu events, ", ttrace->nr_events);
4410 if (ttrace->pfmaj)
4411 printed += fprintf(fp, ", %lu majfaults", ttrace->pfmaj);
4412 if (ttrace->pfmin)
4413 printed += fprintf(fp, ", %lu minfaults", ttrace->pfmin);
4415 printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms);
4419 printed += thread__dump_stats(ttrace, trace, fp);
4424 static unsigned long thread__nr_events(struct thread_trace *ttrace) argument
4426 return ttrace ? ttrace->nr_events : 0;