Lines Matching refs:st
73 struct thread_stat *st; in thread_stat_find() local
77 st = container_of(node, struct thread_stat, rb); in thread_stat_find()
78 if (st->tid == tid) in thread_stat_find()
79 return st; in thread_stat_find()
80 else if (tid < st->tid) in thread_stat_find()
113 struct thread_stat *st; in thread_stat_findnew_after_first() local
115 st = thread_stat_find(tid); in thread_stat_findnew_after_first()
116 if (st) in thread_stat_findnew_after_first()
117 return st; in thread_stat_findnew_after_first()
119 st = zalloc(sizeof(struct thread_stat)); in thread_stat_findnew_after_first()
120 if (!st) { in thread_stat_findnew_after_first()
125 st->tid = tid; in thread_stat_findnew_after_first()
126 INIT_LIST_HEAD(&st->seq_list); in thread_stat_findnew_after_first()
128 thread_stat_insert(st); in thread_stat_findnew_after_first()
130 return st; in thread_stat_findnew_after_first()
139 struct thread_stat *st; in thread_stat_findnew_first() local
141 st = zalloc(sizeof(struct thread_stat)); in thread_stat_findnew_first()
142 if (!st) { in thread_stat_findnew_first()
146 st->tid = tid; in thread_stat_findnew_first()
147 INIT_LIST_HEAD(&st->seq_list); in thread_stat_findnew_first()
149 rb_link_node(&st->rb, NULL, &thread_stats.rb_node); in thread_stat_findnew_first()
150 rb_insert_color(&st->rb, &thread_stats); in thread_stat_findnew_first()
153 return st; in thread_stat_findnew_first()
379 static void combine_lock_stats(struct lock_stat *st) in combine_lock_stats() argument
390 if (st->name && p->name) in combine_lock_stats()
391 ret = strcmp(st->name, p->name); in combine_lock_stats()
393 ret = !!st->name - !!p->name; in combine_lock_stats()
396 p->nr_acquired += st->nr_acquired; in combine_lock_stats()
397 p->nr_contended += st->nr_contended; in combine_lock_stats()
398 p->wait_time_total += st->wait_time_total; in combine_lock_stats()
403 if (p->wait_time_min > st->wait_time_min) in combine_lock_stats()
404 p->wait_time_min = st->wait_time_min; in combine_lock_stats()
405 if (p->wait_time_max < st->wait_time_max) in combine_lock_stats()
406 p->wait_time_max = st->wait_time_max; in combine_lock_stats()
408 p->broken |= st->broken; in combine_lock_stats()
409 st->combined = 1; in combine_lock_stats()
419 rb_link_node(&st->rb, parent, rb); in combine_lock_stats()
420 rb_insert_color(&st->rb, &sorted); in combine_lock_stats()
423 static void insert_to(struct rb_root *rr, struct lock_stat *st, in insert_to() argument
434 if (bigger(st, p)) in insert_to()
440 rb_link_node(&st->rb, parent, rb); in insert_to()
441 rb_insert_color(&st->rb, rr); in insert_to()
444 static inline void insert_to_result(struct lock_stat *st, in insert_to_result() argument
448 if (combine_locks && st->combined) in insert_to_result()
450 insert_to(&result, st, bigger); in insert_to_result()
1278 struct lock_stat *st; in print_result() local
1291 while ((st = pop_from_result())) { in print_result()
1293 if (st->broken) in print_result()
1295 if (!st->nr_acquired) in print_result()
1300 if (strlen(st->name) < 20) { in print_result()
1302 const char *name = st->name; in print_result()
1308 t = perf_session__findnew(session, st->addr); in print_result()
1314 strncpy(cut_name, st->name, 16); in print_result()
1324 key->print(key, st); in print_result()
1340 struct thread_stat *st; in dump_threads() local
1348 st = container_of(node, struct thread_stat, rb); in dump_threads()
1349 t = perf_session__findnew(session, st->tid); in dump_threads()
1350 fprintf(lock_output, "%10d: %s\n", st->tid, thread__comm_str(t)); in dump_threads()
1374 struct lock_stat *st; in dump_map() local
1378 hlist_for_each_entry(st, &lockhash_table[i], hash_entry) { in dump_map()
1379 insert_to_result(st, compare_maps); in dump_map()
1383 while ((st = pop_from_result())) in dump_map()
1384 fprintf(lock_output, " %#llx: %s\n", (unsigned long long)st->addr, st->name); in dump_map()
1459 struct lock_stat *st; in combine_result() local
1465 hlist_for_each_entry(st, &lockhash_table[i], hash_entry) { in combine_result()
1466 combine_lock_stats(st); in combine_result()
1474 struct lock_stat *st; in sort_result() local
1477 hlist_for_each_entry(st, &lockhash_table[i], hash_entry) { in sort_result()
1478 insert_to_result(st, compare); in sort_result()
1627 static void print_lock_stat_stdio(struct lock_contention *con, struct lock_stat *st) in print_lock_stat_stdio() argument
1634 key->print(key, st); in print_lock_stat_stdio()
1640 fprintf(lock_output, " %10s %s\n", get_type_flags_name(st->flags), st->name); in print_lock_stat_stdio()
1643 pid = st->addr; in print_lock_stat_stdio()
1649 fprintf(lock_output, " %016llx %s (%s)\n", (unsigned long long)st->addr, in print_lock_stat_stdio()
1650 st->name, get_type_lock_name(st->flags)); in print_lock_stat_stdio()
1653 fprintf(lock_output, " %s\n", st->name); in print_lock_stat_stdio()
1666 if (!st->callstack || !st->callstack[i]) in print_lock_stat_stdio()
1669 ip = st->callstack[i]; in print_lock_stat_stdio()
1677 static void print_lock_stat_csv(struct lock_contention *con, struct lock_stat *st, in print_lock_stat_csv() argument
1685 key->print(key, st); in print_lock_stat_csv()
1691 fprintf(lock_output, "%s%s %s", get_type_flags_name(st->flags), sep, st->name); in print_lock_stat_csv()
1696 pid = st->addr; in print_lock_stat_csv()
1702 fprintf(lock_output, "%llx%s %s%s %s\n", (unsigned long long)st->addr, sep, in print_lock_stat_csv()
1703 st->name, sep, get_type_lock_name(st->flags)); in print_lock_stat_csv()
1706 fprintf(lock_output, "%s\n",st->name); in print_lock_stat_csv()
1719 if (!st->callstack || !st->callstack[i]) in print_lock_stat_csv()
1722 ip = st->callstack[i]; in print_lock_stat_csv()
1731 static void print_lock_stat(struct lock_contention *con, struct lock_stat *st) in print_lock_stat() argument
1734 print_lock_stat_csv(con, st, symbol_conf.field_sep); in print_lock_stat()
1736 print_lock_stat_stdio(con, st); in print_lock_stat()
1800 struct lock_stat *st; in print_contention_result() local
1808 while ((st = pop_from_result())) { in print_contention_result()
1809 total += use_bpf ? st->nr_contended : 1; in print_contention_result()
1810 if (st->broken) in print_contention_result()
1813 if (!st->wait_time_total) in print_contention_result()
1816 print_lock_stat(con, st); in print_contention_result()
1829 while ((st = pop_owner_stack_trace(con))) in print_contention_result()
1830 insert_to(&root, st, compare); in print_contention_result()
1832 while ((st = pop_from(&root))) { in print_contention_result()
1833 print_lock_stat(con, st); in print_contention_result()
1834 free(st); in print_contention_result()
1840 while ((st = pop_from_result())) { in print_contention_result()
1841 total += use_bpf ? st->nr_contended : 1; in print_contention_result()
1842 if (st->broken) in print_contention_result()