static void do_once(struct VSM_data *vd) { struct once_priv op; memset(&op, 0, sizeof op); op.pad = 18; (void)VSC_Iter(vd, NULL, do_once_cb_first, &op); (void)VSC_Iter(vd, NULL, do_once_cb, &op); }
static void list_fields(struct VSM_data *vd) { fprintf(stderr, "Varnishstat -f option fields:\n"); fprintf(stderr, "Field name Description\n"); fprintf(stderr, "---------- -----------\n"); (void)VSC_Iter(vd, NULL, do_list_cb, NULL); }
static void do_once(struct VSM_data *vd, const struct VSC_C_main *VSC_C_main) { struct once_priv op; memset(&op, 0, sizeof op); if (VSC_C_main != NULL) op.up = VSC_C_main->uptime; op.pad = 18; (void)VSC_Iter(vd, NULL, do_once_cb, &op); }
static void do_xml(struct VSM_data *vd) { char time_stamp[20]; time_t now; printf("<?xml version=\"1.0\"?>\n"); now = time(NULL); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); printf("<varnishstat timestamp=\"%s\">\n", time_stamp); (void)VSC_Iter(vd, NULL, do_xml_cb, NULL); printf("</varnishstat>\n"); }
static void do_json(struct vsm *vsm, struct vsc *vsc) { char time_stamp[20]; time_t now; int jp; jp = 1; printf("{\n"); now = time(NULL); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); printf(" \"timestamp\": \"%s\",\n", time_stamp); (void)VSC_Iter(vsc, vsm, do_json_cb, &jp); printf("\n}\n"); }
static void do_json(struct VSM_data *vd) { char time_stamp[20]; time_t now; int jp; jp = 1; printf("{\n"); now = time(NULL); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); printf("\t\"timestamp\": \"%s\",\n", time_stamp); (void)VSC_Iter(vd, NULL, do_json_cb, &jp); printf("\n}\n"); fflush(stdout); }
static void do_json(struct VSM_data *vd, struct vsb *out_vsb) { char time_stamp[20]; time_t now; now = time(NULL); assert(out_vsb); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); VSB_printf(out_vsb, "{\n\t\"timestamp\": \"%s\"", time_stamp); (void)VSC_Iter(vd, NULL, do_json_cb, out_vsb); // VSB_cat(out_vsb, ",\n\t\"be_bytes\": ["); // // (void)VSC_Iter(vd, NULL, creepy_math, out_vsb); // VSB_cat(out_vsb, "]\n"); // cont= 0; // // remove last comma // // if(strcmp(VSB_data(out_vsb[out_vsb->s_len -4]) , "," )){ // // VSB_setpos(out_vsb, out_vsb->s_len - 4); // // } VSB_printf(out_vsb, "\n}\n"); assert(VSB_finish(out_vsb) == 0); }