* 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:
@@ -56,15 +56,24 @@ BasicThreadImage::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
bool
|
||||||
BasicThreadImage::AddHit(addr_t address)
|
BasicThreadImage::AddHit(addr_t address)
|
||||||
{
|
{
|
||||||
int32 symbolIndex = fImage->FindSymbol(address);
|
int32 symbolIndex = fImage->FindSymbol(address);
|
||||||
if (symbolIndex >= 0)
|
if (symbolIndex < 0)
|
||||||
fSymbolHits[symbolIndex]++;
|
return false;
|
||||||
else
|
|
||||||
fUnknownHits++;
|
|
||||||
|
|
||||||
|
fSymbolHits[symbolIndex]++;
|
||||||
|
fTotalHits++;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BasicThreadImage::AddUnknownHit()
|
||||||
|
{
|
||||||
|
fUnknownHits++;
|
||||||
fTotalHits++;
|
fTotalHits++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,17 +273,27 @@ void
|
|||||||
ExclusiveThreadProfileResult::AddSamples(addr_t* samples, int32 sampleCount)
|
ExclusiveThreadProfileResult::AddSamples(addr_t* samples, int32 sampleCount)
|
||||||
{
|
{
|
||||||
BasicThreadImage* image = NULL;
|
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++) {
|
for (int32 k = 0; k < sampleCount; k++) {
|
||||||
addr_t address = samples[k];
|
addr_t address = samples[k];
|
||||||
image = FindImage(address);
|
image = FindImage(address);
|
||||||
if (image != NULL) {
|
if (image != NULL) {
|
||||||
image->AddHit(address);
|
if (image->AddHit(address))
|
||||||
break;
|
break;
|
||||||
|
if (firstImage == NULL)
|
||||||
|
firstImage = image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image == NULL)
|
if (image == NULL) {
|
||||||
fUnkownTicks++;
|
if (firstImage != NULL)
|
||||||
|
firstImage->AddUnknownHit();
|
||||||
|
else
|
||||||
|
fUnkownTicks++;
|
||||||
|
}
|
||||||
|
|
||||||
fTotalTicks++;
|
fTotalTicks++;
|
||||||
fTotalSampleCount += sampleCount;
|
fTotalSampleCount += sampleCount;
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ public:
|
|||||||
|
|
||||||
virtual status_t Init();
|
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 AddSymbolHit(int32 symbolIndex);
|
||||||
inline void AddImageHit();
|
inline void AddImageHit();
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,12 @@ public:
|
|||||||
int32 creationEvent);
|
int32 creationEvent);
|
||||||
~Image();
|
~Image();
|
||||||
|
|
||||||
|
inline SharedImage* GetSharedImage() const { return fImage; }
|
||||||
|
|
||||||
inline const image_id ID() const;
|
inline const image_id ID() const;
|
||||||
inline const char* Name() const;
|
inline const char* Name() const;
|
||||||
inline team_id Owner() const;
|
inline team_id Owner() const;
|
||||||
|
inline addr_t LoadDelta() const { return fLoadDelta; }
|
||||||
|
|
||||||
inline int32 CreationEvent() const;
|
inline int32 CreationEvent() const;
|
||||||
inline int32 DeletionEvent() const;
|
inline int32 DeletionEvent() const;
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ public:
|
|||||||
:
|
:
|
||||||
fTeams(20, true),
|
fTeams(20, true),
|
||||||
fThreads(20, true),
|
fThreads(20, true),
|
||||||
|
fKernelTeam(NULL),
|
||||||
fDebuggerPort(debuggerPort)
|
fDebuggerPort(debuggerPort)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -154,8 +155,11 @@ public:
|
|||||||
|
|
||||||
void RemoveTeam(team_id teamID)
|
void RemoveTeam(team_id teamID)
|
||||||
{
|
{
|
||||||
if (Team* team = FindTeam(teamID))
|
if (Team* team = FindTeam(teamID)) {
|
||||||
|
if (team == fKernelTeam)
|
||||||
|
fKernelTeam = NULL;
|
||||||
fTeams.RemoveItem(team, true);
|
fTeams.RemoveItem(team, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveThread(thread_id threadID)
|
void RemoveThread(thread_id threadID)
|
||||||
@@ -244,7 +248,7 @@ private:
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
status_t error = addedInfo != NULL
|
status_t error = addedInfo != NULL
|
||||||
? team->Init(addedInfo)
|
? _InitUndebuggedTeam(team, addedInfo)
|
||||||
: _InitDebuggedTeam(team, teamID);
|
: _InitDebuggedTeam(team, teamID);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
delete team;
|
delete team;
|
||||||
@@ -253,6 +257,9 @@ private:
|
|||||||
|
|
||||||
fTeams.AddItem(team);
|
fTeams.AddItem(team);
|
||||||
|
|
||||||
|
if (teamID == B_SYSTEM_TEAM)
|
||||||
|
fKernelTeam = team;
|
||||||
|
|
||||||
if (_team != NULL)
|
if (_team != NULL)
|
||||||
*_team = team;
|
*_team = team;
|
||||||
|
|
||||||
@@ -275,6 +282,28 @@ private:
|
|||||||
return _LoadTeamImages(team, B_SYSTEM_TEAM);
|
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)
|
status_t _LoadTeamImages(Team* team, team_id teamID)
|
||||||
{
|
{
|
||||||
// iterate through the team's images and collect the symbols
|
// iterate through the team's images and collect the symbols
|
||||||
@@ -360,6 +389,7 @@ private:
|
|||||||
BObjectList<Team> fTeams;
|
BObjectList<Team> fTeams;
|
||||||
BObjectList<Thread> fThreads;
|
BObjectList<Thread> fThreads;
|
||||||
ImageMap fImages;
|
ImageMap fImages;
|
||||||
|
Team* fKernelTeam;
|
||||||
port_id fDebuggerPort;
|
port_id fDebuggerPort;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -409,8 +439,6 @@ process_event_buffer(ThreadManager& threadManager, uint8* buffer,
|
|||||||
= (system_profiler_team_added*)buffer;
|
= (system_profiler_team_added*)buffer;
|
||||||
|
|
||||||
threadManager.AddTeam(event);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user