Export GC Usage Statistics on Request for Profiling

tcak via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 15 09:31:12 PDT 2016


On Friday, 15 July 2016 at 16:21:15 UTC, Jack Stouffer wrote:
> On Friday, 15 July 2016 at 16:14:39 UTC, tcak wrote:
>> It is great to see memory usage on Xcode while running an iOS 
>> app.
>>
>> What I thought is that:
>>
>> 1. GC knows available heap memory locations and their length.
>> 2. GC can detect what parts of heap is in use.
>> 3. A program can create a file to write (stdout, stderr, etc.)
>>
>>
>> So, when desired (e.g. use of a compiler flag), on runtime, GC 
>> could write statistical information to a file descriptor every 
>> time it runs. So, anyone could write a program to read that 
>> information to turn it into a graphical chart for profiling 
>> information.
>>
>> Does GC have any support to collect this type of information 
>> currently?
>
> Do you know about --profile=gc?

1. Never worked for me in a multithreaded program.
2. I am not able to retrieve that data on runtime by another 
application to see close to real-time statistics.

I know that profiling data is kept in memory, and written to file 
at the end of program. Instead it could write it to a file 
descriptor and not care about whether a program is reading it. 
Let the kernel handle that part.


More information about the Digitalmars-d mailing list