From 949e8c4f14de4e08d704cee15b8812860761056a Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Fri, 22 Jun 2007 16:43:29 -0300 Subject: [PATCH] [PAHOLE]: Implement --quiet For now it just suppresses the struct statistics at the end of the output, but will also suppress the comments about holes. Signed-off-by: Arnaldo Carvalho de Melo --- dwarves.c | 3 ++- pahole.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dwarves.c b/dwarves.c index d8cb2d0..bb6f197 100644 --- a/dwarves.c +++ b/dwarves.c @@ -2393,8 +2393,9 @@ size_t class__fprintf(struct class *self, const struct cu *cu, cconf.indent, tabs, tself->size, sum, sum_holes, tself->size - (sum + sum_holes)); + putchar('\n'); out: - return printed + fprintf(fp, "\n%.*s}%s%s", indent, tabs, + return printed + fprintf(fp, "%.*s}%s%s", indent, tabs, cconf.suffix ? " ": "", cconf.suffix ?: ""); } diff --git a/pahole.c b/pahole.c index 81d52dd..f99e1f2 100644 --- a/pahole.c +++ b/pahole.c @@ -35,6 +35,7 @@ static uint16_t nr_bit_holes; static uint16_t hole_size_ge; static uint8_t show_packable; static uint8_t global_verbose; +static uint8_t quiet; static uint8_t recursive; static size_t cacheline_size; static uint8_t find_containers; @@ -44,7 +45,7 @@ static char *class_name; static char separator = '\t'; static Dwarf_Off class_dwarf_offset; -struct conf_fprintf conf = { +static struct conf_fprintf conf = { .emit_stats = 1, }; @@ -185,7 +186,9 @@ static void class_formatter(struct structure *self) tag__fprintf(tag, self->cu, &conf, stdout); - printf("\t/* definitions: %u */\n", self->nr_files); + if (conf.emit_stats) + printf("\t/* definitions: %u */\n", self->nr_files); + putchar('\n'); } @@ -596,6 +599,11 @@ static const struct argp_option pahole__options[] = { .key = 'A', .doc = "include nested (inside other structs) anonymous classes", }, + { + .name = "quiet", + .key = 'q', + .doc = "be quieter", + }, { .name = "verbose", .key = 'V', @@ -650,6 +658,7 @@ static error_t pahole__options_parser(int key, char *arg, case 'X': cu__exclude_prefix = arg; cu__exclude_prefix_len = strlen(cu__exclude_prefix); break; + case 'q': conf.emit_stats = 0; break; case 'V': global_verbose = 1; break; default: return ARGP_ERR_UNKNOWN;