* 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:
@@ -119,41 +119,16 @@ BasicThreadProfileResult::AddDroppedTicks(int32 dropped)
|
|||||||
void
|
void
|
||||||
BasicThreadProfileResult::PrintResults()
|
BasicThreadProfileResult::PrintResults()
|
||||||
{
|
{
|
||||||
// count images and symbols
|
// get hit images
|
||||||
int32 imageCount = 0;
|
BasicThreadImage* images[fOldImages.Size() + fImages.Size()];
|
||||||
|
int32 imageCount = GetHitImages(images);
|
||||||
|
|
||||||
|
// count symbols
|
||||||
int32 symbolCount = 0;
|
int32 symbolCount = 0;
|
||||||
|
for (int32 k = 0; k < imageCount; k++) {
|
||||||
ImageList::Iterator it = fOldImages.GetIterator();
|
BasicThreadImage* image = images[k];
|
||||||
while (BasicThreadImage* image = it.Next()) {
|
if (image->TotalHits() > image->UnknownHits())
|
||||||
if (image->TotalHits() > 0) {
|
symbolCount += image->GetImage()->SymbolCount();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find and sort the hit symbols
|
// find and sort the hit symbols
|
||||||
@@ -261,7 +236,7 @@ InclusiveThreadProfileResult::AddSamples(addr_t* samples, int32 sampleCount)
|
|||||||
symbol = image->GetImage()->FindSymbol(address);
|
symbol = image->GetImage()->FindSymbol(address);
|
||||||
if (symbol < 0) {
|
if (symbol < 0) {
|
||||||
// TODO: Count unknown image hits?
|
// TODO: Count unknown image hits?
|
||||||
} else if (symbol != previousSymbol)
|
} else if (image != previousImage || symbol != previousSymbol)
|
||||||
image->AddSymbolHit(symbol);
|
image->AddSymbolHit(symbol);
|
||||||
|
|
||||||
if (image != previousImage)
|
if (image != previousImage)
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public:
|
|||||||
virtual void SynchronizeImages(int32 event);
|
virtual void SynchronizeImages(int32 event);
|
||||||
|
|
||||||
ThreadImageType* FindImage(addr_t address) const;
|
ThreadImageType* FindImage(addr_t address) const;
|
||||||
|
int32 GetHitImages(ThreadImageType** images) const;
|
||||||
|
|
||||||
virtual void AddSamples(addr_t* samples,
|
virtual void AddSamples(addr_t* samples,
|
||||||
int32 sampleCount) = 0;
|
int32 sampleCount) = 0;
|
||||||
@@ -239,7 +240,7 @@ void
|
|||||||
AbstractThreadProfileResult<ThreadImageType>::SynchronizeImages(int32 event)
|
AbstractThreadProfileResult<ThreadImageType>::SynchronizeImages(int32 event)
|
||||||
{
|
{
|
||||||
// remove obsolete images
|
// remove obsolete images
|
||||||
ImageList::Iterator it = fImages.GetIterator();
|
typename ImageList::Iterator it = fImages.GetIterator();
|
||||||
while (ThreadImageType* image = it.Next()) {
|
while (ThreadImageType* image = it.Next()) {
|
||||||
int32 deleted = image->GetImage()->DeletionEvent();
|
int32 deleted = image->GetImage()->DeletionEvent();
|
||||||
if (deleted >= 0 && event >= deleted) {
|
if (deleted >= 0 && event >= deleted) {
|
||||||
@@ -266,7 +267,7 @@ template<typename ThreadImageType>
|
|||||||
ThreadImageType*
|
ThreadImageType*
|
||||||
AbstractThreadProfileResult<ThreadImageType>::FindImage(addr_t address) const
|
AbstractThreadProfileResult<ThreadImageType>::FindImage(addr_t address) const
|
||||||
{
|
{
|
||||||
ImageList::ConstIterator it = fImages.GetIterator();
|
typename ImageList::ConstIterator it = fImages.GetIterator();
|
||||||
while (ThreadImageType* image = it.Next()) {
|
while (ThreadImageType* image = it.Next()) {
|
||||||
if (image->ContainsAddress(address))
|
if (image->ContainsAddress(address))
|
||||||
return image;
|
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
|
#endif // THREAD_H
|
||||||
|
|||||||
Reference in New Issue
Block a user