void dump_incr_db(FILE *fp) { struct ifstat_ent *n, *h; h = hist_db; print_head(fp); for (n=kern_db; n; n=n->next) { int i; unsigned long long vals[MAXS]; struct ifstat_ent *h1; memcpy(vals, n->val, sizeof(vals)); for (h1 = h; h1; h1 = h1->next) { if (h1->ifindex == n->ifindex) { for (i = 0; i < MAXS; i++) vals[i] -= h1->val[i]; h = h1->next; break; } } if (!match(n->name)) continue; print_one_if(fp, n, vals); } }
static void dump_kern_db(FILE *fp) { json_writer_t *jw = json_output ? jsonw_new(fp) : NULL; struct ifstat_ent *n; if (jw) { jsonw_start_object(jw); jsonw_pretty(jw, pretty); jsonw_name(jw, info_source); jsonw_start_object(jw); } else print_head(fp); for (n = kern_db; n; n = n->next) { if (!match(n->name)) continue; if (jw) print_one_json(jw, n, n->val); else print_one_if(fp, n, n->val); } if (json_output) fprintf(fp, "\n} }\n"); }
static void dump_kern_db(FILE *fp) { struct ifstat_ent *n; print_head(fp); for (n=kern_db; n; n=n->next) { if (!match(n->name)) continue; print_one_if(fp, n, n->val); } }
static void dump_incr_db(FILE *fp) { struct ifstat_ent *n, *h; json_writer_t *jw = json_output ? jsonw_new(fp) : NULL; h = hist_db; if (jw) { jsonw_start_object(jw); jsonw_pretty(jw, pretty); jsonw_name(jw, info_source); jsonw_start_object(jw); } else print_head(fp); for (n = kern_db; n; n = n->next) { int i; unsigned long long vals[MAXS]; struct ifstat_ent *h1; memcpy(vals, n->val, sizeof(vals)); for (h1 = h; h1; h1 = h1->next) { if (h1->ifindex == n->ifindex) { for (i = 0; i < MAXS; i++) vals[i] -= h1->val[i]; h = h1->next; break; } } if (!match(n->name)) continue; if (jw) print_one_json(jw, n, n->val); else print_one_if(fp, n, vals); } if (jw) { jsonw_end_object(jw); jsonw_end_object(jw); jsonw_destroy(&jw); } }