* In exclusive mode we no longer stop searching when we have found an image
for a stack trace, if we haven't actually hit a symbol in the image. This way we don't get "unknown" image hits for PLT slots anymore. * In system profiling mode add the kernel images to new teams. The mode should be usable now. Well, except maybe for the amount of data one gets. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30172 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
962bcf7da1
commit
1836e90993
|
@ -56,15 +56,24 @@ BasicThreadImage::Init()
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
bool
|
||||
BasicThreadImage::AddHit(addr_t address)
|
||||
{
|
||||
int32 symbolIndex = fImage->FindSymbol(address);
|
||||
if (symbolIndex >= 0)
|
||||
fSymbolHits[symbolIndex]++;
|
||||
else
|
||||
fUnknownHits++;
|
||||
if (symbolIndex < 0)
|
||||
return false;
|
||||
|
||||
fSymbolHits[symbolIndex]++;
|
||||
fTotalHits++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BasicThreadImage::AddUnknownHit()
|
||||
{
|
||||
fUnknownHits++;
|
||||
fTotalHits++;
|
||||
}
|
||||
|
||||
|
@ -264,17 +273,27 @@ void
|
|||
ExclusiveThreadProfileResult::AddSamples(addr_t* samples, int32 sampleCount)
|
||||
{
|
||||
BasicThreadImage* image = NULL;
|
||||
// the image in which we hit a symbol
|
||||
BasicThreadImage* firstImage = NULL;
|
||||
// the first image we hit, != image if no symbol was hit
|
||||
|
||||
for (int32 k = 0; k < sampleCount; k++) {
|
||||
addr_t address = samples[k];
|
||||
image = FindImage(address);
|
||||
if (image != NULL) {
|
||||
image->AddHit(address);
|
||||
break;
|
||||
if (image->AddHit(address))
|
||||
break;
|
||||
if (firstImage == NULL)
|
||||
firstImage = image;
|
||||
}
|
||||
}
|
||||
|
||||
if (image == NULL)
|
||||
fUnkownTicks++;
|
||||
if (image == NULL) {
|
||||
if (firstImage != NULL)
|
||||
firstImage->AddUnknownHit();
|
||||
else
|
||||
fUnkownTicks++;
|
||||
}
|
||||
|
||||
fTotalTicks++;
|
||||
fTotalSampleCount += sampleCount;
|
||||
|
|
|
@ -16,7 +16,8 @@ public:
|
|||
|
||||
virtual status_t Init();
|
||||
|
||||
inline void AddHit(addr_t address);
|
||||
inline bool AddHit(addr_t address);
|
||||
inline void AddUnknownHit();
|
||||
inline void AddSymbolHit(int32 symbolIndex);
|
||||
inline void AddImageHit();
|
||||
|
||||
|
|
|
@ -15,9 +15,12 @@ public:
|
|||
int32 creationEvent);
|
||||
~Image();
|
||||
|
||||
inline SharedImage* GetSharedImage() const { return fImage; }
|
||||
|
||||
inline const image_id ID() const;
|
||||
inline const char* Name() const;
|
||||
inline team_id Owner() const;
|
||||
inline addr_t LoadDelta() const { return fLoadDelta; }
|
||||
|
||||
inline int32 CreationEvent() const;
|
||||
inline int32 DeletionEvent() const;
|
||||
|
|
|
@ -97,6 +97,7 @@ public:
|
|||
:
|
||||
fTeams(20, true),
|
||||
fThreads(20, true),
|
||||
fKernelTeam(NULL),
|
||||
fDebuggerPort(debuggerPort)
|
||||
{
|
||||
}
|
||||
|
@ -154,8 +155,11 @@ public:
|
|||
|
||||
void RemoveTeam(team_id teamID)
|
||||
{
|
||||
if (Team* team = FindTeam(teamID))
|
||||
if (Team* team = FindTeam(teamID)) {
|
||||
if (team == fKernelTeam)
|
||||
fKernelTeam = NULL;
|
||||
fTeams.RemoveItem(team, true);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveThread(thread_id threadID)
|
||||
|
@ -244,7 +248,7 @@ private:
|
|||
return B_NO_MEMORY;
|
||||
|
||||
status_t error = addedInfo != NULL
|
||||
? team->Init(addedInfo)
|
||||
? _InitUndebuggedTeam(team, addedInfo)
|
||||
: _InitDebuggedTeam(team, teamID);
|
||||
if (error != B_OK) {
|
||||
delete team;
|
||||
|
@ -253,6 +257,9 @@ private:
|
|||
|
||||
fTeams.AddItem(team);
|
||||
|
||||
if (teamID == B_SYSTEM_TEAM)
|
||||
fKernelTeam = team;
|
||||
|
||||
if (_team != NULL)
|
||||
*_team = team;
|
||||
|
||||
|
@ -275,6 +282,28 @@ private:
|
|||
return _LoadTeamImages(team, B_SYSTEM_TEAM);
|
||||
}
|
||||
|
||||
status_t _InitUndebuggedTeam(Team* team,
|
||||
system_profiler_team_added* addedInfo)
|
||||
{
|
||||
// init the team
|
||||
status_t error = team->Init(addedInfo);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// in case of a user team, add the kernel images
|
||||
if (team->ID() == B_SYSTEM_TEAM || fKernelTeam == NULL)
|
||||
return B_OK;
|
||||
|
||||
const BObjectList<Image>& kernelImages = fKernelTeam->Images();
|
||||
int32 count = kernelImages.CountItems();
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
SharedImage* sharedImage = kernelImages.ItemAt(i)->GetSharedImage();
|
||||
team->AddImage(sharedImage, sharedImage->Info(), B_SYSTEM_TEAM, 0);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t _LoadTeamImages(Team* team, team_id teamID)
|
||||
{
|
||||
// iterate through the team's images and collect the symbols
|
||||
|
@ -360,6 +389,7 @@ private:
|
|||
BObjectList<Team> fTeams;
|
||||
BObjectList<Thread> fThreads;
|
||||
ImageMap fImages;
|
||||
Team* fKernelTeam;
|
||||
port_id fDebuggerPort;
|
||||
};
|
||||
|
||||
|
@ -409,8 +439,6 @@ process_event_buffer(ThreadManager& threadManager, uint8* buffer,
|
|||
= (system_profiler_team_added*)buffer;
|
||||
|
||||
threadManager.AddTeam(event);
|
||||
// TODO: ATM we're not adding kernel images to the team, if this is a team
|
||||
// created after we started profiling!
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue