perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.cpp
changeset 48 516af714ebb4
equal deleted inserted replaced
45:185201be11b0 48:516af714ebb4
       
     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 #include "MemSpyEngineHelperSysMemTrackerEntries.h"
       
    19 
       
    20 // System includes
       
    21 #include <e32base.h>
       
    22 #include <badesca.h>
       
    23 
       
    24 // Driver includes
       
    25 #include <memspy/driver/memspydriverclient.h>
       
    26 
       
    27 // User includes
       
    28 #include <memspy/engine/memspyengine.h>
       
    29 #include <memspy/engine/memspyengineutils.h>
       
    30 #include <memspy/engine/memspyenginehelperheap.h>
       
    31 #include <memspy/engine/memspyenginehelperchunk.h>
       
    32 #include <memspy/engine/memspyengineobjectthread.h>
       
    33 #include <memspy/engine/memspyengineobjectprocess.h>
       
    34 #include <memspy/engine/memspyengineobjectcontainer.h>
       
    35 #include <memspy/engine/memspyenginehelpercodesegment.h>
       
    36 #include "MemSpyEngineHelperSysMemTrackerImp.h"
       
    37 #include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
       
    38 #include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
       
    39 
       
    40 
       
    41 
       
    42 
       
    43 CMemSpyEngineHelperSysMemTrackerEntry::CMemSpyEngineHelperSysMemTrackerEntry( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType )
       
    44 :   iTracker( aTracker ), iType( aType )
       
    45     {
       
    46     // Entry starts out alive - this also updates it's timestamp
       
    47     SetAlive();
       
    48 
       
    49     // Entry starts out new by default
       
    50     SetNew( ETrue );
       
    51     }
       
    52 
       
    53 
       
    54 TUint64 CMemSpyEngineHelperSysMemTrackerEntry::Key() const
       
    55     {
       
    56     const TUint32 val = ( Type() << 28 ); 
       
    57     TUint64 ret = val;
       
    58     ret <<= 32;
       
    59     ret += Handle();
       
    60     return ret;
       
    61     }
       
    62 
       
    63 
       
    64 void CMemSpyEngineHelperSysMemTrackerEntry::HandleNewCycleL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
       
    65     {
       
    66     __ASSERT_ALWAYS( !( IsNew() && IsDead() ), User::Panic(_L("MemSpySysMemT"), __LINE__ ) );
       
    67 
       
    68     // First of all, if the item is not dead, then we can update the cycle stats
       
    69     if  ( IsAlive() )
       
    70         {
       
    71         UpdateCycleStatistics( aCycle );
       
    72         }
       
    73 
       
    74     // We create change descriptors only if the item has changed state in some way.
       
    75     // I.e.:
       
    76     //
       
    77     // 1) If the entry is new or is dead, then we will require a change descriptor.
       
    78     // 2) If the entry has changed, we'll require a change descriptor.
       
    79     //
       
    80     // Case (1)
       
    81     if  ( IsNew() || IsDead() )
       
    82         {
       
    83         CreateChangeDescriptorL( aCycle );
       
    84         }
       
    85     else
       
    86         {
       
    87         // Case (2) 
       
    88         const TBool hasChanged = HasChangedL( aCycle.Config() );
       
    89         if  ( hasChanged )
       
    90             {
       
    91             CreateChangeDescriptorL( aCycle );
       
    92             }
       
    93         }
       
    94     }
       
    95 
       
    96 
       
    97 CMemSpyEngine& CMemSpyEngineHelperSysMemTrackerEntry::Engine()
       
    98     {
       
    99     return iTracker.Engine();
       
   100     }
       
   101 
       
   102 
       
   103 void CMemSpyEngineHelperSysMemTrackerEntry::UpdateTime()
       
   104     {
       
   105     iLastUpdateTime.HomeTime();
       
   106     }
       
   107 
       
   108 
       
   109 void CMemSpyEngineHelperSysMemTrackerEntry::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& /*aEntry*/ )
       
   110     {
       
   111     }
       
   112 
       
   113 
       
   114 TBool CMemSpyEngineHelperSysMemTrackerEntry::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
       
   115     {
       
   116     // This item does not internally change state once created
       
   117     return EFalse;
       
   118     }
       
   119 
       
   120 
       
   121 void CMemSpyEngineHelperSysMemTrackerEntry::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
       
   122     {
       
   123     }
       
   124 
       
   125 
       
   126 void CMemSpyEngineHelperSysMemTrackerEntry::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
       
   127     {
       
   128     }
       
   129 
       
   130 
       
   131 
       
   132 
       
   133 
       
   134 
       
   135