camerauis/cameraapp/generic/inc/CamPerformance.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Macros, event definitions and memory logging class header*
       
    15 */
       
    16 
       
    17 
       
    18 #ifndef CAM_PERFORMANCE_H
       
    19 #define CAM_PERFORMANCE_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h> // RDebug
       
    23 #include <coemain.h> // CCoeStatic
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class TLogItem;
       
    27 class RFileWriteStream;
       
    28 
       
    29 // #define CAMERAAPP_PERFORMANCE_MEASUREMENT
       
    30 
       
    31 /*
       
    32 CAMERAAPP PERFORMANCE MEASUREMENT FRAMEWORK
       
    33 
       
    34 If the flag CAMERAAPP_PERFORMANCE_MEASUREMENT is defined, the following
       
    35 macros can be used for logging:
       
    36 
       
    37 LEVEL 1 (High level):
       
    38 PERF_EVENT_START_L1( EVENT )
       
    39 PERF_EVENT_END_L1( EVENT )
       
    40 PERF_MESSAGE_L1( MESSAGE )
       
    41 PERF_ENGINE_STATE_CHANGE( STATE )
       
    42 PERF_OPERATION_STATE_CHANGE( STATE )
       
    43 
       
    44 LEVEL 2 (Intermediate level):  
       
    45 PERF_EVENT_START_L2( EVENT )
       
    46 PERF_EVENT_END_L2( EVENT )
       
    47 PERF_MESSAGE_L2( MESSAGE )
       
    48 
       
    49 LEVEL 3 (Low level):
       
    50 PERF_EVENT_START_L3( EVENT )
       
    51 PERF_EVENT_END_L3( EVENT )
       
    52 PERF_MESSAGE_L3( MESSAGE )
       
    53 */
       
    54 
       
    55 #ifdef CAMERAAPP_PERFORMANCE_MEASUREMENT
       
    56 // Log levels
       
    57 #define CAMERAAPP_PERF_L1 // High level logging enabled
       
    58 #define CAMERAAPP_PERF_L2 // Intermediate level logging enabled
       
    59 #define CAMERAAPP_PERF_L3 // Low level logging enabled
       
    60 
       
    61 // Different methods of logging in use
       
    62 // Memory log data is written to disk when application is closed
       
    63 #define CAMERAAPP_PERF_LOG_TRACES // Logging to traces enabled
       
    64 #define CAMERAAPP_PERF_LOG_MEMORY // Logging to memory enabled
       
    65 
       
    66 #endif // CAMERAAPP_PERFORMANCE_MEASUREMENT
       
    67 
       
    68 
       
    69 // Log data to traces using event names, instead of numeric event values
       
    70 // For example: e_123_1 -> e_EEventName_1
       
    71 #define CAMERAAPP_PERF_LOG_TRACES_AS_TEXT 
       
    72 
       
    73 // Log filename for memory logs output
       
    74 _LIT( KPerfLogFilename, "C:\\CameraPerf.log" );
       
    75 
       
    76 // Perform analysis of event data after memory logging
       
    77 #define CAMERAAPP_PERF_LOG_ANALYZE_EVENTS
       
    78 _LIT( KPerfAnalysisFileName, "C:\\CameraPerfAnalysis.log" );
       
    79 
       
    80 // Show warnings about invalid start/end events in event analysis log
       
    81 #define CAMERAAPP_PERF_ANALYSIS_WARN_END_WITHOUT_START
       
    82 #define CAMERAAPP_PERF_ANALYSIS_WARN_START_WITHOUT_END
       
    83 #define CAMERAAPP_PERF_ANALYSIS_WARN_MULTIPLE_START
       
    84 
       
    85 // Event definitions
       
    86 enum TCamEvent 
       
    87 	{
       
    88 	EPerfEventAppFirstStartup = 0,
       
    89 	EPerfEventApplicationShutdown,
       
    90 	EPerfEventSwitchToStillMode,
       
    91 	EPerfEventSwitchToVideoMode,
       
    92 	EPerfEventKeyToCapture,
       
    93 	EPerfEventShotToSnapshot,
       
    94 	EPerfEventShotToStillImageReady,
       
    95 	EPerfEventShotToSave,
       
    96 	EPerfEventAutoFocus,
       
    97 	EPerfEventSequenceCapture,
       
    98 	EPerfEventStartVideoRecording,
       
    99 	EPerfEventVideoStopToSave,
       
   100 	EPerfEventBurstCaptureMomentToViewfinderFrame,
       
   101 	EPerfEventAvkonUIConstruction,
       
   102 	EPerfEventCAEConstruction,
       
   103 	EPerfEventCAEInit,
       
   104 	EPerfEventPreCaptureViewConstruction,
       
   105 	EPerfEventActivePaletteConstruction,
       
   106 	EPerfEventPrepareStill,
       
   107 	EPerfEventPostCaptureViewConstruction,
       
   108 	EPerfEventVideoPreCaptureViewActivation,
       
   109 	EPerfEventStillPreCaptureViewDeactivation,
       
   110 	EPerfEventPrepareVideo,
       
   111 	EPerfEventVideoPreCaptureViewDeactivation,
       
   112 	EPerfEventStillPreCaptureViewActivation,
       
   113 	EPerfEventStillPostCaptureViewActivation,
       
   114 	EPerfEventSaveImage,
       
   115 	EPerfEventBurstThumbnailViewActivation,
       
   116 	EPerfEventAppSubsequentStartup,
       
   117 	EPerfEventLastEvent
       
   118 	};
       
   119 
       
   120 // Message definitions
       
   121 enum TCamMessage
       
   122 	{
       
   123 	EPerfMessageTestMessage = 0,
       
   124 	EPerfMessageStartingViewFinder,
       
   125 	EPerfMessageActivePaletteAnimationStarting,
       
   126 	EPerfMessageStoppingViewFinder,
       
   127 	EPerfMessageBurstSnapshotReady,
       
   128 	EPerfMessageBurstStillimageReady,
       
   129 	EPerfMessageStartingRecord,
       
   130 	EPerfMessagePausingViewFinder,
       
   131 	EPerfMessageCaptureKeyHalfPressed,
       
   132 	EPerfMessageLastMessage
       
   133 	};
       
   134 
       
   135 enum TCamPerformanceState
       
   136 	{
       
   137 	EPerfWaitingForStartup = 0,
       
   138 	EPerfIdle,
       
   139 	EPerfWaitingForStillMode,
       
   140 	EPerfWaitingForVideoMode,
       
   141 	EPerfWaitingForBurstFrame
       
   142 	};
       
   143 		
       
   144 // Macros that handle the logging to traces
       
   145 #ifdef CAMERAAPP_PERF_LOG_TRACES_AS_TEXT
       
   146 	// Log enum arguments with their names, for example: e_EEventApplicationStartup_1
       
   147 	#define PERF_EVENT_START_TRACE( EVENT ) RDebug::Print( KPerfEventStartText, &(_L( #EVENT )) );
       
   148 	#define PERF_EVENT_END_TRACE( EVENT ) RDebug::Print( KPerfEventEndText, &(_L( #EVENT )) );
       
   149 	#define PERF_MESSAGE_TRACE( EVENT ) RDebug::Print( KPerfMessageText, &(_L( #EVENT )) );
       
   150 	#define PERF_ENGINE_STATE_CHANGE_TRACE( STATE ) RDebug::Print( KPerfEngineStateChange, STATE );
       
   151 	#define PERF_OPERATION_STATE_CHANGE_TRACE( STATE ) RDebug::Print( KPerfOperationStateChange, STATE );
       
   152 #else
       
   153 	// Log enum arguments as their integer values, for example: e_123_1
       
   154 	#define PERF_EVENT_START_TRACE( EVENT ) RDebug::Print( KPerfEventStart, EVENT );
       
   155 	#define PERF_EVENT_END_TRACE( EVENT ) RDebug::Print( KPerfEventEnd, EVENT );
       
   156 	#define PERF_MESSAGE_TRACE( EVENT ) RDebug::Print( KPerfMessage, EVENT );
       
   157 	#define PERF_ENGINE_STATE_CHANGE_TRACE( STATE ) RDebug::Print( KPerfEngineStateChange, STATE );
       
   158 	#define PERF_OPERATION_STATE_CHANGE_TRACE( STATE ) RDebug::Print( KPerfOperationStateChange, STATE );
       
   159 #endif // CAMERAAPP_PERF_LOG_AS_TEXT
       
   160 
       
   161 // Macros that handle logging to memory
       
   162 #define PERF_EVENT_START_MEMORY( EVENT ) CCamPerformanceLogger::Logger()->EventStart( EVENT );
       
   163 #define PERF_EVENT_END_MEMORY( EVENT ) CCamPerformanceLogger::Logger()->EventEnd( EVENT );
       
   164 #define PERF_MESSAGE_MEMORY( EVENT ) CCamPerformanceLogger::Logger()->Message( EVENT );
       
   165 #define PERF_ENGINE_STATE_CHANGE_MEMORY( STATE ) CCamPerformanceLogger::Logger()->EngineState( STATE );
       
   166 #define PERF_OPERATION_STATE_CHANGE_MEMORY( STATE ) CCamPerformanceLogger::Logger()->OperationState( STATE );
       
   167 
       
   168 // High level (L1) logging macro definitions
       
   169 #ifdef CAMERAAPP_PERF_L1
       
   170 
       
   171 	#if defined (CAMERAAPP_PERF_LOG_TRACES) && defined (CAMERAAPP_PERF_LOG_MEMORY)
       
   172 		// Log to traces and memory
       
   173 		#define PERF_EVENT_START_L1( EVENT ) PERF_EVENT_START_TRACE( EVENT ); PERF_EVENT_START_MEMORY( EVENT ); 																						
       
   174 		#define PERF_EVENT_END_L1( EVENT) PERF_EVENT_END_TRACE( EVENT ); PERF_EVENT_END_MEMORY( EVENT ); 
       
   175 		#define PERF_MESSAGE_L1( EVENT ) PERF_MESSAGE_TRACE( EVENT ); PERF_MESSAGE_MEMORY( EVENT );
       
   176 		#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_TRACE( STATE ); PERF_ENGINE_STATE_CHANGE_MEMORY( STATE );
       
   177 		#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_TRACE( STATE ); PERF_OPERATION_STATE_CHANGE_MEMORY( STATE );
       
   178 		
       
   179 	#elif defined (CAMERAAPP_PERF_LOG_TRACES)
       
   180 		// Log only to traces
       
   181 		#define PERF_EVENT_START_L1( EVENT ) PERF_EVENT_START_TRACE( EVENT );
       
   182 		#define PERF_EVENT_END_L1( EVENT ) PERF_EVENT_END_TRACE( EVENT );
       
   183 		#define PERF_MESSAGE_L1( EVENT) PERF_MESSAGE_TRACE( EVENT );
       
   184 		#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_TRACE( STATE );
       
   185 		#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_TRACE( STATE );
       
   186 		
       
   187 	#elif defined (CAMERAAPP_PERF_LOG_MEMORY)
       
   188 		// Log only to memory
       
   189 		#define PERF_EVENT_START_L1( EVENT ) PERF_EVENT_START_MEMORY( EVENT );
       
   190 		#define PERF_EVENT_END_L1( EVENT ) PERF_EVENT_END_MEMORY( EVENT );
       
   191 		#define PERF_MESSAGE_L1( EVENT) PERF_MESSAGE_MEMORY( EVENT );
       
   192 		#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_MEMORY( STATE );		
       
   193 		#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_MEMORY( STATE );	
       
   194 		
       
   195 	#else
       
   196 		// Logging enabled, but no logging way specified - empty macro implementations
       
   197 		#define PERF_EVENT_START_L1( A ) ;
       
   198 		#define PERF_EVENT_END_L1( A ) ;
       
   199 		#define PERF_MESSAGE_L1( A ) ;
       
   200 		#define PERF_ENGINE_STATE_CHANGE( A ) ;
       
   201 		#define PERF_OPERATION_STATE_CHANGE( A ) ;
       
   202 	#endif
       
   203 
       
   204 #else
       
   205 	// L1 logging not enabled - empty macro implementation
       
   206 	#define PERF_EVENT_START_L1( A ) ;
       
   207 	#define PERF_EVENT_END_L1( A ) ;
       
   208 	#define PERF_MESSAGE_L1( A ) ;
       
   209 	#define PERF_ENGINE_STATE_CHANGE( A ) ;
       
   210 	#define PERF_OPERATION_STATE_CHANGE( A ) ;
       
   211 #endif // CAMERAAPP_PERF_L1
       
   212 
       
   213 // Intermediate level (L2) logging macro definitions
       
   214 #ifdef CAMERAAPP_PERF_L2
       
   215 
       
   216 	#if defined (CAMERAAPP_PERF_LOG_TRACES) && defined (CAMERAAPP_PERF_LOG_MEMORY)
       
   217 		// Log to traces and memory
       
   218 		#define PERF_EVENT_START_L2( EVENT ) PERF_EVENT_START_TRACE( EVENT ); PERF_EVENT_START_MEMORY( EVENT ); 																						
       
   219 		#define PERF_EVENT_END_L2( EVENT) PERF_EVENT_END_TRACE( EVENT ); PERF_EVENT_END_MEMORY( EVENT ); 
       
   220 		#define PERF_MESSAGE_L2( EVENT ) PERF_MESSAGE_TRACE( EVENT ); PERF_MESSAGE_MEMORY( EVENT );
       
   221 		#ifndef PERF_ENGINE_STATE_CHANGE
       
   222 			#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_TRACE( STATE ); PERF_ENGINE_STATE_CHANGE_MEMORY( STATE );
       
   223 			#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_TRACE( STATE ); PERF_OPERATION_STATE_CHANGE_MEMORY( STATE );
       
   224 		#endif
       
   225 		
       
   226 	#elif defined (CAMERAAPP_PERF_LOG_TRACES)
       
   227 		// Log only to traces
       
   228 		#define PERF_EVENT_START_L2( EVENT ) PERF_EVENT_START_TRACE( EVENT );
       
   229 		#define PERF_EVENT_END_L2( EVENT ) PERF_EVENT_END_TRACE( EVENT );
       
   230 		#define PERF_MESSAGE_L2( EVENT) PERF_MESSAGE_TRACE( EVENT );
       
   231 		#ifndef PERF_ENGINE_STATE_CHANGE 
       
   232 			#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_TRACE( STATE );
       
   233 			#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_TRACE( STATE );
       
   234 		#endif
       
   235 		
       
   236 	#elif defined (CAMERAAPP_PERF_LOG_MEMORY)
       
   237 		// Log only to memory
       
   238 		#define PERF_EVENT_START_L2( EVENT ) PERF_EVENT_START_MEMORY( EVENT );
       
   239 		#define PERF_EVENT_END_L2( EVENT ) PERF_EVENT_END_MEMORY( EVENT );
       
   240 		#define PERF_MESSAGE_L2( EVENT) PERF_MESSAGE_MEMORY( EVENT );
       
   241 		#ifndef PERF_ENGINE_STATE_CHANGE
       
   242 			#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_MEMORY( STATE );
       
   243 			#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_MEMORY( STATE );	
       
   244 		#endif
       
   245 		
       
   246 	#else
       
   247 		// Logging enabled, but no logging way specified - empty macro implementations
       
   248 		#define PERF_EVENT_START_L2( A ) ;
       
   249 		#define PERF_EVENT_END_L2( A ) ;
       
   250 		#define PERF_MESSAGE_L2( A ) ;
       
   251 		#ifndef PERF_ENGINE_STATE_CHANGE
       
   252 			#define PERF_ENGINE_STATE_CHANGE( A ) ;
       
   253 			#define PERF_OPERATION_STATE_CHANGE( A ) ;
       
   254 		#endif
       
   255 	#endif
       
   256 
       
   257 #else
       
   258 	// L2 logging not enabled - empty macro implementation
       
   259 	#define PERF_EVENT_START_L2( A ) ;
       
   260 	#define PERF_EVENT_END_L2( A ) ;
       
   261 	#define PERF_MESSAGE_L2( A ) ;
       
   262 		#ifndef PERF_ENGINE_STATE_CHANGE
       
   263 			#define PERF_ENGINE_STATE_CHANGE( A ) ;
       
   264 			#define PERF_OPERATION_STATE_CHANGE( A ) ;
       
   265 		#endif
       
   266 #endif // CAMERAAPP_PERF_L2
       
   267 
       
   268 // Low level (L3) logging macro definitions
       
   269 #ifdef CAMERAAPP_PERF_L3
       
   270 
       
   271 	#if defined (CAMERAAPP_PERF_LOG_TRACES) && defined (CAMERAAPP_PERF_LOG_MEMORY)
       
   272 		// Log to traces and memory
       
   273 		#define PERF_EVENT_START_L3( EVENT ) PERF_EVENT_START_TRACE( EVENT ); PERF_EVENT_START_MEMORY( EVENT ); 																						
       
   274 		#define PERF_EVENT_END_L3( EVENT) PERF_EVENT_END_TRACE( EVENT ); PERF_EVENT_END_MEMORY( EVENT ); 
       
   275 		#define PERF_MESSAGE_L3( EVENT ) PERF_MESSAGE_TRACE( EVENT ); PERF_MESSAGE_MEMORY( EVENT );
       
   276 		#ifndef PERF_ENGINE_STATE_CHANGE
       
   277 			#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_TRACE( STATE ); PERF_ENGINE_STATE_CHANGE_MEMORY( STATE );
       
   278 			#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_TRACE( STATE ); PERF_OPERATION_STATE_CHANGE_MEMORY( STATE );
       
   279 		#endif
       
   280 		
       
   281 	#elif defined (CAMERAAPP_PERF_LOG_TRACES)
       
   282 		// Log only to traces
       
   283 		#define PERF_EVENT_START_L3( EVENT ) PERF_EVENT_START_TRACE( EVENT );
       
   284 		#define PERF_EVENT_END_L3( EVENT ) PERF_EVENT_END_TRACE( EVENT );
       
   285 		#define PERF_MESSAGE_L3( EVENT) PERF_MESSAGE_TRACE( EVENT );
       
   286 		#ifndef PERF_ENGINE_STATE_CHANGE 
       
   287 			#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_TRACE( STATE );
       
   288 			#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_TRACE( STATE );
       
   289 		#endif
       
   290 		
       
   291 	#elif defined (CAMERAAPP_PERF_LOG_MEMORY)
       
   292 		// Log only to memory
       
   293 		#define PERF_EVENT_START_L3( EVENT ) PERF_EVENT_START_MEMORY( EVENT );
       
   294 		#define PERF_EVENT_END_L3( EVENT ) PERF_EVENT_END_MEMORY( EVENT );
       
   295 		#define PERF_MESSAGE_L3( EVENT) PERF_MESSAGE_MEMORY( EVENT );
       
   296 		#ifndef PERF_ENGINE_STATE_CHANGE
       
   297 			#define PERF_ENGINE_STATE_CHANGE( STATE ) PERF_ENGINE_STATE_CHANGE_MEMORY( STATE );
       
   298 			#define PERF_OPERATION_STATE_CHANGE( STATE ) PERF_OPERATION_STATE_CHANGE_MEMORY( STATE );	
       
   299 		#endif
       
   300 		
       
   301 	#else
       
   302 		// Logging enabled, but no logging way specified - empty macro implementations
       
   303 		#define PERF_EVENT_START_L3( A ) ;
       
   304 		#define PERF_EVENT_END_L3( A ) ;
       
   305 		#define PERF_MESSAGE_L3( A ) ;
       
   306 		#ifndef PERF_ENGINE_STATE_CHANGE
       
   307 			#define PERF_ENGINE_STATE_CHANGE( A ) ;
       
   308 			#define PERF_OPERATION_STATE_CHANGE( A ) ;
       
   309 		#endif
       
   310 		
       
   311 	#endif
       
   312 
       
   313 #else
       
   314 	// L3 logging not enabled - empty macro implementation
       
   315 	#define PERF_EVENT_START_L3( A ) ;
       
   316 	#define PERF_EVENT_END_L3( A ) ;
       
   317 	#define PERF_MESSAGE_L3( A ) ;
       
   318 	#ifndef PERF_ENGINE_STATE_CHANGE
       
   319 		#define PERF_ENGINE_STATE_CHANGE( A ) ;
       
   320 		#define PERF_OPERATION_STATE_CHANGE( A ) ;
       
   321 	#endif
       
   322 #endif // CAMERAAPP_PERF_L3
       
   323 
       
   324 #ifdef CAMERAAPP_PERF_LOG_MEMORY
       
   325 
       
   326 /**
       
   327 * Handles memory logging of events, messages and state changes, performing 
       
   328 * simple event analysis and writing the resulting log files to disk.
       
   329 *
       
   330 *  @since 2.8
       
   331 */
       
   332 class CCamPerformanceLogger: public CCoeStatic
       
   333 	{
       
   334 	public:
       
   335 							
       
   336 	  /**
       
   337     * Static function, which returns a pointer to the currently
       
   338     * active CCamPerformanceLogger object or instantiates a new one
       
   339     * @since 2.8
       
   340     * @return pointer to CCamPerformanceLogger object
       
   341     */    
       
   342 		static CCamPerformanceLogger* Logger();		
       
   343 
       
   344 	  /**
       
   345     * Static function, which saves the currently recorded log 
       
   346     * data and clears the log.
       
   347     * @since 2.8
       
   348     */ 		
       
   349 		static void SaveAndReset();		
       
   350 								
       
   351 	  /**
       
   352     * Destructor.
       
   353     * @since 2.8
       
   354     */
       
   355 		~CCamPerformanceLogger();
       
   356 						
       
   357 		/**
       
   358     * Appends an event start item to the memory log
       
   359     * @since 2.8
       
   360     * @param aEvent Event type
       
   361     */
       
   362 		void EventStart( TCamEvent aEvent );
       
   363 		
       
   364 		/**
       
   365     * Appends an event end item to the memory log
       
   366     * @since 2.8
       
   367     * @param aEvent Event type
       
   368     */				
       
   369 		void EventEnd( TCamEvent aEvent );
       
   370 		
       
   371 		/**
       
   372     * Appends a message to the memory log
       
   373     * @since 2.8
       
   374     * @param aMessage Message type
       
   375     */
       
   376 		void Message( TCamMessage aMessage );
       
   377 		
       
   378 		/**
       
   379     * Appends a state change to the memory log
       
   380     * @since 2.8
       
   381     * @param aState New state
       
   382     */		
       
   383 		void EngineState( TInt aState );
       
   384 		
       
   385 		/**
       
   386     * Appends a state change to the memory log
       
   387     * @since 2.8
       
   388     * @param aState New state
       
   389     */		
       
   390 		void OperationState( TInt aState );
       
   391 		
       
   392 		/**
       
   393     * Saves all data from memory log to file KPerfLogFilename
       
   394     * @since 2.8
       
   395     */
       
   396 		void SaveLogDataL() const;
       
   397 		
       
   398 		/**
       
   399     * Performs simple analysis to event data from memory log and writes
       
   400     * the result to file KPerfAnalysisFilename
       
   401     * @since 2.8
       
   402     */
       
   403 		void SaveAnalysisL() const;
       
   404 						
       
   405 	private:
       
   406 		/**
       
   407     * Converts log item data into LogicAnalyzer compatible string, and stores the result in aDes
       
   408     * @param aItem Log item
       
   409     * @param aDes Descriptor
       
   410     * @since 2.8
       
   411     */
       
   412 		static void LogItemToDes( const TLogItem& aItem, TDes& aDes ); 		
       
   413 		
       
   414 		/**
       
   415     * Appends time represented by aTime to aDes with format seconds.milliseconds
       
   416     * @param aDes Destination descriptor
       
   417     * @param aTime Time in system 64-bit format
       
   418     * @param aSpace Reserve 6 characters for seconds field
       
   419     * @since 2.8
       
   420     */
       
   421 		static void AppendTime( TDes& aDes, TInt64 aTime, TBool aSpace=EFalse );
       
   422 		
       
   423 		/**
       
   424     * Writes the contents of descriptor aDes followed by '\n' to aStream
       
   425     * @param aStream RFileWriteStream
       
   426     * @param aDes Descriptor
       
   427     * @since 2.8
       
   428     */
       
   429 		static void WriteLineL( RFileWriteStream& aStream, TDes& aDes );
       
   430 		
       
   431 		/**
       
   432     * Returns system 64-bit representation of the current time
       
   433     * @since 2.8
       
   434     * @return Time
       
   435     */		
       
   436 		static TInt64 Time64();
       
   437 		
       
   438 	private:
       
   439 		CCamPerformanceLogger();
       
   440 		TInt64 iStartTime;
       
   441 		RArray<TLogItem> iLogItems;			
       
   442 	};
       
   443 #endif // CAMERAAPP_PERF_LOG_MEMORY
       
   444 	
       
   445 // Log item formatting literals
       
   446 _LIT( KPerfEventStart, "e_%d_1" );
       
   447 //_LIT( KPerfEventStartText, "e_%S_1" );
       
   448 _LIT( KPerfEventStartText, "e_%S 1" );
       
   449 _LIT( KPerfEventEnd, "e_%d_0" );
       
   450 //_LIT( KPerfEventEndText, "e_%S_0" );
       
   451 _LIT( KPerfEventEndText, "e_%S 0" );
       
   452 _LIT( KPerfMessage, "m_%d" );
       
   453 //_LIT( KPerfMessageText, "m_%S" );
       
   454 _LIT( KPerfMessageText, "m_%S;CamMsg;CamMsg" );
       
   455 //_LIT( KPerfEngineStateChange, "sm_CamEngine_%d" );
       
   456 _LIT( KPerfEngineStateChange, "sm_CamEngine;%d" );
       
   457 _LIT( KPerfEngineStateChangeText, "sm_CamEngine_%S" );
       
   458 //_LIT( KPerfOperationStateChange, "sm_CamOperation_%d" );
       
   459 _LIT( KPerfOperationStateChange, "sm_CamOperation;%d" );
       
   460 _LIT( KPerfOperationStateChangeText, "sm_CamOperation_%S" );
       
   461 _LIT( KPerfUnknown, "unknown_%d" );
       
   462 	
       
   463 #endif // CAM_PERFORMANCE_H