Lines Matching defs:ttrace
1287 struct thread_trace *ttrace = zalloc(sizeof(struct thread_trace));
1289 if (ttrace) {
1290 ttrace->files.max = -1;
1291 ttrace->syscall_stats = intlist__new(NULL);
1294 return ttrace;
1297 static void thread_trace__free_files(struct thread_trace *ttrace);
1301 struct thread_trace *ttrace = pttrace;
1303 if (!ttrace)
1306 intlist__delete(ttrace->syscall_stats);
1307 ttrace->syscall_stats = NULL;
1308 thread_trace__free_files(ttrace);
1309 zfree(&ttrace->entry_str);
1310 free(ttrace);
1315 struct thread_trace *ttrace;
1326 ttrace = thread__priv(thread);
1327 ++ttrace->nr_events;
1329 return ttrace;
1340 struct thread_trace *ttrace = thread__priv(arg->thread);
1342 ttrace->ret_scnprintf = ret_scnprintf;
1350 static void thread_trace__free_files(struct thread_trace *ttrace)
1352 for (int i = 0; i < ttrace->files.max; ++i) {
1353 struct file *file = ttrace->files.table + i;
1357 zfree(&ttrace->files.table);
1358 ttrace->files.max = -1;
1361 static struct file *thread_trace__files_entry(struct thread_trace *ttrace, int fd)
1366 if (fd > ttrace->files.max) {
1367 struct file *nfiles = realloc(ttrace->files.table, (fd + 1) * sizeof(struct file));
1372 if (ttrace->files.max != -1) {
1373 memset(nfiles + ttrace->files.max + 1, 0,
1374 (fd - ttrace->files.max) * sizeof(struct file));
1379 ttrace->files.table = nfiles;
1380 ttrace->files.max = fd;
1383 return ttrace->files.table + fd;
1393 struct thread_trace *ttrace = thread__priv(thread);
1394 struct file *file = thread_trace__files_entry(ttrace, fd);
1438 struct thread_trace *ttrace = thread__priv(thread);
1440 if (ttrace == NULL || trace->fd_path_disabled)
1446 if ((fd > ttrace->files.max || ttrace->files.table[fd].pathname == NULL)) {
1454 return ttrace->files.table[fd].pathname;
1491 struct thread_trace *ttrace = thread__priv(arg->thread);
1493 if (ttrace && fd >= 0 && fd <= ttrace->files.max)
1494 zfree(&ttrace->files.table[fd].pathname);
1502 struct thread_trace *ttrace = thread__priv(thread);
1504 ttrace->filename.ptr = ptr;
1505 ttrace->filename.entry_str_pos = bf - ttrace->entry_str;
1553 * using ttrace->entry_time for a thread that receives a sys_exit without
2053 struct thread_trace *ttrace = thread__priv(thread);
2060 ttrace->ret_scnprintf = NULL;
2196 static void thread__update_stats(struct thread *thread, struct thread_trace *ttrace,
2203 inode = intlist__findnew(ttrace->syscall_stats, id);
2217 if (ttrace->entry_time && sample->time > ttrace->entry_time)
2218 duration = sample->time - ttrace->entry_time;
2251 struct thread_trace *ttrace;
2258 ttrace = thread__priv(trace->current);
2260 if (!ttrace->entry_pending)
2263 printed = trace__fprintf_entry_head(trace, trace->current, 0, false, ttrace->entry_time, trace->output);
2264 printed += len = fprintf(trace->output, "%s)", ttrace->entry_str);
2271 ttrace->entry_pending = false;
2340 struct thread_trace *ttrace;
2346 ttrace = thread__trace(thread, trace->output);
2347 if (ttrace == NULL)
2354 if (ttrace->entry_str == NULL) {
2355 ttrace->entry_str = malloc(trace__entry_str_size);
2356 if (!ttrace->entry_str)
2374 ttrace->entry_time = sample->time;
2375 msg = ttrace->entry_str;
2385 trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output);
2386 printed = fprintf(trace->output, "%s)", ttrace->entry_str);
2392 ttrace->entry_pending = true;
2394 ttrace->filename.pending_open = false;
2410 struct thread_trace *ttrace;
2422 ttrace = thread__trace(thread, trace->output);
2424 * We need to get ttrace just to make sure it is there when syscall__scnprintf_args()
2427 if (ttrace == NULL)
2489 struct thread_trace *ttrace;
2495 ttrace = thread__trace(thread, trace->output);
2496 if (ttrace == NULL)
2504 thread__update_stats(thread, ttrace, id, sample, ret, trace->errno_summary);
2506 if (!trace->fd_path_disabled && sc->is_open && ret >= 0 && ttrace->filename.pending_open) {
2507 trace__set_fd_pathname(thread, ret, ttrace->filename.name);
2508 ttrace->filename.pending_open = false;
2512 if (ttrace->entry_time) {
2513 duration = sample->time - ttrace->entry_time;
2534 trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace->output);
2536 if (ttrace->entry_pending) {
2537 printed = fprintf(trace->output, "%s", ttrace->entry_str);
2569 else if (ttrace->ret_scnprintf) {
2576 ttrace->ret_scnprintf(bf, sizeof(bf), &arg);
2577 ttrace->ret_scnprintf = NULL;
2607 ttrace->entry_pending = false;
2619 struct thread_trace *ttrace;
2628 ttrace = thread__priv(thread);
2629 if (!ttrace)
2636 if (ttrace->filename.namelen < filename_len) {
2637 char *f = realloc(ttrace->filename.name, filename_len + 1);
2642 ttrace->filename.namelen = filename_len;
2643 ttrace->filename.name = f;
2646 strcpy(ttrace->filename.name, filename);
2647 ttrace->filename.pending_open = true;
2649 if (!ttrace->filename.ptr)
2652 entry_str_len = strlen(ttrace->entry_str);
2662 to_move = entry_str_len - ttrace->filename.entry_str_pos + 1; /* \0 */
2663 pos = ttrace->entry_str + ttrace->filename.entry_str_pos;
2667 ttrace->filename.ptr = 0;
2668 ttrace->filename.entry_str_pos = 0;
2684 struct thread_trace *ttrace = thread__trace(thread, trace->output);
2686 if (ttrace == NULL)
2689 ttrace->runtime_ms += runtime_ms;
2925 struct thread_trace *ttrace;
2943 ttrace = thread__trace(thread, trace->output);
2944 if (ttrace == NULL)
2948 ttrace->pfmaj++;
2950 ttrace->pfmin++;
4231 static size_t thread__dump_stats(struct thread_trace *ttrace,
4237 DECLARE_RESORT_RB_INTLIST(syscall_stats, ttrace->syscall_stats);
4287 struct thread_trace *ttrace = thread__priv(thread);
4290 if (ttrace == NULL)
4293 ratio = (double)ttrace->nr_events / trace->nr_events * 100.0;
4296 printed += fprintf(fp, "%lu events, ", ttrace->nr_events);
4298 if (ttrace->pfmaj)
4299 printed += fprintf(fp, ", %lu majfaults", ttrace->pfmaj);
4300 if (ttrace->pfmin)
4301 printed += fprintf(fp, ", %lu minfaults", ttrace->pfmin);
4303 printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms);
4307 printed += thread__dump_stats(ttrace, trace, fp);
4312 static unsigned long thread__nr_events(struct thread_trace *ttrace)
4314 return ttrace ? ttrace->nr_events : 0;