Lines Matching +full:enum +full:- +full:cnt +full:- +full:name

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
38 enum stat_id {
56 NUM_STATS_CNT = FILE_NAME - VERDICT,
60 * - A side value;
61 * - B side value;
62 * - absolute diff value;
63 * - relative (percentage) diff value.
68 * - `_a` for A side value;
69 * - `_b` for B side value;
70 * - `_diff` for absolute diff value;
71 * - `_pct` for relative (percentage) diff value.
78 * --------- --------- --------------
79 * 21547 20920 -627 (-2.91%)
82 * - 21547 is A side value (insns_a);
83 * - 20920 is B side value (insns_b);
84 * - -627 is absolute diff value (insns_diff);
85 * - -2.91% is relative diff value (insns_pct).
88 * For file and program name, _a and _b variants are equivalent and there are
91 enum stat_variant {
116 enum stat_id ids[ALL_STATS_CNT];
117 enum stat_variant variants[ALL_STATS_CNT];
123 enum resfmt {
125 RESFMT_TABLE_CALCLEN, /* fake format to pre-calculate table's column widths */
129 enum filter_kind {
134 enum operator_kind {
144 enum filter_kind kind;
150 enum operator_kind op;
152 enum stat_variant stat_var;
165 enum resfmt out_fmt;
200 static int libbpf_print_fn(enum libbpf_print_level level, const char *format, va_list args) in libbpf_print_fn()
218 "USAGE: veristat <obj-file> [<obj-file>...]\n"
219 " OR: veristat -C <baseline.csv> <comparison.csv>\n"
220 " OR: veristat -R <results.csv>\n"
221 " OR: veristat -vl2 <to_analyze.bpf.o>\n";
223 enum {
233 …{ "log-level", 'l', "LEVEL", 0, "Verifier log level (default 0 for normal mode, 1 for verbose mode…
234 { "log-fixed", OPT_LOG_FIXED, NULL, 0, "Disable verifier log rotation" },
235 { "log-size", OPT_LOG_SIZE, "BYTES", 0, "Customize verifier log size (default to 16MB)" },
236 { "top-n", 'n', "N", 0, "Emit only up to first N results." },
240 { "output-format", 'o', "FMT", 0, "Result output format (table, csv), default is table." },
244 { "test-states", 't', NULL, 0,
246 { "test-reg-invariants", 'r', NULL, 0,
248 { "top-src-lines", 'S', "N", 0, "Emit N most frequent source code lines" },
253 static int append_filter(struct filter **filters, int *cnt, const char *str);
295 return -EINVAL; in parse_arg()
359 return -ENOMEM; in parse_arg()
363 return -ENOMEM; in parse_arg()
403 int fd, err = -EINVAL; in is_bpf_obj_file()
422 if (!ehdr || ehdr->e_type != ET_REL || (ehdr->e_machine && ehdr->e_machine != EM_BPF)) in is_bpf_obj_file()
440 if (f->kind != FILTER_NAME) in should_process_file_prog()
443 if (f->any_glob && glob_matches(filename, f->any_glob)) in should_process_file_prog()
445 if (f->any_glob && prog_name && glob_matches(prog_name, f->any_glob)) in should_process_file_prog()
447 if (f->file_glob && glob_matches(filename, f->file_glob)) in should_process_file_prog()
449 if (f->prog_glob && prog_name && glob_matches(prog_name, f->prog_glob)) in should_process_file_prog()
455 if (f->kind != FILTER_NAME) in should_process_file_prog()
459 if (f->any_glob) { in should_process_file_prog()
460 if (glob_matches(filename, f->any_glob)) in should_process_file_prog()
462 /* If we don't know program name yet, any_glob filter in should_process_file_prog()
465 * BPF object file, at which point program name will in should_process_file_prog()
468 if (!prog_name || glob_matches(prog_name, f->any_glob)) in should_process_file_prog()
471 if (f->file_glob && !glob_matches(filename, f->file_glob)) in should_process_file_prog()
473 if (f->prog_glob && prog_name && !glob_matches(prog_name, f->prog_glob)) in should_process_file_prog()
479 /* if there are no file/prog name allow filters, allow all progs, in should_process_file_prog()
486 enum operator_kind op_kind;
503 static bool parse_stat_id_var(const char *name, size_t len, int *id,
504 enum stat_variant *var, bool *is_abs);
506 static int append_filter(struct filter **filters, int *cnt, const char *str) in append_filter() argument
513 tmp = realloc(*filters, (*cnt + 1) * sizeof(**filters)); in append_filter()
515 return -ENOMEM; in append_filter()
518 f = &(*filters)[*cnt]; in append_filter()
523 * - <stat> is one of supported numerical stats (verdict is also in append_filter()
525 * - <op> is comparison operator (see `operators` definitions); in append_filter()
526 * - <value> is an integer (or failure/success, or false/true as in append_filter()
532 enum stat_variant var; in append_filter()
544 if (!parse_stat_id_var(str, p - str, &id, &var, &is_abs)) { in append_filter()
545 fprintf(stderr, "Unrecognized stat name in '%s'!\n", str); in append_filter()
546 return -EINVAL; in append_filter()
549 fprintf(stderr, "Non-integer stat is specified in '%s'!\n", str); in append_filter()
550 return -EINVAL; in append_filter()
575 return -EINVAL; in append_filter()
579 f->kind = FILTER_STAT; in append_filter()
580 f->stat_id = id; in append_filter()
581 f->stat_var = var; in append_filter()
582 f->op = operators[i].op_kind; in append_filter()
583 f->abs = true; in append_filter()
584 f->value = val; in append_filter()
586 *cnt += 1; in append_filter()
591 * '<file-glob>/<prog-glob>'. In the former case <glob> is applied to in append_filter()
593 * practice. If user needs full control, they can use '/<prog-glob>' in append_filter()
594 * form to glob just program name, or '<file-glob>/' to glob only file in append_filter()
595 * name. But usually common <glob> seems to be the most useful and in append_filter()
598 f->kind = FILTER_NAME; in append_filter()
601 f->any_glob = strdup(str); in append_filter()
602 if (!f->any_glob) in append_filter()
603 return -ENOMEM; in append_filter()
606 /* non-empty file glob */ in append_filter()
607 f->file_glob = strndup(str, p - str); in append_filter()
608 if (!f->file_glob) in append_filter()
609 return -ENOMEM; in append_filter()
612 /* non-empty prog glob */ in append_filter()
613 f->prog_glob = strdup(p + 1); in append_filter()
614 if (!f->prog_glob) { in append_filter()
615 free(f->file_glob); in append_filter()
616 f->file_glob = NULL; in append_filter()
617 return -ENOMEM; in append_filter()
622 *cnt += 1; in append_filter()
634 err = -errno; in append_filter_file()
715 static bool parse_stat_id_var(const char *name, size_t len, int *id, in parse_stat_id_var() argument
716 enum stat_variant *var, bool *is_abs) in parse_stat_id_var()
728 if (len > 2 && name[0] == '|' && name[len - 1] == '|') { in parse_stat_id_var()
730 name += 1; in parse_stat_id_var()
731 len -= 2; in parse_stat_id_var()
740 alias = def->names[j]; in parse_stat_id_var()
745 if (strncmp(name, alias, alias_len) != 0) in parse_stat_id_var()
752 * non-comparison mode. in parse_stat_id_var()
764 if (strncmp(name + alias_len, var_sfxs[k], sfx_len) == 0) { in parse_stat_id_var()
765 *var = (enum stat_variant)k; in parse_stat_id_var()
791 enum stat_variant var; in parse_stat()
793 if (specs->spec_cnt >= ARRAY_SIZE(specs->ids)) { in parse_stat()
794 fprintf(stderr, "Can't specify more than %zd stats\n", ARRAY_SIZE(specs->ids)); in parse_stat()
795 return -E2BIG; in parse_stat()
798 if (len > 1 && (is_asc_sym(stat_name[len - 1]) || is_desc_sym(stat_name[len - 1]))) { in parse_stat()
800 is_asc = is_asc_sym(stat_name[len - 1]); in parse_stat()
801 len -= 1; in parse_stat()
805 fprintf(stderr, "Unrecognized stat name '%s'\n", stat_name); in parse_stat()
806 return -ESRCH; in parse_stat()
809 specs->ids[specs->spec_cnt] = id; in parse_stat()
810 specs->variants[specs->spec_cnt] = var; in parse_stat()
811 specs->asc[specs->spec_cnt] = has_order ? is_asc : stat_defs[id].asc_by_default; in parse_stat()
812 specs->abs[specs->spec_cnt] = is_abs; in parse_stat()
813 specs->spec_cnt++; in parse_stat()
821 int err, cnt = 0; in parse_stats() local
825 return -ENOMEM; in parse_stats()
827 while ((next = strtok_r(cnt++ ? NULL : input, ",", &state))) { in parse_stats()
860 int pos, lines, sub_stack, cnt = 0; in parse_verif_log() local
863 buf[buf_sz - 1] = '\0'; in parse_verif_log()
865 for (pos = strlen(buf) - 1, lines = 0; pos >= 0 && lines < MAX_PARSED_LOG_LINES; lines++) { in parse_verif_log()
867 for (cur = &buf[pos]; cur > buf && cur[0] != '\n'; cur--, pos--) { in parse_verif_log()
870 pos--; in parse_verif_log()
877 if (1 == sscanf(cur, "verification time %ld usec\n", &s->stats[DURATION])) in parse_verif_log()
880 &s->stats[TOTAL_INSNS], in parse_verif_log()
881 &s->stats[MAX_STATES_PER_INSN], in parse_verif_log()
882 &s->stats[TOTAL_STATES], in parse_verif_log()
883 &s->stats[PEAK_STATES], in parse_verif_log()
884 &s->stats[MARK_READ_MAX_LEN])) in parse_verif_log()
890 while ((token = strtok_r(cnt++ ? NULL : stack, "+", &state))) { in parse_verif_log()
893 s->stats[STACK] += sub_stack; in parse_verif_log()
900 int cnt; member
916 if (a_cnt->cnt != b_cnt->cnt) in line_cnt_cmp()
917 return a_cnt->cnt > b_cnt->cnt ? -1 : 1; in line_cnt_cmp()
918 return strcmp(a_cnt->line, b_cnt->line); in line_cnt_cmp()
945 err = -ENOMEM; in print_top_src_lines()
961 err = -ENOMEM; in print_top_src_lines()
966 cur->line = lines[0]; in print_top_src_lines()
967 cur->cnt = 1; in print_top_src_lines()
969 if (strcmp(lines[i], cur->line) != 0) { in print_top_src_lines()
971 cur->line = lines[i]; in print_top_src_lines()
972 cur->cnt = 0; in print_top_src_lines()
974 cur->cnt++; in print_top_src_lines()
976 unique_lines = cur - freq + 1; in print_top_src_lines()
993 split--; in print_top_src_lines()
998 printf("%5d: (%s)\t%s\n", freq[i].cnt, src_line, src_code); in print_top_src_lines()
1000 printf("%5d: %s\n", freq[i].cnt, src_code); in print_top_src_lines()
1011 enum bpf_prog_type *prog_type, in guess_prog_type_by_ctx_name()
1012 enum bpf_attach_type *attach_type) in guess_prog_type_by_ctx_name()
1019 * Just in case, we support both UAPI-side type names and in guess_prog_type_by_ctx_name()
1020 * kernel-internal names. in guess_prog_type_by_ctx_name()
1025 enum bpf_prog_type prog_type; in guess_prog_type_by_ctx_name()
1026 enum bpf_attach_type attach_type; in guess_prog_type_by_ctx_name()
1044 * to match on that, probably; so NULL for kern-side type in guess_prog_type_by_ctx_name()
1051 return -EINVAL; in guess_prog_type_by_ctx_name()
1062 return -ESRCH; in guess_prog_type_by_ctx_name()
1088 mt = btf__type_by_id(btf, m->type); in mask_unrelated_struct_ops_progs()
1091 moff = m->offset / 8; in mask_unrelated_struct_ops_progs()
1132 enum bpf_prog_type prog_type; in fixup_obj()
1133 enum bpf_attach_type attach_type; in fixup_obj()
1143 t = btf__type_by_id(btf, t->type); in fixup_obj()
1150 t = btf__type_by_id(btf, t->type); in fixup_obj()
1153 t = btf__type_by_id(btf, t->type); in fixup_obj()
1155 t = btf__type_by_id(btf, t->type); in fixup_obj()
1159 ctx_name = btf__name_by_offset(btf, t->name_off); in fixup_obj()
1172 …printf("Failed to guess program type for freplace program with context type name '%s' for %s/%s. C… in fixup_obj()
1191 .log_buf = (void *)-1, in max_verifier_log_size()
1202 if (ret == -EFAULT) in max_verifier_log_size()
1204 else /* ret == -EINVAL, big log size is not supported by the verifier */ in max_verifier_log_size()
1230 return -ENOMEM; in process_prog()
1239 return -ENOMEM; in process_prog()
1242 /* --top-src-lines needs verifier log */ in process_prog()
1267 stats->file_name = strdup(base_filename); in process_prog()
1268 stats->prog_name = strdup(bpf_program__name(prog)); in process_prog()
1269 stats->stats[VERDICT] = err == 0; /* 1 - success, 0 - failure */ in process_prog()
1270 stats->stats[SIZE] = bpf_program__insn_cnt(prog); in process_prog()
1271 stats->stats[PROG_TYPE] = bpf_program__type(prog); in process_prog()
1272 stats->stats[ATTACH_TYPE] = bpf_program__expected_attach_type(prog); in process_prog()
1277 stats->stats[JITED_SIZE] = info.jited_prog_len; in process_prog()
1283 filename, prog_name, stats->stats[DURATION], in process_prog()
1287 print_top_src_lines(buf, buf_sz, stats->prog_name); in process_prog()
1329 fprintf(stderr, "Failed to open '%s': %d\n", filename, -errno); in process_obj()
1353 err = -errno; in process_obj()
1381 enum stat_id id, bool asc, bool abs) in cmp_stat()
1387 cmp = strcmp(s1->file_name, s2->file_name); in cmp_stat()
1390 cmp = strcmp(s1->prog_name, s2->prog_name); in cmp_stat()
1404 long v1 = s1->stats[id]; in cmp_stat()
1405 long v2 = s2->stats[id]; in cmp_stat()
1408 v1 = v1 < 0 ? -v1 : v1; in cmp_stat()
1409 v2 = v2 < 0 ? -v2 : v2; in cmp_stat()
1413 cmp = v1 < v2 ? -1 : 1; in cmp_stat()
1421 return asc ? cmp : -cmp; in cmp_stat()
1437 cmp = strcmp(s1->file_name, s2->file_name); in cmp_prog_stats()
1440 return strcmp(s1->prog_name, s2->prog_name); in cmp_prog_stats()
1444 enum stat_id id, enum stat_variant var, in fetch_join_stat_value()
1451 *str_val = s->file_name; in fetch_join_stat_value()
1455 *str_val = s->prog_name; in fetch_join_stat_value()
1459 v1 = s->stats_a ? s->stats_a->stats[id] : 0; in fetch_join_stat_value()
1460 v2 = s->stats_b ? s->stats_b->stats[id] : 0; in fetch_join_stat_value()
1464 if (!s->stats_a) in fetch_join_stat_value()
1465 *num_val = -DBL_MAX; in fetch_join_stat_value()
1467 *num_val = s->stats_a->stats[id]; in fetch_join_stat_value()
1470 if (!s->stats_b) in fetch_join_stat_value()
1471 *num_val = -DBL_MAX; in fetch_join_stat_value()
1473 *num_val = s->stats_b->stats[id]; in fetch_join_stat_value()
1476 if (!s->stats_a || !s->stats_b) in fetch_join_stat_value()
1477 *num_val = -DBL_MAX; in fetch_join_stat_value()
1481 *num_val = (double)(v2 - v1); in fetch_join_stat_value()
1484 if (!s->stats_a || !s->stats_b) { in fetch_join_stat_value()
1485 *num_val = -DBL_MAX; in fetch_join_stat_value()
1490 *num_val = v2 < v1 ? -100.0 : 100.0; in fetch_join_stat_value()
1492 *num_val = (v2 - v1) * 100.0 / v1; in fetch_join_stat_value()
1500 enum stat_id id, enum stat_variant var, in cmp_join_stat()
1518 cmp = v1 < v2 ? -1 : 1; in cmp_join_stat()
1520 return asc ? cmp : -cmp; in cmp_join_stat()
1539 cmp = strcmp(s1->file_name, s2->file_name); in cmp_join_stats()
1542 return strcmp(s1->prog_name, s2->prog_name); in cmp_join_stats()
1545 #define HEADER_CHAR '-'
1562 static void output_headers(enum resfmt fmt) in output_headers()
1578 fmt_str = stat_defs[id].left_aligned ? "%s%-*s" : "%s%*s"; in output_headers()
1580 if (i == env.output_spec.spec_cnt - 1) in output_headers()
1585 if (i == env.output_spec.spec_cnt - 1) in output_headers()
1595 static void prepare_value(const struct verif_stats *s, enum stat_id id, in prepare_value()
1600 *str = s ? s->file_name : "N/A"; in prepare_value()
1603 *str = s ? s->prog_name : "N/A"; in prepare_value()
1609 *str = s->stats[VERDICT] ? "success" : "failure"; in prepare_value()
1615 *str = libbpf_bpf_attach_type_str(s->stats[ATTACH_TYPE]) ?: "N/A"; in prepare_value()
1621 *str = libbpf_bpf_prog_type_str(s->stats[PROG_TYPE]) ?: "N/A"; in prepare_value()
1632 *val = s ? s->stats[id] : 0; in prepare_value()
1640 static void output_stats(const struct verif_stats *s, enum resfmt fmt, bool last) in output_stats()
1663 printf("%s%-*s", i == 0 ? "" : COLUMN_SEP, *max_len, str); in output_stats()
1666 if (i == env.output_spec.spec_cnt - 1) in output_stats()
1674 if (i == env.output_spec.spec_cnt - 1) in output_stats()
1687 static int parse_stat_value(const char *str, enum stat_id id, struct verif_stats *st) in parse_stat_value()
1691 st->file_name = strdup(str); in parse_stat_value()
1692 if (!st->file_name) in parse_stat_value()
1693 return -ENOMEM; in parse_stat_value()
1696 st->prog_name = strdup(str); in parse_stat_value()
1697 if (!st->prog_name) in parse_stat_value()
1698 return -ENOMEM; in parse_stat_value()
1702 st->stats[VERDICT] = true; in parse_stat_value()
1704 st->stats[VERDICT] = false; in parse_stat_value()
1707 return -EINVAL; in parse_stat_value()
1723 err = -errno; in parse_stat_value()
1728 st->stats[id] = val; in parse_stat_value()
1732 enum bpf_prog_type prog_type = 0; in parse_stat_value()
1737 st->stats[id] = prog_type; in parse_stat_value()
1745 return -EINVAL; in parse_stat_value()
1750 enum bpf_attach_type attach_type = 0; in parse_stat_value()
1755 st->stats[id] = attach_type; in parse_stat_value()
1763 return -EINVAL; in parse_stat_value()
1769 return -EINVAL; in parse_stat_value()
1784 err = -errno; in parse_stats_csv()
1794 int col = 0, cnt = 0; in parse_stats_csv() local
1801 err = -ENOMEM; in parse_stats_csv()
1812 while ((next = strtok_r(cnt++ ? NULL : input, ",\n", &state))) { in parse_stats_csv()
1822 if (col >= specs->spec_cnt) { in parse_stats_csv()
1825 err = -EINVAL; in parse_stats_csv()
1828 err = parse_stat_value(next, specs->ids[col], st); in parse_stats_csv()
1839 if (col < specs->spec_cnt) { in parse_stats_csv()
1842 err = -EINVAL; in parse_stats_csv()
1846 if (!st->file_name || !st->prog_name) { in parse_stats_csv()
1847 fprintf(stderr, "Row #%d in '%s' is missing file and/or program name\n", in parse_stats_csv()
1849 err = -EINVAL; in parse_stats_csv()
1857 if (!should_process_file_prog(st->file_name, st->prog_name)) { in parse_stats_csv()
1858 free(st->file_name); in parse_stats_csv()
1859 free(st->prog_name); in parse_stats_csv()
1860 *stat_cntp -= 1; in parse_stats_csv()
1865 err = -errno; in parse_stats_csv()
1877 static bool is_key_stat(enum stat_id id) in is_key_stat()
1902 static void output_comp_headers(enum resfmt fmt) in output_comp_headers()
1915 bool last = (i == env.output_spec.spec_cnt - 1) && (j == max_j - 1); in output_comp_headers()
1927 printf("%s%-*s%s", i + j == 0 ? "" : COLUMN_SEP, in output_comp_headers()
1928 *max_len - (int)strlen(sfx), stat_defs[id].header, sfx); in output_comp_headers()
1947 enum resfmt fmt, bool last) in output_comp_stats()
1949 const struct verif_stats *base = join_stats->stats_a; in output_comp_stats()
1950 const struct verif_stats *comp = join_stats->stats_b; in output_comp_stats()
1967 /* key stats (file and program name) are always strings */ in output_comp_stats()
1993 diff_val = comp_val - base_val; in output_comp_stats()
2001 p = comp_val < base_val ? -100.0 : 100.0; in output_comp_stats()
2024 /* string outputs are left-aligned, number outputs are right-aligned */ in output_comp_stats()
2025 const char *fmt = base_str ? "%s%-*s" : "%s%*s"; in output_comp_stats()
2032 if (i == env.output_spec.spec_cnt - 1) in output_comp_stats()
2042 if (i == env.output_spec.spec_cnt - 1) in output_comp_stats()
2056 r = strcmp(base->file_name, comp->file_name); in cmp_stats_key()
2059 return strcmp(base->prog_name, comp->prog_name); in cmp_stats_key()
2064 static const double eps = 1e-9; in is_join_stat_filter_matched()
2068 fetch_join_stat_value(stats, f->stat_id, f->stat_var, &str, &value); in is_join_stat_filter_matched()
2070 if (f->abs) in is_join_stat_filter_matched()
2073 switch (f->op) { in is_join_stat_filter_matched()
2074 case OP_EQ: return value > f->value - eps && value < f->value + eps; in is_join_stat_filter_matched()
2075 case OP_NEQ: return value < f->value - eps || value > f->value + eps; in is_join_stat_filter_matched()
2076 case OP_LT: return value < f->value - eps; in is_join_stat_filter_matched()
2077 case OP_LE: return value <= f->value + eps; in is_join_stat_filter_matched()
2078 case OP_GT: return value > f->value + eps; in is_join_stat_filter_matched()
2079 case OP_GE: return value >= f->value - eps; in is_join_stat_filter_matched()
2082 fprintf(stderr, "BUG: unknown filter op %d!\n", f->op); in is_join_stat_filter_matched()
2093 if (f->kind != FILTER_STAT) in should_output_join_stats()
2102 if (f->kind != FILTER_STAT) in should_output_join_stats()
2118 enum resfmt cur_fmt; in handle_comparison_mode()
2119 int err, i, j, last_idx, cnt; in handle_comparison_mode() local
2124 return -EINVAL; in handle_comparison_mode()
2142 * pre-processing later. in handle_comparison_mode()
2148 return -EINVAL; in handle_comparison_mode()
2156 return -EINVAL; in handle_comparison_mode()
2160 /* Replace user-specified sorting spec with file+prog sorting rule to in handle_comparison_mode()
2185 if (!base->file_name || !base->prog_name) { in handle_comparison_mode()
2186 fprintf(stderr, "Entry #%d in '%s' doesn't have file and/or program name specified!\n", in handle_comparison_mode()
2188 return -EINVAL; in handle_comparison_mode()
2190 if (!comp->file_name || !comp->prog_name) { in handle_comparison_mode()
2191 fprintf(stderr, "Entry #%d in '%s' doesn't have file and/or program name specified!\n", in handle_comparison_mode()
2193 return -EINVAL; in handle_comparison_mode()
2198 return -ENOMEM; in handle_comparison_mode()
2206 join->file_name = base->file_name; in handle_comparison_mode()
2207 join->prog_name = base->prog_name; in handle_comparison_mode()
2208 join->stats_a = base; in handle_comparison_mode()
2209 join->stats_b = comp; in handle_comparison_mode()
2213 join->file_name = base->file_name; in handle_comparison_mode()
2214 join->prog_name = base->prog_name; in handle_comparison_mode()
2215 join->stats_a = base; in handle_comparison_mode()
2216 join->stats_b = NULL; in handle_comparison_mode()
2219 join->file_name = comp->file_name; in handle_comparison_mode()
2220 join->prog_name = comp->prog_name; in handle_comparison_mode()
2221 join->stats_a = NULL; in handle_comparison_mode()
2222 join->stats_b = comp; in handle_comparison_mode()
2227 return -EINVAL; in handle_comparison_mode()
2235 /* for human-readable table output we need to do extra pass to in handle_comparison_mode()
2248 last_idx = -1; in handle_comparison_mode()
2249 cnt = 0; in handle_comparison_mode()
2256 if (env.top_n && cnt >= env.top_n) in handle_comparison_mode()
2264 cnt++; in handle_comparison_mode()
2277 long value = stats->stats[f->stat_id]; in is_stat_filter_matched()
2279 if (f->abs) in is_stat_filter_matched()
2280 value = value < 0 ? -value : value; in is_stat_filter_matched()
2282 switch (f->op) { in is_stat_filter_matched()
2283 case OP_EQ: return value == f->value; in is_stat_filter_matched()
2284 case OP_NEQ: return value != f->value; in is_stat_filter_matched()
2285 case OP_LT: return value < f->value; in is_stat_filter_matched()
2286 case OP_LE: return value <= f->value; in is_stat_filter_matched()
2287 case OP_GT: return value > f->value; in is_stat_filter_matched()
2288 case OP_GE: return value >= f->value; in is_stat_filter_matched()
2291 fprintf(stderr, "BUG: unknown filter op %d!\n", f->op); in is_stat_filter_matched()
2302 if (f->kind != FILTER_STAT) in should_output_stats()
2311 if (f->kind != FILTER_STAT) in should_output_stats()
2326 int i, last_stat_idx = 0, cnt = 0; in output_prog_stats() local
2346 if (env.top_n && cnt >= env.top_n) in output_prog_stats()
2349 cnt++; in output_prog_stats()
2360 return -EINVAL; in handle_verif_mode()
2386 return -EINVAL; in handle_replay_mode()
2463 return -err; in main()