* Moved counting/getting the hit images into separate utility method
GetHitImages() of base class AbstractThreadProfileResult. * gcc 4 build fixes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27797 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
970abd0254
commit
39be9709cf
@ -119,41 +119,16 @@ BasicThreadProfileResult::AddDroppedTicks(int32 dropped)
|
||||
void
|
||||
BasicThreadProfileResult::PrintResults()
|
||||
{
|
||||
// count images and symbols
|
||||
int32 imageCount = 0;
|
||||
// get hit images
|
||||
BasicThreadImage* images[fOldImages.Size() + fImages.Size()];
|
||||
int32 imageCount = GetHitImages(images);
|
||||
|
||||
// count symbols
|
||||
int32 symbolCount = 0;
|
||||
|
||||
ImageList::Iterator it = fOldImages.GetIterator();
|
||||
while (BasicThreadImage* image = it.Next()) {
|
||||
if (image->TotalHits() > 0) {
|
||||
imageCount++;
|
||||
if (image->TotalHits() > image->UnknownHits())
|
||||
symbolCount += image->GetImage()->SymbolCount();
|
||||
}
|
||||
}
|
||||
|
||||
it = fImages.GetIterator();
|
||||
while (BasicThreadImage* image = it.Next()) {
|
||||
if (image->TotalHits() > 0) {
|
||||
imageCount++;
|
||||
if (image->TotalHits() > image->UnknownHits())
|
||||
symbolCount += image->GetImage()->SymbolCount();
|
||||
}
|
||||
}
|
||||
|
||||
BasicThreadImage* images[imageCount];
|
||||
imageCount = 0;
|
||||
|
||||
it = fOldImages.GetIterator();
|
||||
while (BasicThreadImage* image = it.Next()) {
|
||||
if (image->TotalHits() > 0)
|
||||
images[imageCount++] = image;
|
||||
}
|
||||
|
||||
it = fImages.GetIterator();
|
||||
while (BasicThreadImage* image = it.Next()) {
|
||||
if (image->TotalHits() > 0)
|
||||
images[imageCount++] = image;
|
||||
for (int32 k = 0; k < imageCount; k++) {
|
||||
BasicThreadImage* image = images[k];
|
||||
if (image->TotalHits() > image->UnknownHits())
|
||||
symbolCount += image->GetImage()->SymbolCount();
|
||||
}
|
||||
|
||||
// find and sort the hit symbols
|
||||
@ -261,7 +236,7 @@ InclusiveThreadProfileResult::AddSamples(addr_t* samples, int32 sampleCount)
|
||||
symbol = image->GetImage()->FindSymbol(address);
|
||||
if (symbol < 0) {
|
||||
// TODO: Count unknown image hits?
|
||||
} else if (symbol != previousSymbol)
|
||||
} else if (image != previousImage || symbol != previousSymbol)
|
||||
image->AddSymbolHit(symbol);
|
||||
|
||||
if (image != previousImage)
|
||||
|
@ -105,6 +105,7 @@ public:
|
||||
virtual void SynchronizeImages(int32 event);
|
||||
|
||||
ThreadImageType* FindImage(addr_t address) const;
|
||||
int32 GetHitImages(ThreadImageType** images) const;
|
||||
|
||||
virtual void AddSamples(addr_t* samples,
|
||||
int32 sampleCount) = 0;
|
||||
@ -239,7 +240,7 @@ void
|
||||
AbstractThreadProfileResult<ThreadImageType>::SynchronizeImages(int32 event)
|
||||
{
|
||||
// remove obsolete images
|
||||
ImageList::Iterator it = fImages.GetIterator();
|
||||
typename ImageList::Iterator it = fImages.GetIterator();
|
||||
while (ThreadImageType* image = it.Next()) {
|
||||
int32 deleted = image->GetImage()->DeletionEvent();
|
||||
if (deleted >= 0 && event >= deleted) {
|
||||
@ -266,7 +267,7 @@ template<typename ThreadImageType>
|
||||
ThreadImageType*
|
||||
AbstractThreadProfileResult<ThreadImageType>::FindImage(addr_t address) const
|
||||
{
|
||||
ImageList::ConstIterator it = fImages.GetIterator();
|
||||
typename ImageList::ConstIterator it = fImages.GetIterator();
|
||||
while (ThreadImageType* image = it.Next()) {
|
||||
if (image->ContainsAddress(address))
|
||||
return image;
|
||||
@ -275,4 +276,26 @@ AbstractThreadProfileResult<ThreadImageType>::FindImage(addr_t address) const
|
||||
}
|
||||
|
||||
|
||||
template<typename ThreadImageType>
|
||||
int32
|
||||
AbstractThreadProfileResult<ThreadImageType>::GetHitImages(
|
||||
ThreadImageType** images) const
|
||||
{
|
||||
int32 imageCount = 0;
|
||||
|
||||
typename ImageList::ConstIterator it = fOldImages.GetIterator();
|
||||
while (ThreadImageType* image = it.Next()) {
|
||||
if (image->TotalHits() > 0)
|
||||
images[imageCount++] = image;
|
||||
}
|
||||
|
||||
it = fImages.GetIterator();
|
||||
while (ThreadImageType* image = it.Next()) {
|
||||
if (image->TotalHits() > 0)
|
||||
images[imageCount++] = image;
|
||||
}
|
||||
|
||||
return imageCount;
|
||||
}
|
||||
|
||||
#endif // THREAD_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user