2 * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
11 #include <util/DoublyLinkedList.h>
13 #include "ProfiledEntity.h"
14 #include "ProfileResult.h"
21 class ThreadImage
: public DoublyLinkedListLinkImpl
<ThreadImage
> {
23 ThreadImage(Image
* image
,
24 ImageProfileResult
* result
);
27 Image
* GetImage() const { return fImage
; }
28 ImageProfileResult
* Result() const { return fResult
; }
32 ImageProfileResult
* fResult
;
36 class Thread
: public ProfiledEntity
, public DoublyLinkedListLinkImpl
<Thread
>,
37 private ImageProfileResultContainer
{
39 Thread(thread_id threadID
, const char* name
,
43 inline thread_id
ID() const;
44 inline const char* Name() const;
45 inline addr_t
* Samples() const;
46 inline Team
* GetTeam() const;
48 virtual int32
EntityID() const;
49 virtual const char* EntityName() const;
50 virtual const char* EntityType() const;
52 inline ProfileResult
* GetProfileResult() const;
53 void SetProfileResult(ProfileResult
* result
);
55 void UpdateInfo(const char* name
);
57 void SetSampleArea(area_id area
, addr_t
* samples
);
58 void SetInterval(bigtime_t interval
);
60 void SetLazyImages(bool lazy
);
62 status_t
AddImage(Image
* image
);
63 void RemoveImage(Image
* image
);
65 void AddSamples(int32 count
, int32 dropped
,
66 int32 stackDepth
, bool variableStackDepth
,
68 void AddSamples(addr_t
* samples
, int32 sampleCount
);
72 typedef DoublyLinkedList
<ThreadImage
> ImageList
;
75 // ImageProfileResultContainer
76 virtual int32
CountImages() const;
77 virtual ImageProfileResult
* VisitImages(Visitor
& visitor
) const;
78 virtual ImageProfileResult
* FindImage(addr_t address
,
79 addr_t
& _loadDelta
) const;
82 void _SynchronizeImages(int32 event
);
90 ProfileResult
* fProfileResult
;
108 return fName
.String();
113 Thread::Samples() const
120 Thread::GetTeam() const
127 Thread::GetProfileResult() const
129 return fProfileResult
;