const char * wait_status_string (struct context *c, struct gc_arena *gc) { struct buffer out = alloc_buf_gc (64, gc); buf_printf (&out, "I/O WAIT %s|%s|%s|%s %s", tun_stat (c->c1.tuntap, EVENT_READ, gc), tun_stat (c->c1.tuntap, EVENT_WRITE, gc), socket_stat (c->c2.link_socket, EVENT_READ, gc), socket_stat (c->c2.link_socket, EVENT_WRITE, gc), tv_string (&c->c2.timeval, gc)); return BSTR (&out); }
static void perf_print_state(int lev) { struct gc_arena gc = gc_new(); int i; msg(lev, "PERF STATE"); msg(lev, "Stack:"); for (i = 0; i < perf_set.stack_len; ++i) { const int j = perf_set.stack[i]; const struct perf *p = &perf_set.perf[j]; msg(lev, "[%d] %s state=%d start=%s sofar=%f sum=%f max=%f count=%f", i, metric_names[j], p->state, tv_string(&p->start, &gc), p->sofar, p->sum, p->max, p->count); } gc_free(&gc); }