Lines Matching refs:sf
38 bsdstat_setfmt(struct bsdstat *sf, const char *fmt0) in bsdstat_setfmt() argument
48 for (i = 0; i < sf->nstats; i++) in bsdstat_setfmt()
49 if (strcasecmp(tok, sf->stats[i].name) == 0) in bsdstat_setfmt()
51 if (i >= sf->nstats) { in bsdstat_setfmt()
53 "skipped\n", sf->name, tok); in bsdstat_setfmt()
56 if (j+4 > (int) sizeof(sf->fmts)) { in bsdstat_setfmt()
58 "stopped at %s\n", sf->name, tok); in bsdstat_setfmt()
62 sf->fmts[j++] = ' '; in bsdstat_setfmt()
63 sf->fmts[j++] = FMTS_IS_STAT; in bsdstat_setfmt()
64 sf->fmts[j++] = i & 0xff; in bsdstat_setfmt()
65 sf->fmts[j++] = (i >> 8) & 0xff; in bsdstat_setfmt()
67 sf->fmts[j] = '\0'; in bsdstat_setfmt()
72 bsdstat_collect(struct bsdstat *sf) in bsdstat_collect() argument
74 fprintf(stderr, "%s: don't know how to collect data\n", sf->name); in bsdstat_collect()
78 bsdstat_update_tot(struct bsdstat *sf) in bsdstat_update_tot() argument
80 fprintf(stderr, "%s: don't know how to update total data\n", sf->name); in bsdstat_update_tot()
84 bsdstat_get(struct bsdstat *sf, int s, char b[] __unused, size_t bs __unused) in bsdstat_get() argument
86 fprintf(stderr, "%s: don't know how to get stat #%u\n", sf->name, s); in bsdstat_get()
91 bsdstat_print_header(struct bsdstat *sf, FILE *fd) in bsdstat_print_header() argument
97 for (cp = sf->fmts; *cp != '\0'; cp++) { in bsdstat_print_header()
101 f = &sf->stats[i]; in bsdstat_print_header()
110 bsdstat_print_current(struct bsdstat *sf, FILE *fd) in bsdstat_print_current() argument
117 for (cp = sf->fmts; *cp != '\0'; cp++) { in bsdstat_print_current()
121 f = &sf->stats[i]; in bsdstat_print_current()
122 if (sf->get_curstat(sf, i, buf, sizeof(buf))) in bsdstat_print_current()
131 bsdstat_print_total(struct bsdstat *sf, FILE *fd) in bsdstat_print_total() argument
138 for (cp = sf->fmts; *cp != '\0'; cp++) { in bsdstat_print_total()
142 f = &sf->stats[i]; in bsdstat_print_total()
143 if (sf->get_totstat(sf, i, buf, sizeof(buf))) in bsdstat_print_total()
152 bsdstat_print_verbose(struct bsdstat *sf, FILE *fd) in bsdstat_print_verbose() argument
159 for (i = 0; i < sf->nstats; i++) { in bsdstat_print_verbose()
160 f = &sf->stats[i]; in bsdstat_print_verbose()
164 for (i = 0; i < sf->nstats; i++) { in bsdstat_print_verbose()
165 f = &sf->stats[i]; in bsdstat_print_verbose()
166 if (sf->get_totstat(sf, i, s, sizeof(s)) && strcmp(s, "0")) in bsdstat_print_verbose()
172 bsdstat_print_fields(struct bsdstat *sf, FILE *fd) in bsdstat_print_fields() argument
177 for (i = 0; i < sf->nstats; i++) { in bsdstat_print_fields()
178 w = strlen(sf->stats[i].name); in bsdstat_print_fields()
182 for (i = 0; i < sf->nstats; i++) { in bsdstat_print_fields()
183 const struct fmt *f = &sf->stats[i]; in bsdstat_print_fields()
190 bsdstat_init(struct bsdstat *sf, const char *name, const struct fmt *stats, int nstats) in bsdstat_init() argument
192 sf->name = name; in bsdstat_init()
193 sf->stats = stats; in bsdstat_init()
194 sf->nstats = nstats; in bsdstat_init()
195 sf->setfmt = bsdstat_setfmt; in bsdstat_init()
196 sf->collect_cur = bsdstat_collect; in bsdstat_init()
197 sf->collect_tot = bsdstat_collect; in bsdstat_init()
198 sf->update_tot = bsdstat_update_tot; in bsdstat_init()
199 sf->get_curstat = bsdstat_get; in bsdstat_init()
200 sf->get_totstat = bsdstat_get; in bsdstat_init()
201 sf->print_header = bsdstat_print_header; in bsdstat_init()
202 sf->print_current = bsdstat_print_current; in bsdstat_init()
203 sf->print_total = bsdstat_print_total; in bsdstat_init()
204 sf->print_verbose = bsdstat_print_verbose; in bsdstat_init()
205 sf->print_fields = bsdstat_print_fields; in bsdstat_init()