memspy/MemSpyClient/src/memspyapiheap.cpp
changeset 26 4fde310f06fe
equal deleted inserted replaced
21:f5d4820de50d 26:4fde310f06fe
       
     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 <memspy/api/memspyapiheap.h>
       
    19 #include <memspy/engine/memspyengine.h>
       
    20 #include <memspy/engine/memspyheapdata.h>
       
    21 
       
    22 
       
    23 CMemSpyApiHeap::CMemSpyApiHeap() 
       
    24 	: iHeapData(0)
       
    25 	{
       
    26 	}
       
    27 
       
    28 EXPORT_C CMemSpyApiHeap::~CMemSpyApiHeap()
       
    29 	{
       
    30 	delete iHeapData;
       
    31 	}
       
    32 
       
    33 void CMemSpyApiHeap::ConstructL(const TMemSpyHeapData& aData)
       
    34 	{
       
    35 	iHeapData = new (ELeave) TMemSpyHeapData(aData);
       
    36 	}
       
    37 
       
    38 CMemSpyApiHeap* CMemSpyApiHeap::NewL(const TMemSpyHeapData& aData)
       
    39 	{
       
    40 	CMemSpyApiHeap* self = CMemSpyApiHeap::NewLC(aData);
       
    41 	CleanupStack::Pop(self);
       
    42 	return (self);
       
    43 	}
       
    44 
       
    45 CMemSpyApiHeap* CMemSpyApiHeap::NewLC(const TMemSpyHeapData& aData)
       
    46 	{
       
    47 	CMemSpyApiHeap* self = new (ELeave) CMemSpyApiHeap;
       
    48 	CleanupStack::PushL(self);
       
    49 	self->ConstructL(aData);
       
    50 	return (self);
       
    51 	}
       
    52 
       
    53 //api methods
       
    54 EXPORT_C TDesC& CMemSpyApiHeap::Type()
       
    55 	{
       
    56 	return iHeapData->iType;
       
    57 	}
       
    58 
       
    59 EXPORT_C TInt CMemSpyApiHeap::Size()
       
    60 	{
       
    61 	return iHeapData->iSize;
       
    62 	}
       
    63 
       
    64 EXPORT_C TInt CMemSpyApiHeap::BaseAddress()
       
    65 	{
       
    66 	return iHeapData->iBaseAddress;
       
    67 	}
       
    68 
       
    69 EXPORT_C TBool CMemSpyApiHeap::Shared()
       
    70 	{
       
    71 	return iHeapData->iShared;
       
    72 	}
       
    73 
       
    74 EXPORT_C TInt CMemSpyApiHeap::ChunkSize()
       
    75 	{
       
    76 	return iHeapData->iChunkSize;
       
    77 	}
       
    78 
       
    79 EXPORT_C TInt CMemSpyApiHeap::AllocationsCount()
       
    80 	{
       
    81 	return iHeapData->iAllocationsCount;
       
    82 	}
       
    83 
       
    84 EXPORT_C TInt CMemSpyApiHeap::FreeCount()
       
    85 	{
       
    86 	return iHeapData->iFreeCount;
       
    87 	}
       
    88 
       
    89 EXPORT_C TInt CMemSpyApiHeap::BiggestAllocation()
       
    90 	{
       
    91 	return iHeapData->iBiggestAllocation;
       
    92 	}
       
    93 
       
    94 EXPORT_C TInt CMemSpyApiHeap::BiggestFree()
       
    95 	{
       
    96 	return iHeapData->iBiggestFree;
       
    97 	}
       
    98 
       
    99 EXPORT_C TInt CMemSpyApiHeap::TotalAllocations()
       
   100 	{
       
   101 	return iHeapData->iTotalAllocations;
       
   102 	}
       
   103 
       
   104 EXPORT_C TInt CMemSpyApiHeap::TotalFree()
       
   105 	{
       
   106 	return iHeapData->iTotalFree;
       
   107 	}
       
   108 
       
   109 EXPORT_C TInt CMemSpyApiHeap::SlackFreeSpace()
       
   110 	{
       
   111 	return iHeapData->iSlackFreeSpace;
       
   112 	}
       
   113 
       
   114 EXPORT_C TInt CMemSpyApiHeap::Fragmentation()
       
   115 	{
       
   116 	return iHeapData->iFragmentation;
       
   117 	}
       
   118 
       
   119 EXPORT_C TInt CMemSpyApiHeap::HeaderSizeA()
       
   120 	{
       
   121 	return iHeapData->iHeaderSizeA;
       
   122 	}
       
   123 
       
   124 EXPORT_C TInt CMemSpyApiHeap::HeaderSizeF()
       
   125 	{
       
   126 	return iHeapData->iHeaderSizeF;
       
   127 	}
       
   128 
       
   129 EXPORT_C TInt CMemSpyApiHeap::AllocationOverhead()
       
   130 	{
       
   131 	return iHeapData->iAllocationOverhead;
       
   132 	}
       
   133 
       
   134 EXPORT_C TInt CMemSpyApiHeap::FreeOverhead()
       
   135 	{
       
   136 	return iHeapData->iFreeOverhead;
       
   137 	}
       
   138 
       
   139 EXPORT_C TInt CMemSpyApiHeap::TotalOverhead()
       
   140 	{
       
   141 	return iHeapData->iTotalOverhead;
       
   142 	}
       
   143 
       
   144 EXPORT_C TInt CMemSpyApiHeap::Overhead()
       
   145 	{
       
   146 	return iHeapData->iOverhead;
       
   147 	}
       
   148 
       
   149 EXPORT_C TInt CMemSpyApiHeap::MinLength()
       
   150 	{
       
   151 	return iHeapData->iMinLength;
       
   152 	}
       
   153 
       
   154 EXPORT_C TInt CMemSpyApiHeap::MaxLength()
       
   155 	{
       
   156 	return iHeapData->iMaxLength;
       
   157 	}
       
   158 
       
   159 EXPORT_C TBool CMemSpyApiHeap::DebugAllocatorLibrary()
       
   160 	{
       
   161 	return iHeapData->iDebugAllocatorLibrary;
       
   162 	}