Skip to content

Commit

Permalink
Properly initialize appDomainId
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingosse authored and gleocadie committed Feb 19, 2025
1 parent 8b819da commit c03aa18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,21 @@ void AllocationsProvider::OnAllocation(std::chrono::nanoseconds timestamp,

// TODO: we need to check that threads are not jumping from one AppDomain to the other too frequently
// because we might be receiving this event 1 second after it has been emitted
// It this is the case, we should simply set the AppDomainId to -1 all the time.
// It this is the case, we should simply set the AppDomainId to 0 all the time.
AppDomainID appDomainId;
if (SUCCEEDED(_pCorProfilerInfo->GetThreadAppDomain(threadInfo->GetClrThreadId(), &appDomainId)))
{
rawSample.AppDomainId = appDomainId;
}
else
{
rawSample.AppDomainId = -1;
rawSample.AppDomainId = 0;
}
}
else // create a fake IThreadInfo that wraps the OS thread id (no name, no profiler thread id)
{
rawSample.ThreadInfo = std::make_shared<FrameworkThreadInfo>(threadId);

// TODO: do we need to set to -1?
// rawSample.AppDomainId = -1;
rawSample.AppDomainId = 0;
}

// rawSample.AllocationSize = objectSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,13 @@ void ContentionProvider::AddContentionSample(std::chrono::nanoseconds timestamp,
}
else
{
rawSample.AppDomainId = -1;
rawSample.AppDomainId = 0;
}
}
else // create a fake IThreadInfo that wraps the OS thread id (no name, no profiler thread id)
{
rawSample.ThreadInfo = std::make_shared<FrameworkThreadInfo>(threadId);

// TODO: do we need to set to -1?
//rawSample.AppDomainId = -1;
rawSample.AppDomainId = 0;
}
}

Expand Down

0 comments on commit c03aa18

Please sign in to comment.