This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: profile mode: statistics for vector and map
- From: Gedare Bloom <gedare at rtems dot org>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 7 May 2013 18:16:57 -0400
- Subject: Re: profile mode: statistics for vector and map
- References: <CAC82fA12kOENEb2NJa37zjU8LKc4+6HueNzRgvu_MqCsAz3zDw at mail dot gmail dot com> <51896A93 dot 8040507 at gmail dot com>
On Tue, May 7, 2013 at 4:56 PM, François Dumont <frs.dumont@gmail.com> wrote:
> IMHO we should adopt the same kind of design I have introduced for the
> unordered containers that is to say a base class containing in its
> constructor the call to the instance registration and in the destructor the
> unregistration. This way special functions could be defaulted which will
> simplify maintenance and we would never forget the registration like in the
> vector constructor from initializer_list<value_type> one.
>
That's fine. If I have time I'll study your approach in more detail. I
had a look at the patch you sent, and your approach seems more robust.
The mechanisms here with macros and hand-inserted function call-outs
to wrap the "real" operations is easy to mess up.
I did this work in a rush last year and just recently had time to
package it and submit it. Either the patch bit-rots, someone fixes it,
or I can get around to it myself eventually. I do not have the
time/money for it right now. Someone requested the code recently, and
I provided it for 4.7.1 and thought I should push it upstream lest you
all think no one uses profile mode. :)
Side note: Profile mode improvements might make good GSoC projects.
-Gedare
> François
>
>
>
> On 05/07/2013 08:14 PM, Gedare Bloom wrote:
>>
>> Hi,
>>
>> The attached patch offers a start at the Statistics aspect of
>> libstdc++ profile mode. So far it implements vector and map statistics
>> for size (redundant/deprecates existing vector size) and common
>> operation counts. There are macros for turning on/off the vector and
>> map statistics individually, e.g.
>> _GLIBCXX_PROFILE_NO_VECTOR_STATISTICS and _NO_MAP_STATISTICS.
>>
>> Some improvements could be made still or remain for the future, such as:
>> * Use the _GLIBCXX_PROFILE_STATISTICS flag to turn on/off all statistics
>> * Cost heuristics or high resolution timers to get the costs of operations
>> * There were some problems with iterators, though I forget the specifics.
>> * More containers supported and tested.
>>
>> I have not done extensive testing on this version of the code. This
>> work was done previously on 4.7.1 with x86_64. I made some effort to
>> rebase this patch from Francois' unordered map patch. Hopefully there
>> are no conflicts remaining.
>>
>> 2013-05-07 Gedare Bloom <gedare@rtems.org>
>>
>> * include/profile/impl/profiler_container_statistics.h: New.
>> * include/profile/impl/profiler_vector_statistics.h: New.
>> * include/profile/impl/profiler_map_statistics.h: New.
>> * include/Makefile.am: Add new profile headers.
>> * include/Makefile.in: Regenerate.
>> * include/profile/impl/profiler.h: New macros for
>> __profcxx_vector_statistics and __profcxx_map_statistics.
>> * include/profile/impl/profiler_trace.h: Class and function
>> declarations
>> for std::profile::__trace_vector_statistics and
>> std::profile::__trace_map_statistics.
>> * include/profile/map.h: Use __profcxx_map_statistics macros.
>> * include/profile/vector: Use __profcxx_vector_statistics macros.
>
>