Lines Matching refs:tep
164 static int cmdline_init(struct tep_handle *tep) in cmdline_init() argument
166 struct cmdline_list *cmdlist = tep->cmdlist; in cmdline_init()
171 cmdlines = malloc(sizeof(*cmdlines) * tep->cmdline_count); in cmdline_init()
185 qsort(cmdlines, tep->cmdline_count, sizeof(*cmdlines), cmdline_cmp); in cmdline_init()
187 tep->cmdlines = cmdlines; in cmdline_init()
188 tep->cmdlist = NULL; in cmdline_init()
193 static const char *find_cmdline(struct tep_handle *tep, int pid) in find_cmdline() argument
201 if (!tep->cmdlines && cmdline_init(tep)) in find_cmdline()
206 comm = bsearch(&key, tep->cmdlines, tep->cmdline_count, in find_cmdline()
207 sizeof(*tep->cmdlines), cmdline_cmp); in find_cmdline()
222 bool tep_is_pid_registered(struct tep_handle *tep, int pid) in tep_is_pid_registered() argument
230 if (!tep->cmdlines && cmdline_init(tep)) in tep_is_pid_registered()
235 comm = bsearch(&key, tep->cmdlines, tep->cmdline_count, in tep_is_pid_registered()
236 sizeof(*tep->cmdlines), cmdline_cmp); in tep_is_pid_registered()
248 static int add_new_comm(struct tep_handle *tep, in add_new_comm() argument
251 struct tep_cmdline *cmdlines = tep->cmdlines; in add_new_comm()
263 cmdline = bsearch(&key, tep->cmdlines, tep->cmdline_count, in add_new_comm()
264 sizeof(*tep->cmdlines), cmdline_cmp); in add_new_comm()
281 cmdlines = realloc(cmdlines, sizeof(*cmdlines) * (tep->cmdline_count + 1)); in add_new_comm()
286 tep->cmdlines = cmdlines; in add_new_comm()
294 if (!tep->cmdline_count) { in add_new_comm()
296 tep->cmdlines[0] = key; in add_new_comm()
297 tep->cmdline_count++; in add_new_comm()
302 cmdline = bsearch(&key, tep->cmdlines, tep->cmdline_count - 1, in add_new_comm()
303 sizeof(*tep->cmdlines), cmdline_slot_cmp); in add_new_comm()
305 cnt = tep->cmdline_count; in add_new_comm()
309 cnt -= cmdline - tep->cmdlines; in add_new_comm()
313 if (key.pid > tep->cmdlines[tep->cmdline_count - 1].pid) { in add_new_comm()
314 tep->cmdlines[tep->cmdline_count++] = key; in add_new_comm()
317 cmdline = &tep->cmdlines[0]; in add_new_comm()
322 tep->cmdline_count++; in add_new_comm()
327 static int _tep_register_comm(struct tep_handle *tep, in _tep_register_comm() argument
332 if (tep->cmdlines) in _tep_register_comm()
333 return add_new_comm(tep, comm, pid, override); in _tep_register_comm()
348 item->next = tep->cmdlist; in _tep_register_comm()
350 tep->cmdlist = item; in _tep_register_comm()
351 tep->cmdline_count++; in _tep_register_comm()
366 int tep_register_comm(struct tep_handle *tep, const char *comm, int pid) in tep_register_comm() argument
368 return _tep_register_comm(tep, comm, pid, false); in tep_register_comm()
381 int tep_override_comm(struct tep_handle *tep, const char *comm, int pid) in tep_override_comm() argument
383 if (!tep->cmdlines && cmdline_init(tep)) { in tep_override_comm()
387 return _tep_register_comm(tep, comm, pid, true); in tep_override_comm()
437 static int func_map_init(struct tep_handle *tep) in func_map_init() argument
444 func_map = malloc(sizeof(*func_map) * (tep->func_count + 1)); in func_map_init()
448 funclist = tep->funclist; in func_map_init()
461 qsort(func_map, tep->func_count, sizeof(*func_map), func_cmp); in func_map_init()
466 func_map[tep->func_count].func = NULL; in func_map_init()
467 func_map[tep->func_count].addr = 0; in func_map_init()
468 func_map[tep->func_count].mod = NULL; in func_map_init()
470 tep->func_map = func_map; in func_map_init()
471 tep->funclist = NULL; in func_map_init()
477 __find_func(struct tep_handle *tep, unsigned long long addr) in __find_func() argument
482 if (!tep->func_map) in __find_func()
483 func_map_init(tep); in __find_func()
487 func = bsearch(&key, tep->func_map, tep->func_count, in __find_func()
488 sizeof(*tep->func_map), func_bcmp); in __find_func()
508 int tep_set_function_resolver(struct tep_handle *tep, in tep_set_function_resolver() argument
519 free(tep->func_resolver); in tep_set_function_resolver()
520 tep->func_resolver = resolver; in tep_set_function_resolver()
532 void tep_reset_function_resolver(struct tep_handle *tep) in tep_reset_function_resolver() argument
534 free(tep->func_resolver); in tep_reset_function_resolver()
535 tep->func_resolver = NULL; in tep_reset_function_resolver()
539 find_func(struct tep_handle *tep, unsigned long long addr) in find_func() argument
543 if (!tep->func_resolver) in find_func()
544 return __find_func(tep, addr); in find_func()
546 map = &tep->func_resolver->map; in find_func()
549 map->func = tep->func_resolver->func(tep->func_resolver->priv, in find_func()
566 const char *tep_find_function(struct tep_handle *tep, unsigned long long addr) in tep_find_function() argument
570 map = find_func(tep, addr); in tep_find_function()
587 tep_find_function_address(struct tep_handle *tep, unsigned long long addr) in tep_find_function_address() argument
591 map = find_func(tep, addr); in tep_find_function_address()
608 int tep_register_function(struct tep_handle *tep, char *func, in tep_register_function() argument
616 item->next = tep->funclist; in tep_register_function()
629 tep->funclist = item; in tep_register_function()
630 tep->func_count++; in tep_register_function()
649 void tep_print_funcs(struct tep_handle *tep) in tep_print_funcs() argument
653 if (!tep->func_map) in tep_print_funcs()
654 func_map_init(tep); in tep_print_funcs()
656 for (i = 0; i < (int)tep->func_count; i++) { in tep_print_funcs()
658 tep->func_map[i].addr, in tep_print_funcs()
659 tep->func_map[i].func); in tep_print_funcs()
660 if (tep->func_map[i].mod) in tep_print_funcs()
661 printf(" [%s]\n", tep->func_map[i].mod); in tep_print_funcs()
691 static int printk_map_init(struct tep_handle *tep) in printk_map_init() argument
698 printk_map = malloc(sizeof(*printk_map) * (tep->printk_count + 1)); in printk_map_init()
702 printklist = tep->printklist; in printk_map_init()
714 qsort(printk_map, tep->printk_count, sizeof(*printk_map), printk_cmp); in printk_map_init()
716 tep->printk_map = printk_map; in printk_map_init()
717 tep->printklist = NULL; in printk_map_init()
723 find_printk(struct tep_handle *tep, unsigned long long addr) in find_printk() argument
728 if (!tep->printk_map && printk_map_init(tep)) in find_printk()
733 printk = bsearch(&key, tep->printk_map, tep->printk_count, in find_printk()
734 sizeof(*tep->printk_map), printk_cmp); in find_printk()
748 int tep_register_print_string(struct tep_handle *tep, const char *fmt, in tep_register_print_string() argument
757 item->next = tep->printklist; in tep_register_print_string()
775 tep->printklist = item; in tep_register_print_string()
776 tep->printk_count++; in tep_register_print_string()
792 void tep_print_printk(struct tep_handle *tep) in tep_print_printk() argument
796 if (!tep->printk_map) in tep_print_printk()
797 printk_map_init(tep); in tep_print_printk()
799 for (i = 0; i < (int)tep->printk_count; i++) { in tep_print_printk()
801 tep->printk_map[i].addr, in tep_print_printk()
802 tep->printk_map[i].printk); in tep_print_printk()
811 static int add_event(struct tep_handle *tep, struct tep_event *event) in add_event() argument
814 struct tep_event **events = realloc(tep->events, sizeof(event) * in add_event()
815 (tep->nr_events + 1)); in add_event()
819 tep->events = events; in add_event()
821 for (i = 0; i < tep->nr_events; i++) { in add_event()
822 if (tep->events[i]->id > event->id) in add_event()
825 if (i < tep->nr_events) in add_event()
826 memmove(&tep->events[i + 1], in add_event()
827 &tep->events[i], in add_event()
828 sizeof(event) * (tep->nr_events - i)); in add_event()
830 tep->events[i] = event; in add_event()
831 tep->nr_events++; in add_event()
833 event->tep = tep; in add_event()
1695 field->elementsize = event->tep ? in event_read_fields()
1696 event->tep->long_size : in event_read_fields()
2978 find_func_handler(struct tep_handle *tep, char *func_name) in find_func_handler() argument
2982 if (!tep) in find_func_handler()
2985 for (func = tep->func_handlers; func; func = func->next) { in find_func_handler()
2993 static void remove_func_handler(struct tep_handle *tep, char *func_name) in remove_func_handler() argument
2998 next = &tep->func_handlers; in remove_func_handler()
3147 func = find_func_handler(event->tep, token); in process_function()
3432 unsigned long long tep_read_number(struct tep_handle *tep, in tep_read_number() argument
3441 return data2host2(tep, *(unsigned short *)ptr); in tep_read_number()
3443 return data2host4(tep, *(unsigned int *)ptr); in tep_read_number()
3446 return data2host8(tep, val); in tep_read_number()
3474 *value = tep_read_number(field->event->tep, in tep_read_number_field()
3482 static int get_common_info(struct tep_handle *tep, in get_common_info() argument
3492 if (!tep->events) { in get_common_info()
3497 event = tep->events[0]; in get_common_info()
3508 static int __parse_common(struct tep_handle *tep, void *data, in __parse_common() argument
3514 ret = get_common_info(tep, name, offset, size); in __parse_common()
3518 return tep_read_number(tep, data + *offset, *size); in __parse_common()
3521 static int trace_parse_common_type(struct tep_handle *tep, void *data) in trace_parse_common_type() argument
3523 return __parse_common(tep, data, in trace_parse_common_type()
3524 &tep->type_size, &tep->type_offset, in trace_parse_common_type()
3528 static int parse_common_pid(struct tep_handle *tep, void *data) in parse_common_pid() argument
3530 return __parse_common(tep, data, in parse_common_pid()
3531 &tep->pid_size, &tep->pid_offset, in parse_common_pid()
3535 static int parse_common_pc(struct tep_handle *tep, void *data) in parse_common_pc() argument
3537 return __parse_common(tep, data, in parse_common_pc()
3538 &tep->pc_size, &tep->pc_offset, in parse_common_pc()
3542 static int parse_common_flags(struct tep_handle *tep, void *data) in parse_common_flags() argument
3544 return __parse_common(tep, data, in parse_common_flags()
3545 &tep->flags_size, &tep->flags_offset, in parse_common_flags()
3549 static int parse_common_lock_depth(struct tep_handle *tep, void *data) in parse_common_lock_depth() argument
3551 return __parse_common(tep, data, in parse_common_lock_depth()
3552 &tep->ld_size, &tep->ld_offset, in parse_common_lock_depth()
3556 static int parse_common_migrate_disable(struct tep_handle *tep, void *data) in parse_common_migrate_disable() argument
3558 return __parse_common(tep, data, in parse_common_migrate_disable()
3559 &tep->ld_size, &tep->ld_offset, in parse_common_migrate_disable()
3572 struct tep_event *tep_find_event(struct tep_handle *tep, int id) in tep_find_event() argument
3579 if (tep->last_event && tep->last_event->id == id) in tep_find_event()
3580 return tep->last_event; in tep_find_event()
3584 eventptr = bsearch(&pkey, tep->events, tep->nr_events, in tep_find_event()
3585 sizeof(*tep->events), events_id_cmp); in tep_find_event()
3588 tep->last_event = *eventptr; in tep_find_event()
3605 tep_find_event_by_name(struct tep_handle *tep, in tep_find_event_by_name() argument
3611 if (tep->last_event && in tep_find_event_by_name()
3612 strcmp(tep->last_event->name, name) == 0 && in tep_find_event_by_name()
3613 (!sys || strcmp(tep->last_event->system, sys) == 0)) in tep_find_event_by_name()
3614 return tep->last_event; in tep_find_event_by_name()
3616 for (i = 0; i < tep->nr_events; i++) { in tep_find_event_by_name()
3617 event = tep->events[i]; in tep_find_event_by_name()
3625 if (i == tep->nr_events) in tep_find_event_by_name()
3628 tep->last_event = event; in tep_find_event_by_name()
3635 struct tep_handle *tep = event->tep; in eval_num_arg() local
3657 val = tep_read_number(tep, data + arg->field.field->offset, in eval_num_arg()
3697 field_size = tep->long_size; in eval_num_arg()
3701 offset = tep_read_number(tep, in eval_num_arg()
3730 val = tep_read_number(tep, in eval_num_arg()
3831 offset = tep_read_number(tep, in eval_num_arg()
3843 offset = tep_read_number(tep, in eval_num_arg()
3918 static void print_bitmask_to_seq(struct tep_handle *tep, in print_bitmask_to_seq() argument
3950 if (tep->file_bigendian) in print_bitmask_to_seq()
3976 struct tep_handle *tep = event->tep; in print_str_arg() local
4013 field->size == tep->long_size) { in print_str_arg()
4028 addr = (tep->long_size == 8) ? in print_str_arg()
4033 printk = find_printk(tep, addr); in print_str_arg()
4090 offset = tep_read_number(tep, in print_str_arg()
4121 offset = tep_read_number(tep, in print_str_arg()
4172 str_offset = data2host4(tep, *(unsigned int *)(data + arg->string.offset)); in print_str_arg()
4190 bitmask_offset = data2host4(tep, *(unsigned int *)(data + arg->bitmask.offset)); in print_str_arg()
4193 print_bitmask_to_seq(tep, s, format, len_arg, in print_str_arg()
4325 struct tep_handle *tep = event->tep; in make_bprint_args() local
4333 field = tep->bprint_buf_field; in make_bprint_args()
4334 ip_field = tep->bprint_ip_field; in make_bprint_args()
4347 tep->bprint_buf_field = field; in make_bprint_args()
4348 tep->bprint_ip_field = ip_field; in make_bprint_args()
4351 ip = tep_read_number(tep, data + ip_field->offset, ip_field->size); in make_bprint_args()
4441 vsize = tep->long_size; in make_bprint_args()
4458 val = tep_read_number(tep, bptr, vsize); in make_bprint_args()
4515 struct tep_handle *tep = event->tep; in get_bprint_format() local
4521 field = tep->bprint_fmt_field; in get_bprint_format()
4529 tep->bprint_fmt_field = field; in get_bprint_format()
4532 addr = tep_read_number(tep, data + field->offset, field->size); in get_bprint_format()
4534 printk = find_printk(tep, addr); in get_bprint_format()
4601 static int parse_ip4_print_args(struct tep_handle *tep, in parse_ip4_print_args() argument
4611 if (tep->file_bigendian) in parse_ip4_print_args()
4762 ret = parse_ip4_print_args(event->tep, ptr, &reverse); in print_ipv4_arg()
4870 ret = parse_ip4_print_args(event->tep, ptr, &reverse); in print_ipsa_arg()
5068 offset = tep_read_number(event->tep, in print_raw_buff_arg()
5102 struct tep_handle *tep = field->event->tep; in tep_print_field() local
5108 val = tep_read_number(tep, data + offset, len); in tep_print_field()
5128 val = tep_read_number(tep, data + field->offset, in tep_print_field()
5183 func = find_func(event->tep, val); in print_function()
5189 if (event->tep->long_size == 4) in print_function()
5549 if (event->tep->long_size == 8 && ls == 1 && in parse_arg_format()
5746 static void data_latency_format(struct tep_handle *tep, struct trace_seq *s, in data_latency_format() argument
5763 lat_flags = parse_common_flags(tep, data); in data_latency_format()
5764 pc = parse_common_pc(tep, data); in data_latency_format()
5767 lock_depth = parse_common_lock_depth(tep, data); in data_latency_format()
5769 lock_depth = parse_common_lock_depth(tep, data); in data_latency_format()
5778 migrate_disable = parse_common_migrate_disable(tep, data); in data_latency_format()
5780 migrate_disable = parse_common_migrate_disable(tep, data); in data_latency_format()
5836 int tep_data_type(struct tep_handle *tep, struct tep_record *rec) in tep_data_type() argument
5838 return trace_parse_common_type(tep, rec->data); in tep_data_type()
5848 int tep_data_pid(struct tep_handle *tep, struct tep_record *rec) in tep_data_pid() argument
5850 return parse_common_pid(tep, rec->data); in tep_data_pid()
5860 int tep_data_preempt_count(struct tep_handle *tep, struct tep_record *rec) in tep_data_preempt_count() argument
5862 return parse_common_pc(tep, rec->data); in tep_data_preempt_count()
5874 int tep_data_flags(struct tep_handle *tep, struct tep_record *rec) in tep_data_flags() argument
5876 return parse_common_flags(tep, rec->data); in tep_data_flags()
5887 const char *tep_data_comm_from_pid(struct tep_handle *tep, int pid) in tep_data_comm_from_pid() argument
5891 comm = find_cmdline(tep, pid); in tep_data_comm_from_pid()
5896 pid_from_cmdlist(struct tep_handle *tep, const char *comm, struct tep_cmdline *next) in pid_from_cmdlist() argument
5903 cmdlist = tep->cmdlist; in pid_from_cmdlist()
5924 struct tep_cmdline *tep_data_pid_from_comm(struct tep_handle *tep, const char *comm, in tep_data_pid_from_comm() argument
5933 if (!tep->cmdlines) in tep_data_pid_from_comm()
5934 return pid_from_cmdlist(tep, comm, next); in tep_data_pid_from_comm()
5941 if (next < tep->cmdlines || in tep_data_pid_from_comm()
5942 next >= tep->cmdlines + tep->cmdline_count) in tep_data_pid_from_comm()
5949 cmdline = tep->cmdlines; in tep_data_pid_from_comm()
5951 while (cmdline < tep->cmdlines + tep->cmdline_count) { in tep_data_pid_from_comm()
5967 int tep_cmdline_pid(struct tep_handle *tep, struct tep_cmdline *cmdline) in tep_cmdline_pid() argument
5978 if (!tep->cmdlines || in tep_cmdline_pid()
5979 cmdline < tep->cmdlines || in tep_cmdline_pid()
5980 cmdline >= tep->cmdlines + tep->cmdline_count) in tep_cmdline_pid()
6019 tep_find_event_by_record(struct tep_handle *tep, struct tep_record *record) in tep_find_event_by_record() argument
6028 type = trace_parse_common_type(tep, record->data); in tep_find_event_by_record()
6030 return tep_find_event(tep, type); in tep_find_event_by_record()
6040 static void print_event_time(struct tep_handle *tep, struct trace_seq *s, in print_event_time() argument
6079 static void print_string(struct tep_handle *tep, struct trace_seq *s, in print_string() argument
6087 data_latency_format(tep, s, type->format, record); in print_string()
6089 pid = parse_common_pid(tep, record->data); in print_string()
6090 comm = find_cmdline(tep, pid); in print_string()
6104 static void print_int(struct tep_handle *tep, struct trace_seq *s, in print_int() argument
6115 param = parse_common_pid(tep, record->data); in print_int()
6118 return print_event_time(tep, s, type->format, event, record); in print_int()
6178 void tep_print_event(struct tep_handle *tep, struct trace_seq *s, in tep_print_event() argument
6192 event = tep_find_event_by_record(tep, record); in tep_print_event()
6207 print_string(tep, s, record, event, in tep_print_event()
6211 print_int(tep, s, record, event, in tep_print_event()
6274 static struct tep_event **list_events_copy(struct tep_handle *tep) in list_events_copy() argument
6278 if (!tep) in list_events_copy()
6281 events = malloc(sizeof(*events) * (tep->nr_events + 1)); in list_events_copy()
6285 memcpy(events, tep->events, sizeof(*events) * tep->nr_events); in list_events_copy()
6286 events[tep->nr_events] = NULL; in list_events_copy()
6323 struct tep_event **tep_list_events(struct tep_handle *tep, in tep_list_events() argument
6328 if (!tep) in tep_list_events()
6331 events = tep->sort_events; in tep_list_events()
6332 if (events && tep->last_type == sort_type) in tep_list_events()
6336 events = list_events_copy(tep); in tep_list_events()
6340 tep->sort_events = events; in tep_list_events()
6344 tep->last_type = sort_type; in tep_list_events()
6349 list_events_sort(events, tep->nr_events, sort_type); in tep_list_events()
6350 tep->last_type = sort_type; in tep_list_events()
6365 struct tep_event **tep_list_events_copy(struct tep_handle *tep, in tep_list_events_copy() argument
6370 if (!tep) in tep_list_events_copy()
6373 events = list_events_copy(tep); in tep_list_events_copy()
6381 list_events_sort(events, tep->nr_events, sort_type); in tep_list_events_copy()
6650 int tep_parse_header_page(struct tep_handle *tep, char *buf, unsigned long size, in tep_parse_header_page() argument
6660 tep->header_page_ts_size = sizeof(long long); in tep_parse_header_page()
6661 tep->header_page_size_size = long_size; in tep_parse_header_page()
6662 tep->header_page_data_offset = sizeof(long long) + long_size; in tep_parse_header_page()
6663 tep->old_format = 1; in tep_parse_header_page()
6668 parse_header_field("timestamp", &tep->header_page_ts_offset, in tep_parse_header_page()
6669 &tep->header_page_ts_size, 1); in tep_parse_header_page()
6670 parse_header_field("commit", &tep->header_page_size_offset, in tep_parse_header_page()
6671 &tep->header_page_size_size, 1); in tep_parse_header_page()
6672 parse_header_field("overwrite", &tep->header_page_overwrite, in tep_parse_header_page()
6674 parse_header_field("data", &tep->header_page_data_offset, in tep_parse_header_page()
6675 &tep->header_page_data_size, 1); in tep_parse_header_page()
6703 static int find_event_handle(struct tep_handle *tep, struct tep_event *event) in find_event_handle() argument
6707 for (next = &tep->handlers; *next; in find_event_handle()
6745 struct tep_handle *tep, const char *buf, in parse_format() argument
6788 event->tep = tep; in parse_format()
6800 if (tep && find_event_handle(tep, event)) in parse_format()
6856 __parse_event(struct tep_handle *tep, in __parse_event() argument
6861 int ret = parse_format(eventp, tep, buf, size, sys); in __parse_event()
6867 if (tep && add_event(tep, event)) { in __parse_event()
6898 enum tep_errno tep_parse_format(struct tep_handle *tep, in tep_parse_format() argument
6903 return __parse_event(tep, eventp, buf, size, sys); in tep_parse_format()
6920 enum tep_errno tep_parse_event(struct tep_handle *tep, const char *buf, in tep_parse_event() argument
6924 return __parse_event(tep, &event, buf, size, sys); in tep_parse_event()
6986 offset = tep_read_number(event->tep, in tep_get_field_raw()
7121 struct tep_handle *tep = event->tep; in tep_print_func_field() local
7132 func = find_func(tep, val); in tep_print_func_field()
7177 int tep_register_print_function(struct tep_handle *tep, in tep_register_print_function() argument
7189 func_handle = find_func_handler(tep, name); in tep_register_print_function()
7197 remove_func_handler(tep, name); in tep_register_print_function()
7244 func_handle->next = tep->func_handlers; in tep_register_print_function()
7245 tep->func_handlers = func_handle; in tep_register_print_function()
7264 int tep_unregister_print_function(struct tep_handle *tep, in tep_unregister_print_function() argument
7269 func_handle = find_func_handler(tep, name); in tep_unregister_print_function()
7271 remove_func_handler(tep, name); in tep_unregister_print_function()
7277 static struct tep_event *search_event(struct tep_handle *tep, int id, in search_event() argument
7285 event = tep_find_event(tep, id); in search_event()
7293 event = tep_find_event_by_name(tep, sys_name, event_name); in search_event()
7323 int tep_register_event_handler(struct tep_handle *tep, int id, in tep_register_event_handler() argument
7330 event = search_event(tep, id, sys_name, event_name); in tep_register_event_handler()
7365 handle->next = tep->handlers; in tep_register_event_handler()
7366 tep->handlers = handle; in tep_register_event_handler()
7407 int tep_unregister_event_handler(struct tep_handle *tep, int id, in tep_unregister_event_handler() argument
7415 event = search_event(tep, id, sys_name, event_name); in tep_unregister_event_handler()
7429 for (next = &tep->handlers; *next; next = &(*next)->next) { in tep_unregister_event_handler()
7450 struct tep_handle *tep = calloc(1, sizeof(*tep)); in tep_alloc() local
7452 if (tep) { in tep_alloc()
7453 tep->ref_count = 1; in tep_alloc()
7454 tep->host_bigendian = tep_is_bigendian(); in tep_alloc()
7457 return tep; in tep_alloc()
7460 void tep_ref(struct tep_handle *tep) in tep_ref() argument
7462 tep->ref_count++; in tep_ref()
7465 int tep_get_ref(struct tep_handle *tep) in tep_get_ref() argument
7467 if (tep) in tep_get_ref()
7468 return tep->ref_count; in tep_get_ref()
7515 void tep_free(struct tep_handle *tep) in tep_free() argument
7524 if (!tep) in tep_free()
7527 cmdlist = tep->cmdlist; in tep_free()
7528 funclist = tep->funclist; in tep_free()
7529 printklist = tep->printklist; in tep_free()
7531 tep->ref_count--; in tep_free()
7532 if (tep->ref_count) in tep_free()
7535 if (tep->cmdlines) { in tep_free()
7536 for (i = 0; i < tep->cmdline_count; i++) in tep_free()
7537 free(tep->cmdlines[i].comm); in tep_free()
7538 free(tep->cmdlines); in tep_free()
7548 if (tep->func_map) { in tep_free()
7549 for (i = 0; i < (int)tep->func_count; i++) { in tep_free()
7550 free(tep->func_map[i].func); in tep_free()
7551 free(tep->func_map[i].mod); in tep_free()
7553 free(tep->func_map); in tep_free()
7564 while (tep->func_handlers) { in tep_free()
7565 func_handler = tep->func_handlers; in tep_free()
7566 tep->func_handlers = func_handler->next; in tep_free()
7570 if (tep->printk_map) { in tep_free()
7571 for (i = 0; i < (int)tep->printk_count; i++) in tep_free()
7572 free(tep->printk_map[i].printk); in tep_free()
7573 free(tep->printk_map); in tep_free()
7583 for (i = 0; i < tep->nr_events; i++) in tep_free()
7584 free_tep_event(tep->events[i]); in tep_free()
7586 while (tep->handlers) { in tep_free()
7587 handle = tep->handlers; in tep_free()
7588 tep->handlers = handle->next; in tep_free()
7592 free(tep->events); in tep_free()
7593 free(tep->sort_events); in tep_free()
7594 free(tep->func_resolver); in tep_free()
7595 free_tep_plugin_paths(tep); in tep_free()
7597 free(tep); in tep_free()
7600 void tep_unref(struct tep_handle *tep) in tep_unref() argument
7602 tep_free(tep); in tep_unref()