diff options
author | Ian Lance Taylor <iant@google.com> | 2007-12-18 21:24:10 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-12-18 21:24:10 +0000 |
commit | 38c5e8b493ec72879187ffca3d8533acd2c014a5 (patch) | |
tree | da1699c0936f8c22611469fe0bafae8e117a6658 /gold/merge.h | |
parent | cb2dde36a0abb8f59c950187153a245264759fa1 (diff) | |
download | gdb-38c5e8b493ec72879187ffca3d8533acd2c014a5.zip gdb-38c5e8b493ec72879187ffca3d8533acd2c014a5.tar.gz gdb-38c5e8b493ec72879187ffca3d8533acd2c014a5.tar.bz2 |
Print statistics about merge sections with --stats.
Diffstat (limited to 'gold/merge.h')
-rw-r--r-- | gold/merge.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gold/merge.h b/gold/merge.h index a649321..056c2c6 100644 --- a/gold/merge.h +++ b/gold/merge.h @@ -108,9 +108,11 @@ class Output_merge_data : public Output_merge_base public: Output_merge_data(uint64_t entsize, uint64_t addralign) : Output_merge_base(entsize, addralign), p_(NULL), len_(0), alc_(0), + input_count_(0), hashtable_(128, Merge_data_hash(this), Merge_data_eq(this)) { } + protected: // Add an input section. bool do_add_input_section(Relobj* object, unsigned int shndx); @@ -127,6 +129,10 @@ class Output_merge_data : public Output_merge_base void do_write_to_buffer(unsigned char*); + // Print merge stats to stderr. + void + do_print_merge_stats(const char* section_name); + private: // We build a hash table of the fixed-size constants. Each constant // is stored as a pointer into the section data we are accumulating. @@ -197,6 +203,8 @@ class Output_merge_data : public Output_merge_base section_size_type len_; // The size of the allocated buffer. section_size_type alc_; + // The number of entries seen in input files. + size_t input_count_; // The hash table. Merge_data_hashtable hashtable_; }; @@ -210,7 +218,7 @@ class Output_merge_string : public Output_merge_base public: Output_merge_string(uint64_t addralign) : Output_merge_base(sizeof(Char_type), addralign), stringpool_(), - merged_strings_() + merged_strings_(), input_count_(0) { gold_assert(addralign <= sizeof(Char_type)); this->stringpool_.set_no_zero_null(); @@ -238,6 +246,10 @@ class Output_merge_string : public Output_merge_base void do_write_to_buffer(unsigned char*); + // Print merge stats to stderr. + void + do_print_merge_stats(const char* section_name); + // Writes the stringpool to a buffer. void stringpool_to_buffer(unsigned char* buffer, section_size_type buffer_size) @@ -249,6 +261,10 @@ class Output_merge_string : public Output_merge_base { this->stringpool_.clear(); } private: + // The name of the string type, for stats. + const char* + string_name(); + // As we see input sections, we build a mapping from object, section // index and offset to strings. struct Merged_string @@ -279,6 +295,8 @@ class Output_merge_string : public Output_merge_base // Map from a location in an input object to an entry in the // Stringpool. Merged_strings merged_strings_; + // The number of entries seen in input files. + size_t input_count_; }; } // End namespace gold. |