Lines Matching refs:fp
148 void load_raw_table(FILE *fp)
154 while (fgets(buf, sizeof(buf), fp) != NULL) {
211 void dump_raw_db(FILE *fp, int to_hist)
215 fprintf(fp, "#%s\n", info_source);
234 fprintf(fp, "%d %s ", n->ifindex, n->name);
236 fprintf(fp, "%llu %u ", vals[i], (unsigned)rates[i]);
237 fprintf(fp, "\n");
246 void format_rate(FILE *fp, unsigned long long *vals, double *rates, int i)
250 fprintf(fp, "%7lluM ", vals[i]/mega);
252 fprintf(fp, "%7lluK ", vals[i]/kilo);
254 fprintf(fp, "%8llu ", vals[i]);
258 fprintf(fp, "%-6s ", temp);
261 fprintf(fp, "%-6s ", temp);
263 fprintf(fp, "%-6u ", (unsigned)rates[i]);
266 void format_pair(FILE *fp, unsigned long long *vals, int i, int k)
270 fprintf(fp, "%7lluM ", vals[i]/mega);
272 fprintf(fp, "%7lluK ", vals[i]/kilo);
274 fprintf(fp, "%8llu ", vals[i]);
278 fprintf(fp, "%-6s ", temp);
281 fprintf(fp, "%-6s ", temp);
283 fprintf(fp, "%-6u ", (unsigned)vals[k]);
286 void print_head(FILE *fp)
288 fprintf(fp, "#%s\n", info_source);
289 fprintf(fp, "%-15s ", "Interface");
291 fprintf(fp, "%8s/%-6s ", "RX Pkts", "Rate");
292 fprintf(fp, "%8s/%-6s ", "TX Pkts", "Rate");
293 fprintf(fp, "%8s/%-6s ", "RX Data", "Rate");
294 fprintf(fp, "%8s/%-6s\n","TX Data", "Rate");
297 fprintf(fp, "%-15s ", "");
298 fprintf(fp, "%8s/%-6s ", "RX Errs", "Drop");
299 fprintf(fp, "%8s/%-6s ", "TX Errs", "Drop");
300 fprintf(fp, "%8s/%-6s ", "RX Over", "Rate");
301 fprintf(fp, "%8s/%-6s\n","TX Coll", "Rate");
303 fprintf(fp, "%-15s ", "");
304 fprintf(fp, "%8s/%-6s ", "RX Errs", "Rate");
305 fprintf(fp, "%8s/%-6s ", "RX Drop", "Rate");
306 fprintf(fp, "%8s/%-6s ", "RX Over", "Rate");
307 fprintf(fp, "%8s/%-6s\n","RX Leng", "Rate");
309 fprintf(fp, "%-15s ", "");
310 fprintf(fp, "%8s/%-6s ", "RX Crc", "Rate");
311 fprintf(fp, "%8s/%-6s ", "RX Frm", "Rate");
312 fprintf(fp, "%8s/%-6s ", "RX Fifo", "Rate");
313 fprintf(fp, "%8s/%-6s\n","RX Miss", "Rate");
315 fprintf(fp, "%-15s ", "");
316 fprintf(fp, "%8s/%-6s ", "TX Errs", "Rate");
317 fprintf(fp, "%8s/%-6s ", "TX Drop", "Rate");
318 fprintf(fp, "%8s/%-6s ", "TX Coll", "Rate");
319 fprintf(fp, "%8s/%-6s\n","TX Carr", "Rate");
321 fprintf(fp, "%-15s ", "");
322 fprintf(fp, "%8s/%-6s ", "TX Abrt", "Rate");
323 fprintf(fp, "%8s/%-6s ", "TX Fifo", "Rate");
324 fprintf(fp, "%8s/%-6s ", "TX Hear", "Rate");
325 fprintf(fp, "%8s/%-6s\n","TX Wind", "Rate");
329 void print_one_if(FILE *fp, struct ifstat_ent *n, unsigned long long *vals)
332 fprintf(fp, "%-15s ", n->name);
334 format_rate(fp, vals, n->rate, i);
335 fprintf(fp, "\n");
338 fprintf(fp, "%-15s ", "");
339 format_pair(fp, vals, 4, 6);
340 format_pair(fp, vals, 5, 7);
341 format_rate(fp, vals, n->rate, 11);
342 format_rate(fp, vals, n->rate, 9);
343 fprintf(fp, "\n");
345 fprintf(fp, "%-15s ", "");
346 format_rate(fp, vals, n->rate, 4);
347 format_rate(fp, vals, n->rate, 6);
348 format_rate(fp, vals, n->rate, 11);
349 format_rate(fp, vals, n->rate, 10);
350 fprintf(fp, "\n");
352 fprintf(fp, "%-15s ", "");
353 format_rate(fp, vals, n->rate, 12);
354 format_rate(fp, vals, n->rate, 13);
355 format_rate(fp, vals, n->rate, 14);
356 format_rate(fp, vals, n->rate, 15);
357 fprintf(fp, "\n");
359 fprintf(fp, "%-15s ", "");
360 format_rate(fp, vals, n->rate, 5);
361 format_rate(fp, vals, n->rate, 7);
362 format_rate(fp, vals, n->rate, 9);
363 format_rate(fp, vals, n->rate, 17);
364 fprintf(fp, "\n");
366 fprintf(fp, "%-15s ", "");
367 format_rate(fp, vals, n->rate, 16);
368 format_rate(fp, vals, n->rate, 18);
369 format_rate(fp, vals, n->rate, 19);
370 format_rate(fp, vals, n->rate, 20);
371 fprintf(fp, "\n");
376 void dump_kern_db(FILE *fp)
381 print_head(fp);
386 print_one_if(fp, n, n->val);
391 void dump_incr_db(FILE *fp)
396 print_head(fp);
415 print_one_if(fp, n, vals);
522 FILE *fp = fdopen(clnt, "w");
523 if (fp) {
526 dump_raw_db(fp, 0);