Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Profiler API : GetObjectReferences #12548

Closed
mjsabby opened this issue Apr 21, 2019 · 6 comments · Fixed by dotnet/coreclr#24156
Closed

Add Profiler API : GetObjectReferences #12548

mjsabby opened this issue Apr 21, 2019 · 6 comments · Fixed by dotnet/coreclr#24156
Assignees
Labels
area-Diagnostics-coreclr documentation Documentation bug or enhancement, does not impact product or test code feature-request
Milestone

Comments

@mjsabby
Copy link
Contributor

mjsabby commented Apr 21, 2019

The Profiler API today has ICorProfilerCallback::ObjectReferences which is called after a GC is completed. This is called for remaining object in the heap.

For large heaps and/or heaps with moderate survival rate this can be prohibitively expensive to enable in a production environment.

In conjuction with https://github.com/dotnet/coreclr/issues/24132, this API can be used to selectively traverse object graphs. In fact, with this API you could implement the aforementioned expensive callback that already exists in the profiling API. So this customization is a welcome addition to the Profiler API.

The signature would be:

GetObjectReferences(ObjectID objectId, ULONG32 cNumReferences, ULONG32 *pcNumReferences, ObjectID references[])

Passing 0 for cNumReferences will fill do a traversal for this object and fill up pcNumReferences. A subsequent call with the cNumReferences parameter set to the value returned in the first call (pcNumReferences) will expect an appropriately allocated array of ObjectIDs to fill the data in.

A point of discussion could be if field offsets should be included. I'm of the opinion they are superflous for most object graph traversals.

@mjsabby
Copy link
Contributor Author

mjsabby commented Apr 21, 2019

cc @Maoni0 @noahfalk

@noahfalk
Copy link
Member

@davmason

A point of discussion could be if field offsets should be included. I'm of the opinion they are superflous for most object graph traversals.

If you don't include them it is very hard to determine which fields hold which references. Check out issue #9685 for a good example of a serious profiling tool that cares about this. If there is a significant complexity it adds to the design or usage we should discuss, but on first impression it feels like a pretty low cost addition that solves a real problem with the existing API.

@mjsabby
Copy link
Contributor Author

mjsabby commented Apr 23, 2019

I don't have a problem in adding offsets, it's just that the existing code just worked and was a good way to gauge if there are other issues or concerns the team has. Now I'll have to write a custom go_through_object handler, but that's not a lot of work.

@noahfalk
Copy link
Member

I'm re-opening this issue until docs are in place (I think GitHub auto-closes when you merge the PR)

@noahfalk noahfalk reopened this Apr 25, 2019
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the 5.0 milestone Jan 31, 2020
@tommcdon tommcdon added the tracking This issue is tracking the completion of other related issues. label May 6, 2020
@tommcdon tommcdon modified the milestones: 5.0, Future May 6, 2020
@tommcdon tommcdon modified the milestones: Future, 6.0.0 Jul 8, 2020
@tommcdon tommcdon added documentation Documentation bug or enhancement, does not impact product or test code and removed tracking This issue is tracking the completion of other related issues. labels Oct 14, 2020
@davmason
Copy link
Member

davmason commented Nov 3, 2020

@mjsabby have you worked on docs at all?

@tommcdon tommcdon modified the milestones: 6.0.0, 7.0.0 Jun 16, 2021
@noahfalk noahfalk assigned davmason and unassigned mjsabby Apr 25, 2022
@mikelle-rogers
Copy link
Member

Already documented.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Diagnostics-coreclr documentation Documentation bug or enhancement, does not impact product or test code feature-request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants