2 * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef SUMMARY_PROFILE_RESULT_H
6 #define SUMMARY_PROFILE_RESULT_H
9 #include <util/OpenHashTable.h>
11 #include "ProfileResult.h"
16 SummaryImage(ImageProfileResult
* result
);
19 ImageProfileResult
* Result() const { return fResult
; }
20 SharedImage
* GetImage() const { return fResult
->GetImage(); }
22 SummaryImage
*& HashNext() { return fHashNext
; }
25 ImageProfileResult
* fResult
;
26 SummaryImage
* fHashNext
;
30 struct SummaryImageHashDefinition
{
31 typedef SharedImage
* KeyType
;
32 typedef SummaryImage ValueType
;
34 size_t HashKey(SharedImage
* key
) const
36 return (addr_t
)key
/ (2 * sizeof(void*));
39 size_t Hash(SummaryImage
* value
) const
41 return HashKey(value
->GetImage());
44 bool Compare(SharedImage
* key
, SummaryImage
* value
) const
46 return value
->GetImage() == key
;
49 SummaryImage
*& GetLink(SummaryImage
* value
) const
51 return value
->HashNext();
56 class SummaryProfileResult
: public ProfileResult
,
57 private ImageProfileResultContainer
{
59 SummaryProfileResult(ProfileResult
* result
);
60 virtual ~SummaryProfileResult();
62 virtual status_t
Init(ProfiledEntity
* entity
);
64 virtual void SetInterval(bigtime_t interval
);
66 virtual void AddSamples(
67 ImageProfileResultContainer
* container
,
68 addr_t
* samples
, int32 sampleCount
);
69 virtual void AddDroppedTicks(int32 dropped
);
70 virtual void PrintResults(
71 ImageProfileResultContainer
* container
);
73 virtual status_t
GetImageProfileResult(SharedImage
* image
,
75 ImageProfileResult
*& _imageResult
);
77 void PrintSummaryResults();
80 typedef BOpenHashTable
<SummaryImageHashDefinition
> ImageTable
;
83 // ImageProfileResultContainer
84 virtual int32
CountImages() const;
85 virtual ImageProfileResult
* VisitImages(Visitor
& visitor
) const;
86 virtual ImageProfileResult
* FindImage(addr_t address
,
87 addr_t
& _loadDelta
) const;
90 ProfileResult
* fResult
;
92 image_id fNextImageID
;
96 #endif // SUMMARY_PROFILE_RESULT_H