Lines Matching defs:ttrace

1279 	struct thread_trace *ttrace =  zalloc(sizeof(struct thread_trace));
1281 if (ttrace) {
1282 ttrace->files.max = -1;
1283 ttrace->syscall_stats = intlist__new(NULL);
1286 return ttrace;
1291 struct thread_trace *ttrace;
1302 ttrace = thread__priv(thread);
1303 ++ttrace->nr_events;
1305 return ttrace;
1316 struct thread_trace *ttrace = thread__priv(arg->thread);
1318 ttrace->ret_scnprintf = ret_scnprintf;
1326 static struct file *thread_trace__files_entry(struct thread_trace *ttrace, int fd)
1331 if (fd > ttrace->files.max) {
1332 struct file *nfiles = realloc(ttrace->files.table, (fd + 1) * sizeof(struct file));
1337 if (ttrace->files.max != -1) {
1338 memset(nfiles + ttrace->files.max + 1, 0,
1339 (fd - ttrace->files.max) * sizeof(struct file));
1344 ttrace->files.table = nfiles;
1345 ttrace->files.max = fd;
1348 return ttrace->files.table + fd;
1358 struct thread_trace *ttrace = thread__priv(thread);
1359 struct file *file = thread_trace__files_entry(ttrace, fd);
1402 struct thread_trace *ttrace = thread__priv(thread);
1404 if (ttrace == NULL || trace->fd_path_disabled)
1410 if ((fd > ttrace->files.max || ttrace->files.table[fd].pathname == NULL)) {
1418 return ttrace->files.table[fd].pathname;
1455 struct thread_trace *ttrace = thread__priv(arg->thread);
1457 if (ttrace && fd >= 0 && fd <= ttrace->files.max)
1458 zfree(&ttrace->files.table[fd].pathname);
1466 struct thread_trace *ttrace = thread__priv(thread);
1468 ttrace->filename.ptr = ptr;
1469 ttrace->filename.entry_str_pos = bf - ttrace->entry_str;
1517 * using ttrace->entry_time for a thread that receives a sys_exit without
2006 struct thread_trace *ttrace = thread__priv(thread);
2013 ttrace->ret_scnprintf = NULL;
2149 static void thread__update_stats(struct thread *thread, struct thread_trace *ttrace,
2156 inode = intlist__findnew(ttrace->syscall_stats, id);
2173 if (ttrace->entry_time && sample->time > ttrace->entry_time)
2174 duration = sample->time - ttrace->entry_time;
2206 struct thread_trace *ttrace;
2213 ttrace = thread__priv(trace->current);
2215 if (!ttrace->entry_pending)
2218 printed = trace__fprintf_entry_head(trace, trace->current, 0, false, ttrace->entry_time, trace->output);
2219 printed += len = fprintf(trace->output, "%s)", ttrace->entry_str);
2226 ttrace->entry_pending = false;
2287 struct thread_trace *ttrace;
2293 ttrace = thread__trace(thread, trace->output);
2294 if (ttrace == NULL)
2301 if (ttrace->entry_str == NULL) {
2302 ttrace->entry_str = malloc(trace__entry_str_size);
2303 if (!ttrace->entry_str)
2321 ttrace->entry_time = sample->time;
2322 msg = ttrace->entry_str;
2332 trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output);
2333 printed = fprintf(trace->output, "%s)", ttrace->entry_str);
2339 ttrace->entry_pending = true;
2341 ttrace->filename.pending_open = false;
2357 struct thread_trace *ttrace;
2369 ttrace = thread__trace(thread, trace->output);
2371 * We need to get ttrace just to make sure it is there when syscall__scnprintf_args()
2374 if (ttrace == NULL)
2434 struct thread_trace *ttrace;
2440 ttrace = thread__trace(thread, trace->output);
2441 if (ttrace == NULL)
2449 thread__update_stats(thread, ttrace, id, sample, ret, trace->errno_summary);
2451 if (!trace->fd_path_disabled && sc->is_open && ret >= 0 && ttrace->filename.pending_open) {
2452 trace__set_fd_pathname(thread, ret, ttrace->filename.name);
2453 ttrace->filename.pending_open = false;
2457 if (ttrace->entry_time) {
2458 duration = sample->time - ttrace->entry_time;
2477 trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace->output);
2479 if (ttrace->entry_pending) {
2480 printed = fprintf(trace->output, "%s", ttrace->entry_str);
2512 else if (ttrace->ret_scnprintf) {
2519 ttrace->ret_scnprintf(bf, sizeof(bf), &arg);
2520 ttrace->ret_scnprintf = NULL;
2550 ttrace->entry_pending = false;
2562 struct thread_trace *ttrace;
2571 ttrace = thread__priv(thread);
2572 if (!ttrace)
2579 if (ttrace->filename.namelen < filename_len) {
2580 char *f = realloc(ttrace->filename.name, filename_len + 1);
2585 ttrace->filename.namelen = filename_len;
2586 ttrace->filename.name = f;
2589 strcpy(ttrace->filename.name, filename);
2590 ttrace->filename.pending_open = true;
2592 if (!ttrace->filename.ptr)
2595 entry_str_len = strlen(ttrace->entry_str);
2605 to_move = entry_str_len - ttrace->filename.entry_str_pos + 1; /* \0 */
2606 pos = ttrace->entry_str + ttrace->filename.entry_str_pos;
2610 ttrace->filename.ptr = 0;
2611 ttrace->filename.entry_str_pos = 0;
2627 struct thread_trace *ttrace = thread__trace(thread, trace->output);
2629 if (ttrace == NULL)
2632 ttrace->runtime_ms += runtime_ms;
2868 struct thread_trace *ttrace;
2883 ttrace = thread__trace(thread, trace->output);
2884 if (ttrace == NULL)
2888 ttrace->pfmaj++;
2890 ttrace->pfmin++;
4310 static size_t thread__dump_stats(struct thread_trace *ttrace,
4316 DECLARE_RESORT_RB_INTLIST(syscall_stats, ttrace->syscall_stats);
4366 struct thread_trace *ttrace = thread__priv(thread);
4369 if (ttrace == NULL)
4372 ratio = (double)ttrace->nr_events / trace->nr_events * 100.0;
4375 printed += fprintf(fp, "%lu events, ", ttrace->nr_events);
4377 if (ttrace->pfmaj)
4378 printed += fprintf(fp, ", %lu majfaults", ttrace->pfmaj);
4379 if (ttrace->pfmin)
4380 printed += fprintf(fp, ", %lu minfaults", ttrace->pfmin);
4382 printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms);
4386 printed += thread__dump_stats(ttrace, trace, fp);
4391 static unsigned long thread__nr_events(struct thread_trace *ttrace)
4393 return ttrace ? ttrace->nr_events : 0;