diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-08-19 09:49:30 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-08-20 16:40:27 -0300 |
commit | f035871495435e584b5248f0f7d908b7d17190f0 (patch) | |
tree | c9b6bbac9884f646562394fa1ea63a7e6cad2aba | |
parent | c59e996c97eb55698fe34b1a0aa0e540456f672d (diff) | |
download | dwarves-f035871495435e584b5248f0f7d908b7d17190f0.tar.gz |
core: Add CU stats printer
To help sizing some tables, etc.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | dwarves.c | 15 | ||||
-rw-r--r-- | dwarves.h | 4 |
2 files changed, 19 insertions, 0 deletions
@@ -605,6 +605,21 @@ int cu__add_tag_with_id(struct cu *cu, struct tag *tag, uint32_t id) return err; } +int cus__fprintf_ptr_table_stats_csv_header(FILE *fp) +{ + return fprintf(fp, "# cu,tags,allocated_tags,types,allocated_types,functions,allocated_functions\n"); +} + +int cu__fprintf_ptr_table_stats_csv(struct cu *cu, FILE *fp) +{ + int printed = fprintf(fp, "%s,%u,%u,%u,%u,%u,%u\n", cu->name, + cu->tags_table.nr_entries, cu->tags_table.allocated_entries, + cu->types_table.nr_entries, cu->types_table.allocated_entries, + cu->functions_table.nr_entries, cu->functions_table.allocated_entries); + + return printed; +} + struct cu *cu__new(const char *name, uint8_t addr_size, const unsigned char *build_id, int build_id_len, const char *filename, bool use_obstack) @@ -262,6 +262,10 @@ void *cu__malloc(struct cu *cu, size_t size); void *cu__zalloc(struct cu *cu, size_t size); void cu__free(struct cu *cu, void *ptr); +int cu__fprintf_ptr_table_stats_csv(struct cu *cu, FILE *fp); + +int cus__fprintf_ptr_table_stats_csv_header(FILE *fp); + static inline int cu__cache_symtab(struct cu *cu) { int err = dwfl_module_getsymtab(cu->dwfl); |