PATCH: profile mode fix for threads on solaris and cleanup

Silvius Rus rus@google.com
Mon May 10 22:33:00 GMT 2010


Hello Paolo,

Could you please review the attached trunk patch.  Note that it
reverts partially some of the emergency changes you made last week to
avoid including <algorithm> with -std=c++.  Instead of inlining the
code by hand, I preferred to keep it in different functions and
implement simple versions of 'for_each' and 'remove', which come with
unit tests.

The formatting mistakes you pointed out throughout include/profile/...
(bracket at end of line) will be fixed in a later patch.

Thank you,
Silvius


Summary:

- Fix 43259 by using __gnu_cxx::__mutex instead of fiddling with macro names.
- Fix TODO.  Instead of sorting and then keeping top 10 diagnostics,
implement simple "top n" algorithm.
- Implement a few simple algorithms to avoid including <algorithm>.
- Remove all calls to setenv.

Tested:

1. make check-profile on linux x86_64.
  A few tests had execution failures in backtrace due to a config
error on my system.  I will make sure the tests pass *before*
submitting.

2. Karel Gardas validated (Thanks!) that the patch fixes 43259 on
SunOS thinkpad 5.11 snv_134 i86pc.

Changelog entry:

2010-05-10  Silvius Rus  <silvius.rus@gmail.com>

	PR libstdc++/43259
	* include/Makefile.am: Add profiler_algos.h.
	* include/Makefile.in: Add profiler_algos.h.
	* include/profile/impl/profiler_algos.h: New.
	* testsuite/ext/profile/profiler_algos.cc: New.
	* include/profile/impl/profiler.h: Add
	(_GLIBCXX_PROFILE_DEFINE_UNINIT_DATA): Add.
	* include/profile/impl/profiler_trace.h:
	(__read_cost_factors): Remove call to setenv.
	(__mutex_t, __lock, __unlock): Remove.
	(__lock_object_table, __lock_stack_table): Remove.  Replace uses with
	calls to __gnu_cxx::__mutex::lock.
	(__unlock_object_table, __unlock_stack_table): Remove.  Replace uses
	with calls to __gnu_cxx::__mutex::unlock.
	(__warn, __cost_factor_writer, __cost_factor_setter): Add.



More information about the Libstdc++ mailing list