Add timing to the verbose logs of abidw
authorDodji Seketeli <dodji@redhat.com>
Fri, 19 Jul 2019 08:14:40 +0000 (10:14 +0200)
committerDodji Seketeli <dodji@redhat.com>
Fri, 19 Jul 2019 08:46:42 +0000 (10:46 +0200)
commit3df54522b8d90a93c9d22ed4b951b2a23b25f3af
tree796e2f2d7cb4570ef7a39f57d7955e95cd1224eb
parent465a165e80da8bb1fa366c579eb2ed436dd9f651
Add timing to the verbose logs of abidw

While doing my recent optimization work, it became useful to have an
idea of the time different parts of the processing pipeline are
taking.

This patch introduces an abigail::tools_utils::timer type that is easy
to use to time a given part of the code and emit the elapsed time to
an output stream.

This abigail::tools_utils::timer type is thus used to time various
parts of the processing pipeline involved in abidw.  Just using the
existing --verbose option now yields timing information.

* include/abg-tools-utils.h (class timer): Declare new type.
(operator<<(ostream&, const timer&)): Declare new streaming
operator for the new timer type.
* src/abg-tools-utils.cc (struct timer::priv): Define new type.
(timer::{timer, start, stop, value_in_seconds, value,
value_as_string, ~timer}): Define member functions.
(operator<<(ostream& o, const timer& t)): Define streaming
operator.
(build_corpus_group_from_kernel_dist_under): Add timing logs to
the linux kernel reading process.
* src/abg-dwarf-reader.cc
(read_context::canonicalize_types_scheduled): Add timing logs to
type canonicalization.
(read_debug_info_into_corpus): Add timing logs for the whole debug
info loading and internal representation building process.
* tools/abidw.cc (load_corpus_and_write_abixml): Add timing logs
for the binary loading and serizalization process.
(load_kernel_corpus_group_and_write_abixml): Add timing logs the
Linux Kernel binary loading and writing process.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-tools-utils.h
src/abg-dwarf-reader.cc
src/abg-tools-utils.cc
tools/abidw.cc