• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/lib/libbsdstat/

Lines Matching defs:sf

40 bsdstat_setfmt(struct bsdstat *sf, const char *fmt0)
50 for (i = 0; i < sf->nstats; i++)
51 if (strcasecmp(tok, sf->stats[i].name) == 0)
53 if (i >= sf->nstats) {
55 "skipped\n", sf->name, tok);
58 if (j+4 > (int) sizeof(sf->fmts)) {
60 "stopped at %s\n", sf->name, tok);
64 sf->fmts[j++] = ' ';
65 sf->fmts[j++] = FMTS_IS_STAT;
66 sf->fmts[j++] = i & 0xff;
67 sf->fmts[j++] = (i >> 8) & 0xff;
69 sf->fmts[j] = '\0';
74 bsdstat_collect(struct bsdstat *sf)
76 fprintf(stderr, "%s: don't know how to collect data\n", sf->name);
80 bsdstat_update_tot(struct bsdstat *sf)
82 fprintf(stderr, "%s: don't know how to update total data\n", sf->name);
86 bsdstat_get(struct bsdstat *sf, int s, char b[] __unused, size_t bs __unused)
88 fprintf(stderr, "%s: don't know how to get stat #%u\n", sf->name, s);
93 bsdstat_print_header(struct bsdstat *sf, FILE *fd)
99 for (cp = sf->fmts; *cp != '\0'; cp++) {
103 f = &sf->stats[i];
112 bsdstat_print_current(struct bsdstat *sf, FILE *fd)
119 for (cp = sf->fmts; *cp != '\0'; cp++) {
123 f = &sf->stats[i];
124 if (sf->get_curstat(sf, i, buf, sizeof(buf)))
133 bsdstat_print_total(struct bsdstat *sf, FILE *fd)
140 for (cp = sf->fmts; *cp != '\0'; cp++) {
144 f = &sf->stats[i];
145 if (sf->get_totstat(sf, i, buf, sizeof(buf)))
154 bsdstat_print_verbose(struct bsdstat *sf, FILE *fd)
161 for (i = 0; i < sf->nstats; i++) {
162 f = &sf->stats[i];
166 for (i = 0; i < sf->nstats; i++) {
167 f = &sf->stats[i];
168 if (sf->get_totstat(sf, i, s, sizeof(s)) && strcmp(s, "0"))
174 bsdstat_print_fields(struct bsdstat *sf, FILE *fd)
179 for (i = 0; i < sf->nstats; i++) {
180 w = strlen(sf->stats[i].name);
184 for (i = 0; i < sf->nstats; i++) {
185 const struct fmt *f = &sf->stats[i];
192 bsdstat_init(struct bsdstat *sf, const char *name, const struct fmt *stats, int nstats)
194 sf->name = name;
195 sf->stats = stats;
196 sf->nstats = nstats;
197 sf->setfmt = bsdstat_setfmt;
198 sf->collect_cur = bsdstat_collect;
199 sf->collect_tot = bsdstat_collect;
200 sf->update_tot = bsdstat_update_tot;
201 sf->get_curstat = bsdstat_get;
202 sf->get_totstat = bsdstat_get;
203 sf->print_header = bsdstat_print_header;
204 sf->print_current = bsdstat_print_current;
205 sf->print_total = bsdstat_print_total;
206 sf->print_verbose = bsdstat_print_verbose;
207 sf->print_fields = bsdstat_print_fields;