networkprotocolmodules/networkpmutils/supldevlogger/inc/suplmemlogger.h
changeset 48 81c9bee26a45
equal deleted inserted replaced
23:2965a06983dc 48:81c9bee26a45
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology
       
    19  
       
    20 */
       
    21 
       
    22 #ifndef SUPL_MEMORY_USAGE_LOGGER_H
       
    23 #define SUPL_MEMORY_USAGE_LOGGER_H
       
    24 
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <flogger.h>
       
    28 
       
    29 /**
       
    30 */
       
    31 NONSHARABLE_CLASS(CSuplMemoryUsageLogger) : public CBase
       
    32 	{
       
    33 public:
       
    34 	IMPORT_C static CSuplMemoryUsageLogger* NewLC();
       
    35 	~CSuplMemoryUsageLogger();
       
    36 
       
    37 	IMPORT_C void Cancel();
       
    38 	
       
    39 private:
       
    40 	CSuplMemoryUsageLogger();
       
    41 	void ConstructL();
       
    42 	
       
    43 	void WriteToLog();
       
    44 	void WriteMaxHeapToLog();
       
    45 	
       
    46 	static TInt PeriodicCallback(TAny* aSelf);
       
    47 	
       
    48 private:
       
    49 	CPeriodic* iPeriodic;
       
    50 	TInt iInterval;
       
    51 	
       
    52 	RProcess iProcess;
       
    53 	RHeap& iHeap;
       
    54 	TInt iStackSize;
       
    55 	TInt iMaxHeapTotal;
       
    56 	TInt iMaxChunkTotal;
       
    57 	TTime iStartTime;
       
    58 	RFileLogger iLogger;
       
    59 	TFileName iFileName;
       
    60 	};
       
    61 
       
    62 
       
    63 #ifdef ENABLE_SUPL_MEM_LOGGER
       
    64 
       
    65 #define SUPLMEMLOG_BEGIN()	{ CSuplMemoryUsageLogger* memoryUsageLogger = CSuplMemoryUsageLogger::NewLC(); }
       
    66 
       
    67 #define SUPLMEMLOG_END()		{ CleanupStack::PopAndDestroy(1); }
       
    68 
       
    69 #else // ENABLE_SUPL_MEM_LOGGER
       
    70 
       
    71 #define SUPLMEMLOG_BEGIN()
       
    72 
       
    73 #define SUPLMEMLOG_END()
       
    74 
       
    75 #endif // ENABLE_SUPL_MEM_LOGGER
       
    76 
       
    77 #endif	//SUPL_MEMORY_USAGE_LOGGER_H