[2/9] dwarf-reader: Log the number of canonicalized types
Commit Message
Hello,
When doing abidw --verbose, log the number of unique canonicalized
types.
* src/abg-dwarf-reader.cc (reader::canonicalize_types_scheduled):
Log the number of unique canonicalized types in the system using
the new function environment::priv::get_number_of_canonical_types.
* src/abg-ir-priv.h
(environment::priv::get_number_of_canonical_types): Define new
function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the master branch.
---
src/abg-dwarf-reader.cc | 6 +++++-
src/abg-ir-priv.h | 14 ++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
@@ -5091,9 +5091,13 @@ public:
if (do_log())
{
cn_timer.stop();
+ const environment& env = types_to_canonicalize().front()->get_environment();
cerr << "DWARF Reader finished types "
<< "sorting, hashing & canonicalizing in: "
- << cn_timer << "\n";
+ << cn_timer
+ << ", for "
+ << env.priv_->get_number_of_canonical_types()
+ << " types\n";
}
}
@@ -806,6 +806,20 @@ struct environment::priv
right_type_comp_operands_.pop_back();
}
+ /// Get the number of canonical types in the system.
+ ///
+ /// @return the number of canonical types in the system.
+ size_t
+ get_number_of_canonical_types()
+ {
+ size_t n = 0;
+ for (auto& entry : canonical_types_)
+ for(unsigned i = 0; i < entry.second.size(); ++i)
+ ++n;
+
+ return n;
+ }
+
#ifdef WITH_DEBUG_SELF_COMPARISON
const unordered_map<string, uintptr_t>&