Lines Matching defs:sf

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