digitalmars.D - More std.allocator goodies coming your way: better statistics
- Andrei Alexandrescu (6/6) May 18 2015 Beautiful statistics accumulated for the allocator instance and/or per
- Timon Gehr (18/24) May 18 2015 - The documentation for numAllocateOK is wrong. (Allocating zero bytes
- Andrei Alexandrescu (13/46) May 18 2015 Couldn't think of any, but I'm sure use will bring new ideas. In fact
- Jacob Carlborg (10/15) May 18 2015 Since Options.all is the default value in StatsCollector. I think "all"
Beautiful statistics accumulated for the allocator instance and/or per call location: http://erdani.com/d/phobos-prerelease/std_experimental_allocator_stats_collector.html https://github.com/andralex/phobos/blob/allocator/std/experimental/allocator/stats_collector.d Destructors welcome. Andrei
May 18 2015
On 05/18/2015 08:53 PM, Andrei Alexandrescu wrote:Beautiful statistics accumulated for the allocator instance and/or per call location: http://erdani.com/d/phobos-prerelease/std_experimental_allocator_stats_collector.html https://github.com/andralex/phobos/blob/allocator/std/experimental/allocator/stats_collector.d Destructors welcome. Andrei- The documentation for numAllocateOK is wrong. (Allocating zero bytes is always successful.) - bytesHighTide is not properly updated. (I suggest to just move the check into the implementation of 'add' and be done with it.) Also, is this really the only value where it is useful to track a maximum, or other summaries? - The documentation is inconsistent on whether bytesContracted should be changed in deallocate; the implementation does it. (I don't see why it should.) - 'static struct Voldermort' - I think line 602 is not what you wanted. 'if (!s.next && root != &s)' !s.next <-> 's' has not been added, or it is the last element of the list root != &s <-> 's' is not the first element of the list I.e. if 's' is the last element of a list that contains more than one element, the list will become cyclic.
May 18 2015
On 5/18/15 1:30 PM, Timon Gehr wrote:On 05/18/2015 08:53 PM, Andrei Alexandrescu wrote:Fixed.Beautiful statistics accumulated for the allocator instance and/or per call location: http://erdani.com/d/phobos-prerelease/std_experimental_allocator_stats_collector.html https://github.com/andralex/phobos/blob/allocator/std/experimental/allocator/stats_collector.d Destructors welcome. Andrei- The documentation for numAllocateOK is wrong. (Allocating zero bytes is always successful.)- bytesHighTide is not properly updated. (I suggest to just move the check into the implementation of 'add' and be done with it.) Also, is this really the only value where it is useful to track a maximum, or other summaries?Couldn't think of any, but I'm sure use will bring new ideas. In fact for better capacity I just made Option a 64-bit value.- The documentation is inconsistent on whether bytesContracted should be changed in deallocate; the implementation does it. (I don't see why it should.)Well, in per-call stats I "reuse" it for counting calls to deallocate. I clarified that in the documentation. I could add another one, but bytesUsed is redundant with bytesAllocated - bytesDeallocated (the latter doesn't exist) and redundancy sux. Then bytesUsed is very useful because it's easy to think about ("how many bytes I'm currently using").- 'static struct Voldermort'Ouch.- I think line 602 is not what you wanted. 'if (!s.next && root != &s)' !s.next <-> 's' has not been added, or it is the last element of the list root != &s <-> 's' is not the first element of the list I.e. if 's' is the last element of a list that contains more than one element, the list will become cyclic.That explains a number of things :o). Fixed. Thanks! Andrei
May 18 2015
On 2015-05-18 20:53, Andrei Alexandrescu wrote:Beautiful statistics accumulated for the allocator instance and/or per call location: http://erdani.com/d/phobos-prerelease/std_experimental_allocator_stats_collector.html https://github.com/andralex/phobos/blob/allocator/std/experimental/allocator/stats_collector.d Destructors welcome.Since Options.all is the default value in StatsCollector. I think "all" should be the first member of "Options". Then this will be the default value when declaring variables of the type "Options" without initializing them. You have abbreviated "options" to "opts" in PerCallStatistics, I don't think that gains much and you haven't abbreviated anything else, exception the Options members. -- /Jacob Carlborg
May 18 2015