Lines Matching refs:tp
538 static void tracer_wait_unblock(struct tracer *tp)
541 while (!tp->is_done && !tracers_run)
546 static void tracer_signal_ready(struct tracer *tp,
551 tp->status = status;
1456 static inline int net_sendfile_data(struct tracer *tp, struct io_info *iop)
1460 if (net_send_header(iop->ofd, tp->cpu, dpp->buts_name, iop->ready))
1573 static void close_ios(struct tracer *tp)
1575 while (tp->nios > 0) {
1576 struct io_info *iop = &tp->ios[--tp->nios];
1592 free(tp->ios);
1593 free(tp->pfds);
1596 static int open_ios(struct tracer *tp)
1602 tp->ios = calloc(ndevs, sizeof(struct io_info));
1603 memset(tp->ios, 0, ndevs * sizeof(struct io_info));
1605 tp->pfds = calloc(ndevs, sizeof(struct pollfd));
1606 memset(tp->pfds, 0, ndevs * sizeof(struct pollfd));
1608 tp->nios = 0;
1609 iop = tp->ios;
1610 pfd = tp->pfds;
1617 debugfs_path, dpp->buts_name, tp->cpu);
1622 tp->cpu, iop->ifn, errno, strerror(errno));
1637 net_send_open(iop->ofd, tp->cpu, dpp->buts_name);
1639 if (iop_open(iop, tp->cpu))
1646 net_send_open(cl_fds[tp->cpu], tp->cpu, dpp->buts_name);
1651 tp->nios++;
1657 close(iop->ifd); /* tp->nios _not_ bumped */
1658 close_ios(tp);
1662 static int handle_pfds_file(struct tracer *tp, int nevs, int force_read)
1666 struct pollfd *pfd = tp->pfds;
1667 struct io_info *iop = tp->ios;
1682 pdc_dr_update(iop->dpp, tp->cpu, ret);
1691 if (tp->is_done)
1694 read_err(tp->cpu, iop->ifn);
1695 if (errno != EAGAIN || tp->is_done)
1705 static int handle_pfds_netclient(struct tracer *tp, int nevs, int force_read)
1710 struct pollfd *pfd = tp->pfds;
1711 struct io_info *iop = tp->ios;
1722 if (!net_sendfile_data(tp, iop)) {
1723 pdc_dr_update(iop->dpp, tp->cpu,
1740 static int handle_pfds_entries(struct tracer *tp, int nevs, int force_read)
1744 struct pollfd *pfd = tp->pfds;
1745 struct io_info *iop = tp->ios;
1747 tbp = alloc_trace_buf(tp->cpu, buf_size);
1752 pdc_dr_update(iop->dpp, tp->cpu, tbp->len);
1753 add_trace_buf(iop->dpp, tp->cpu, &tbp);
1760 if (tp->is_done)
1763 read_err(tp->cpu, iop->ifn);
1764 if (errno != EAGAIN || tp->is_done)
1782 struct tracer *tp = arg;
1784 ret = lock_on_cpu(tp->cpu);
1788 ret = open_ios(tp);
1798 tracer_signal_ready(tp, Th_running, 0);
1799 tracer_wait_unblock(tp);
1801 while (!tp->is_done) {
1802 ndone = poll(tp->pfds, ndevs, to_val);
1804 (void)handle_pfds(tp, ndone, piped_output);
1807 tp->cpu, errno, strerror(errno));
1813 while (handle_pfds(tp, ndevs, 1) > 0)
1816 close_ios(tp);
1817 tracer_signal_ready(tp, Th_leaving, 0);
1821 tracer_signal_ready(tp, Th_error, ret);
1827 struct tracer *tp;
1829 tp = malloc(sizeof(*tp));
1830 memset(tp, 0, sizeof(*tp));
1832 INIT_LIST_HEAD(&tp->head);
1833 tp->status = 0;
1834 tp->cpu = cpu;
1836 if (pthread_create(&tp->thread, NULL, thread_main, tp)) {
1839 free(tp);
1843 list_add_tail(&tp->head, &tracers);
1859 struct tracer *tp = list_entry(p, struct tracer, head);
1860 if (tp->status)
1863 tp->cpu, tp->status, strerror(tp->status));
1883 struct tracer *tp = list_entry(p, struct tracer, head);
1884 tp->is_done = 1;
1893 struct tracer *tp = list_entry(p, struct tracer, head);
1895 list_del(&tp->head);
1896 free(tp);
1911 struct tracer *tp = list_entry(p, struct tracer, head);
1913 ret = pthread_join(tp->thread, NULL);
1916 tp->cpu, ret);