applayerprotocols/httptransportfw/utils/timerlogger.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2007-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  @internalComponent
       
    19 */
       
    20 #ifndef __TIMERLOGGER_H__
       
    21 #define __TIMERLOGGER_H__
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <flogger.h>
       
    25 #include <f32file.h>
       
    26 
       
    27 // Uncomment the below line to generate performance logger
       
    28 // #define __LOG_PERFORMANCE
       
    29 
       
    30 /** A utility used in HTTP for performing HTTPIOP performance tests in release builds.  Log file is placed in the
       
    31 directory %EPOCROOT%/epoc32/winscw/c/logs/http
       
    32 @internalComponent
       
    33 @released
       
    34 */
       
    35 class TTimerLogger : public TDesOverflow
       
    36 {
       
    37 public: // methods
       
    38     IMPORT_C ~TTimerLogger();
       
    39 	IMPORT_C void StartTimer();
       
    40 	IMPORT_C void EndTimer(const TDesC&);
       
    41 	IMPORT_C void TestName(const TDesC&);	
       
    42    
       
    43 private:
       
    44 	IMPORT_C virtual void Overflow(TDes& aDes);
       
    45 	void LogIt(const TDesC& aComment);
       
    46 
       
    47 private: // attributes
       
    48 
       
    49 	RFs iFs;
       
    50 	RFile iFile;
       
    51 	TTime iStartTime;
       
    52 	TTime iEndTime; 
       
    53 };
       
    54 #if defined __LOG_PERFORMANCE	 
       
    55 // HTTP Logging macros
       
    56 #define __DECLARE_PERFORMANCE_LOG		mutable TTimerLogger iTLogger;
       
    57 #define __START_PERFORMANCE_LOGGER()	  iTLogger.StartTimer()
       
    58 #define __END_PERFORMANCE_LOGGER(C)		  iTLogger.EndTimer(C)
       
    59 #define __TESTNAME(C)		              iTLogger.TestName(C);
       
    60 
       
    61 #else
       
    62 #define __DECLARE_PERFORMANCE_LOG
       
    63 #define __START_PERFORMANCE_LOGGER()	  
       
    64 #define __END_PERFORMANCE_LOGGER(C)		  
       
    65 #define __TESTNAME(C)		              
       
    66 
       
    67 #endif //__LOG_PERFORMANCE
       
    68 #endif // __TIMERLOGGER_H__