email/email/pop/src/T_StopRamUsageTimer.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file 
       
    15 // [TestStep Name]
       
    16 // StopRamUsageTimer
       
    17 // [Paramaters]
       
    18 // EventStartCode			<input>	: Start event code which maps to the RAM usage value
       
    19 // when tacking of RAM usage got started.
       
    20 // EventStopCode			<input> : Stop event code which maps to the RAM usage value
       
    21 // when tacking of RAM usage got stopped.
       
    22 // Stops periodical measurement of RAM memory used and logs the RAM usage information
       
    23 // [APIs Used]
       
    24 // 
       
    25 //
       
    26 
       
    27 
       
    28 
       
    29 // User includes
       
    30 #include "T_StopRamUsageTimer.h"
       
    31 #include <t_utilsenumconverter.h>
       
    32 #include <t_testinstrumentation.h>
       
    33 
       
    34 
       
    35 // Literals used
       
    36 _LIT(KEventStartCode, "EventStartCode");
       
    37 _LIT(KEventStopCode, "EventStopCode");
       
    38 /**
       
    39   Function 		: CT_StopRamUsageTimer
       
    40   Description 	: Constructor
       
    41   @return 		: none
       
    42 */
       
    43 CT_StopRamUsageTimer::CT_StopRamUsageTimer(CT_MsgSharedDataPop& aSharedDataPOP)
       
    44 :CT_MsgAsyncStepPOP(aSharedDataPOP)
       
    45 	{
       
    46 	SetTestStepName(KStopRamUsageTimer);
       
    47 	}
       
    48 	
       
    49 /**
       
    50   Function 		: ~CT_StopRamUsageTimer
       
    51   Description 	: Destructor
       
    52   @return 		: N/A
       
    53 */
       
    54 CT_StopRamUsageTimer::~CT_StopRamUsageTimer()
       
    55 	{}
       
    56 	
       
    57 
       
    58 /**
       
    59   Function 		: doTestStepL
       
    60   Description 	: Stop the periodic Timer
       
    61   @return 		: TVerdict Test result
       
    62 */
       
    63 TVerdict CT_StopRamUsageTimer::doTestStepL()
       
    64 	{
       
    65 	INFO_PRINTF1(_L("TestStep :StopRamUsageTimer"));
       
    66 	TPtrC startCodeFromIni;
       
    67 	if(!GetStringFromConfig(ConfigSection(), KEventStartCode, startCodeFromIni))
       
    68 		{
       
    69 		ERR_PRINTF1(_L("Event Start code is not specified"));
       
    70 		SetTestStepResult(EFail);
       
    71 		}
       
    72 	else
       
    73 		{
       
    74 		TInstrumentationPoint starteventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(startCodeFromIni);
       
    75 		
       
    76 		TPtrC stopCodeFromIni;
       
    77 		if(!GetStringFromConfig(ConfigSection(), KEventStopCode, stopCodeFromIni))
       
    78 			{
       
    79 			ERR_PRINTF1(_L("Event Stop code is not specified"));
       
    80 			SetTestStepResult(EFail);
       
    81 			}
       
    82 		else
       
    83 			{
       
    84 			TInstrumentationPoint stopeventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(stopCodeFromIni);
       
    85 			iSharedDataPOP.iPeriodic->Cancel();
       
    86 
       
    87 			INFO_PRINTF2(_L("Minimum Ram usage value is %d KB "), iSharedDataPOP.iMinRamValue);
       
    88 			INFO_PRINTF2(_L("Maximum Ram usage value is %d KB "), iSharedDataPOP.iMaxRamValue);
       
    89 			INFO_PRINTF2(_L("Start Ram usage value is %d KB "), iSharedDataPOP.iStartRamValue);
       
    90 			INFO_PRINTF2(_L("End Ram usage value is %d KB "), iSharedDataPOP.iEndRamValue);
       
    91 
       
    92 			TInt maxRamUsage = ( iSharedDataPOP.iMaxRamValue - iSharedDataPOP.iStartRamValue );
       
    93 			TInt extremeRamUsage = ( iSharedDataPOP.iMaxRamValue - iSharedDataPOP.iMinRamValue );
       
    94 			TInt actualRamUsage = ( iSharedDataPOP.iEndRamValue - iSharedDataPOP.iStartRamValue );
       
    95 			
       
    96 			INFO_PRINTF2(_L("Maximum(Mx-St) Ram usage diff value is %d KB "), maxRamUsage );
       
    97 			INFO_PRINTF2(_L("Extreme(Mx-Mn) Ram usage diff value is %d KB "), extremeRamUsage );
       
    98 			INFO_PRINTF2(_L("Actual(En-St) Ram usage diff value is %d KB "), actualRamUsage );
       
    99 			if( starteventcode || stopeventcode )
       
   100 				{
       
   101 				INFO_PRINTF5(_L("EVENT_LOG_INFORMATION,%d,%d,%d,%d"),0,0,starteventcode,iSharedDataPOP.iStartRamValue);
       
   102 				INFO_PRINTF5(_L("EVENT_LOG_INFORMATION,%d,%d,%d,%d"),0,0,stopeventcode,iSharedDataPOP.iMaxRamValue);
       
   103 				}
       
   104 			else
       
   105 				{
       
   106 				ERR_PRINTF1(_L("**ERROR**: Bad Event code. Check t_testinstrumentation.h for valid event code"));					
       
   107 				}	
       
   108 			}		
       
   109 		}
       
   110 	return TestStepResult();
       
   111 	}
       
   112 
       
   113 /**
       
   114   Function 		: ProgressL
       
   115   Description 	: Displays the progress information of the asynchronous operation
       
   116   @return 		: void
       
   117 */
       
   118 void CT_StopRamUsageTimer::ProgressL(TBool /*aFinal*/)
       
   119 	{}
       
   120 
       
   121 /**
       
   122   Function 		: CancelStep
       
   123   Description 	: Cancels the asynchronous operation
       
   124   @return 		: void
       
   125 */
       
   126 void CT_StopRamUsageTimer::CancelStep()
       
   127 	{}