none
Get Garbage collection Detail in CLR profiler RRS feed

  • Question

  • hi,

     I have written a profiler that uses corprofiler API.
     I have set an event mask "COR_PRF_MONITOR_GC" when the profile is initialized.
     Now,GarbageCollectionFinished,GarbageCollectionStarted callback method getting called and can able to get the
     location of GC (Gen0,Gen1,Gen2,Large_heap) where its started.

    But, I need the information like,
      1.Number of Objects Cleaned in Gen 0,Gen 1 ...., 
      2.Number of Objects survived in Gen 0,Gen 1 .. large_heap.
      3.Size of Object.

    I thought MovedReferences or SurvivingReferences not giving the exact answers,
    "None of the ObjectID values passed by MovedReferences are valid during the callback itself, because the garbage collection might be in the middle of moving objects from old locations to new locations."

    How can i get this above info? 



    Monday, May 8, 2017 12:13 PM

Answers

All replies

  • Hi Duraikannu Jeyamani,

    According to your description, it seems that you want to access performance counter information.

    From unmanaged Win32 applications you can access performance counter information   by querying the Windows registry or by using the PDH (Performance Data Helper)   library. Unfortunately for Delphi programmers there is no import unit supplied   with Delphi for the PDH library.

    From managed applications you could access performance counters using   the System.Diagnostics.PerformanceCounter   and System.Diagnostics.PerformanceCounterCategory   classes.

    For more information, please refer to:

    http://www.blong.com/conferences/dcon2003/internals/profiling.htm#PerformanceCounters

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 9, 2017 7:55 AM
    Moderator
  • Hi cole wu,

    Thanks for your response,
    If i access the Performance counter can able to get the value only in numbers(count).
    But i wants in detailed definition like class name, object size, list of cleaned objects
    and survived objects for each GC.

    Regards 
    Durai


    Tuesday, May 9, 2017 10:50 AM
  • Hi coey235,

    From the following document, please check the phase named "To determine references to objects", I would suggest that you could check ObjectReferences for related information.

    https://msdn.microsoft.com/en-us/library/ee851764(v=vs.110).aspx#ObjRef

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, May 11, 2017 1:43 AM
    Moderator