analyzetool/storageserver/server/inc/atmemoryentry.h
branchRCL_3
changeset 13 da2cedce4920
equal deleted inserted replaced
12:d27dfa8884ad 13:da2cedce4920
       
     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:  Declaration of the class CATMemoryEntry
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ATMEMORYENTRY_H
       
    20 #define ATMEMORYENTRY_H
       
    21 
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 
       
    27 // CLASS DECLARATION
       
    28 
       
    29 /**
       
    30 *  A class for storing memory entries when the server is informed that memory has been
       
    31 *  allocated. The class stores the memory address of a new allocation and a pointer to
       
    32 *  a buffer including the current call stack. It also stores a time stamp, and the size
       
    33 *  of the allocation. 
       
    34 *     The class has member methods for evaluating two different objects of this class
       
    35 *  with each other. In the construction the class takes a pointer to the call stack
       
    36 *  buffer, but it does not create the buffer itself. However, it is responsible for
       
    37 *  deleting the buffer in the destruction.
       
    38 */
       
    39 class CATMemoryEntry : public CBase
       
    40     {
       
    41     public: // Constructor
       
    42 
       
    43         /**
       
    44         * Constructor.
       
    45         * @param aMemAddress An address to allocated memory.
       
    46         * @param aCallstackBuf A pointer to a buffer containing call stack's memory
       
    47         *   addresses.
       
    48         * @param aAllocTime The current time in a 64-bit form.
       
    49         * @param aAllocSize The size of an allocated memory chunk.
       
    50         */ 
       
    51         CATMemoryEntry( TUint32 aMemAddress, const CBufFlat* aCallstackBuf,
       
    52                         const TInt64& aAllocTime, TInt aAllocSize );
       
    53 
       
    54         /**
       
    55         * Destructor
       
    56         */
       
    57         virtual ~CATMemoryEntry();
       
    58 
       
    59     public:
       
    60         /**
       
    61         * Compares two objects of this class based on the allocation time.
       
    62         * @param aFirst The first object of this class to be compared.
       
    63         * @param aSecond The second object of this class to be compared.
       
    64         * @return  Zero, if the two objects are equal. A negative value,
       
    65         *   if the first object is less than the second. A positive value,
       
    66         *   if the first object is greater than the second.
       
    67         */
       
    68         static TInt Compare( const CATMemoryEntry& aFirst,
       
    69                              const CATMemoryEntry& aSecond );
       
    70 
       
    71         /**
       
    72         * Checks if two objects of this class match based on the objects's
       
    73         * saved memory allocation addresses.
       
    74         * @param aFirst The first object of this class to be evaluated.
       
    75         * @param aSecond The second object of this class to be evaluated.
       
    76         * @return ETrue, if the two objects match. EFalse otherwise.
       
    77         */
       
    78         static TBool Match( const CATMemoryEntry& aFirst,
       
    79                             const CATMemoryEntry& aSecond );
       
    80 
       
    81     public:
       
    82 
       
    83         /** For storing an address of a memory allocation. */
       
    84         const TUint32 iMemAddress;
       
    85 
       
    86         /** A pointer to an array for storing the current call stack. */
       
    87         const CBufFlat* const iCallstackBuf;
       
    88         
       
    89         /** For storing the time when an allocation has occured. */
       
    90         const TInt64 iAllocTime;
       
    91         
       
    92         /** For storing the size of an allocation. */
       
    93         const TInt iAllocSize;
       
    94         
       
    95     };
       
    96   
       
    97   
       
    98 #endif      // ATMEMORYENTRY_H