|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MEMSPYENGINEHELPERSYSMEMTRACKERENTRIES_H |
|
19 #define MEMSPYENGINEHELPERSYSMEMTRACKERENTRIES_H |
|
20 |
|
21 // System includes |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 |
|
25 // Driver includes |
|
26 #include <memspy/driver/memspydriverobjectsshared.h> |
|
27 |
|
28 // User includes |
|
29 #include <memspy/engine/memspyenginehelpersysmemtrackerenums.h> |
|
30 |
|
31 // Classes referenced |
|
32 class CMemSpyEngine; |
|
33 class CMemSpyThread; |
|
34 class CMemSpyProcess; |
|
35 class CMemSpyEngineHelperSysMemTrackerImp; |
|
36 class CMemSpyEngineHelperSysMemTrackerCycle; |
|
37 class TMemSpyEngineHelperSysMemTrackerConfig; |
|
38 |
|
39 // Literal constants |
|
40 _LIT( KMemSpySWMTThreadNotFound, "Thread Not Found" ); |
|
41 |
|
42 |
|
43 NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntry ) : public CBase |
|
44 { |
|
45 protected: |
|
46 CMemSpyEngineHelperSysMemTrackerEntry( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType ); |
|
47 |
|
48 public: // API |
|
49 void HandleNewCycleL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); |
|
50 |
|
51 public: // API - framework |
|
52 virtual TUint64 Key() const; |
|
53 virtual void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry ); |
|
54 |
|
55 protected: // API - framework, internal |
|
56 virtual TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const; |
|
57 virtual void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); |
|
58 virtual void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); |
|
59 |
|
60 public: // API - inline |
|
61 inline TMemSpyEngineSysMemTrackerType Type() const { return iType; } |
|
62 inline TUint8 Attributes() const { return iAttributes; } |
|
63 // |
|
64 inline TThreadId ThreadId() const { return iThreadId; } |
|
65 inline void SetThread( TThreadId aThreadId ) { iThreadId = aThreadId; } |
|
66 // |
|
67 inline TProcessId ProcessId() const { return iProcessId; } |
|
68 inline void SetProcess( TProcessId aProcessId ) { iProcessId = aProcessId; } |
|
69 // |
|
70 inline TUint32 Handle() const { return iHandle; } |
|
71 inline void SetHandle( TAny* aHandle ) { iHandle = (TUint32) aHandle; } |
|
72 inline void SetHandle( TUint32 aHandle ) { iHandle = aHandle; } |
|
73 // |
|
74 inline const TTime& LastUpdateTime() const { return iLastUpdateTime; } |
|
75 |
|
76 public: // Attributes |
|
77 inline TBool IsNew() const { return iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsNew; } |
|
78 inline void SetNew( TBool aNew ); |
|
79 // |
|
80 inline TBool IsDead() const { return !IsAlive(); } |
|
81 inline void SetDead() { iAttributes &= ~EMemSpyEngineSysMemTrackerEntryAttributeIsAlive; } |
|
82 // |
|
83 inline TBool IsAlive() const { return iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsAlive; } |
|
84 inline void SetAlive(); |
|
85 |
|
86 protected: // Internal methods |
|
87 CMemSpyEngine& Engine(); |
|
88 void UpdateTime(); |
|
89 |
|
90 private: // Data members |
|
91 CMemSpyEngineHelperSysMemTrackerImp& iTracker; |
|
92 const TMemSpyEngineSysMemTrackerType iType; |
|
93 TUint32 iThreadId; |
|
94 TUint32 iProcessId; |
|
95 TUint8 iAttributes; |
|
96 TUint32 iHandle; |
|
97 TTime iLastUpdateTime; |
|
98 }; |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 // Helper class used when searching for entries |
|
105 NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntryWithSuppliedKey ) : public CMemSpyEngineHelperSysMemTrackerEntry |
|
106 { |
|
107 public: |
|
108 inline CMemSpyEngineHelperSysMemTrackerEntryWithSuppliedKey( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TUint64& aKey ) |
|
109 : CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeCount ), iKey( aKey ) |
|
110 { } |
|
111 |
|
112 public: // From CMemSpyEngineHelperSysMemTrackerEntry |
|
113 TUint64 Key() const { return iKey; } |
|
114 |
|
115 private: // Data members |
|
116 const TUint64 iKey; |
|
117 }; |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 inline void CMemSpyEngineHelperSysMemTrackerEntry::SetNew( TBool aNew ) |
|
124 { |
|
125 if ( aNew ) |
|
126 { |
|
127 iAttributes |= EMemSpyEngineSysMemTrackerEntryAttributeIsNew; |
|
128 } |
|
129 else |
|
130 { |
|
131 iAttributes &= ~EMemSpyEngineSysMemTrackerEntryAttributeIsNew; |
|
132 } |
|
133 } |
|
134 |
|
135 |
|
136 inline void CMemSpyEngineHelperSysMemTrackerEntry::SetAlive() |
|
137 { |
|
138 iAttributes |= EMemSpyEngineSysMemTrackerEntryAttributeIsAlive; |
|
139 UpdateTime(); |
|
140 } |
|
141 |
|
142 |
|
143 #endif |