Lines Matching refs:ttrace
1277 struct thread_trace *ttrace = zalloc(sizeof(struct thread_trace)); in thread_trace__new() local
1279 if (ttrace) { in thread_trace__new()
1280 ttrace->files.max = -1; in thread_trace__new()
1281 ttrace->syscall_stats = intlist__new(NULL); in thread_trace__new()
1284 return ttrace; in thread_trace__new()
1289 struct thread_trace *ttrace; in thread__trace() local
1300 ttrace = thread__priv(thread); in thread__trace()
1301 ++ttrace->nr_events; in thread__trace()
1303 return ttrace; in thread__trace()
1314 struct thread_trace *ttrace = thread__priv(arg->thread); in syscall_arg__set_ret_scnprintf() local
1316 ttrace->ret_scnprintf = ret_scnprintf; in syscall_arg__set_ret_scnprintf()
1324 static struct file *thread_trace__files_entry(struct thread_trace *ttrace, int fd) in thread_trace__files_entry() argument
1329 if (fd > ttrace->files.max) { in thread_trace__files_entry()
1330 struct file *nfiles = realloc(ttrace->files.table, (fd + 1) * sizeof(struct file)); in thread_trace__files_entry()
1335 if (ttrace->files.max != -1) { in thread_trace__files_entry()
1336 memset(nfiles + ttrace->files.max + 1, 0, in thread_trace__files_entry()
1337 (fd - ttrace->files.max) * sizeof(struct file)); in thread_trace__files_entry()
1342 ttrace->files.table = nfiles; in thread_trace__files_entry()
1343 ttrace->files.max = fd; in thread_trace__files_entry()
1346 return ttrace->files.table + fd; in thread_trace__files_entry()
1356 struct thread_trace *ttrace = thread__priv(thread); in trace__set_fd_pathname() local
1357 struct file *file = thread_trace__files_entry(ttrace, fd); in trace__set_fd_pathname()
1400 struct thread_trace *ttrace = thread__priv(thread); in thread__fd_path() local
1402 if (ttrace == NULL || trace->fd_path_disabled) in thread__fd_path()
1408 if ((fd > ttrace->files.max || ttrace->files.table[fd].pathname == NULL)) { in thread__fd_path()
1416 return ttrace->files.table[fd].pathname; in thread__fd_path()
1453 struct thread_trace *ttrace = thread__priv(arg->thread); in syscall_arg__scnprintf_close_fd() local
1455 if (ttrace && fd >= 0 && fd <= ttrace->files.max) in syscall_arg__scnprintf_close_fd()
1456 zfree(&ttrace->files.table[fd].pathname); in syscall_arg__scnprintf_close_fd()
1464 struct thread_trace *ttrace = thread__priv(thread); in thread__set_filename_pos() local
1466 ttrace->filename.ptr = ptr; in thread__set_filename_pos()
1467 ttrace->filename.entry_str_pos = bf - ttrace->entry_str; in thread__set_filename_pos()
1997 struct thread_trace *ttrace = thread__priv(thread); in syscall__scnprintf_args() local
2004 ttrace->ret_scnprintf = NULL; in syscall__scnprintf_args()
2143 static void thread__update_stats(struct thread *thread, struct thread_trace *ttrace, argument
2150 inode = intlist__findnew(ttrace->syscall_stats, id);
2167 if (ttrace->entry_time && sample->time > ttrace->entry_time)
2168 duration = sample->time - ttrace->entry_time;
2200 struct thread_trace *ttrace; local
2207 ttrace = thread__priv(trace->current);
2209 if (!ttrace->entry_pending)
2212 …printed = trace__fprintf_entry_head(trace, trace->current, 0, false, ttrace->entry_time, trace->o…
2213 printed += len = fprintf(trace->output, "%s)", ttrace->entry_str);
2220 ttrace->entry_pending = false;
2281 struct thread_trace *ttrace; local
2287 ttrace = thread__trace(thread, trace->output);
2288 if (ttrace == NULL)
2295 if (ttrace->entry_str == NULL) {
2296 ttrace->entry_str = malloc(trace__entry_str_size);
2297 if (!ttrace->entry_str)
2315 ttrace->entry_time = sample->time;
2316 msg = ttrace->entry_str;
2326 trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output);
2327 printed = fprintf(trace->output, "%s)", ttrace->entry_str);
2333 ttrace->entry_pending = true;
2335 ttrace->filename.pending_open = false;
2351 struct thread_trace *ttrace; local
2363 ttrace = thread__trace(thread, trace->output);
2368 if (ttrace == NULL)
2428 struct thread_trace *ttrace; local
2434 ttrace = thread__trace(thread, trace->output);
2435 if (ttrace == NULL)
2443 thread__update_stats(thread, ttrace, id, sample, ret, trace->errno_summary);
2445 if (!trace->fd_path_disabled && sc->is_open && ret >= 0 && ttrace->filename.pending_open) {
2446 trace__set_fd_pathname(thread, ret, ttrace->filename.name);
2447 ttrace->filename.pending_open = false;
2451 if (ttrace->entry_time) {
2452 duration = sample->time - ttrace->entry_time;
2471 …trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace-…
2473 if (ttrace->entry_pending) {
2474 printed = fprintf(trace->output, "%s", ttrace->entry_str);
2506 else if (ttrace->ret_scnprintf) {
2513 ttrace->ret_scnprintf(bf, sizeof(bf), &arg);
2514 ttrace->ret_scnprintf = NULL;
2544 ttrace->entry_pending = false;
2556 struct thread_trace *ttrace; local
2565 ttrace = thread__priv(thread);
2566 if (!ttrace)
2573 if (ttrace->filename.namelen < filename_len) {
2574 char *f = realloc(ttrace->filename.name, filename_len + 1);
2579 ttrace->filename.namelen = filename_len;
2580 ttrace->filename.name = f;
2583 strcpy(ttrace->filename.name, filename);
2584 ttrace->filename.pending_open = true;
2586 if (!ttrace->filename.ptr)
2589 entry_str_len = strlen(ttrace->entry_str);
2599 to_move = entry_str_len - ttrace->filename.entry_str_pos + 1; /* \0 */
2600 pos = ttrace->entry_str + ttrace->filename.entry_str_pos;
2604 ttrace->filename.ptr = 0;
2605 ttrace->filename.entry_str_pos = 0;
2621 struct thread_trace *ttrace = thread__trace(thread, trace->output); local
2623 if (ttrace == NULL)
2626 ttrace->runtime_ms += runtime_ms;
2862 struct thread_trace *ttrace; local
2877 ttrace = thread__trace(thread, trace->output);
2878 if (ttrace == NULL)
2882 ttrace->pfmaj++;
2884 ttrace->pfmin++;
4304 static size_t thread__dump_stats(struct thread_trace *ttrace, argument
4310 DECLARE_RESORT_RB_INTLIST(syscall_stats, ttrace->syscall_stats);
4360 struct thread_trace *ttrace = thread__priv(thread); local
4363 if (ttrace == NULL)
4366 ratio = (double)ttrace->nr_events / trace->nr_events * 100.0;
4369 printed += fprintf(fp, "%lu events, ", ttrace->nr_events);
4371 if (ttrace->pfmaj)
4372 printed += fprintf(fp, ", %lu majfaults", ttrace->pfmaj);
4373 if (ttrace->pfmin)
4374 printed += fprintf(fp, ", %lu minfaults", ttrace->pfmin);
4376 printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms);
4380 printed += thread__dump_stats(ttrace, trace, fp);
4385 static unsigned long thread__nr_events(struct thread_trace *ttrace) argument
4387 return ttrace ? ttrace->nr_events : 0;