email/email/smtp/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 
       
    40 /**
       
    41   Function 		: CT_StopRamUsageTimer
       
    42   Description 	: Constructor
       
    43   @return 		: none
       
    44 */
       
    45 CT_StopRamUsageTimer::CT_StopRamUsageTimer(CT_MsgSharedDataSmtp& aSharedDataSMTP)
       
    46 :CT_MsgAsyncStepSMTP(aSharedDataSMTP)
       
    47 	{
       
    48 	SetTestStepName(KStopRamUsageTimer);
       
    49 	}
       
    50 	
       
    51 /**
       
    52   Function 		: ~CT_StopRamUsageTimer
       
    53   Description 	: Destructor
       
    54   @return 		: N/A
       
    55 */
       
    56 CT_StopRamUsageTimer::~CT_StopRamUsageTimer()
       
    57 	{}
       
    58 	
       
    59 
       
    60 /**
       
    61   Function 		: doTestStepL
       
    62   Description 	: Stop the periodic Timer
       
    63   @return 		: TVerdict Test result
       
    64 */
       
    65 TVerdict CT_StopRamUsageTimer::doTestStepL()
       
    66 	{
       
    67 	INFO_PRINTF1(_L("TestStep :StopRamUsageTimer"));
       
    68 	TPtrC startCodeFromIni;
       
    69 	if(!GetStringFromConfig(ConfigSection(), KEventStartCode, startCodeFromIni))
       
    70 		{
       
    71 		ERR_PRINTF1(_L("Event Start code is not specified"));
       
    72 		SetTestStepResult(EFail);
       
    73 		}
       
    74 	else
       
    75 		{
       
    76 		TInstrumentationPoint starteventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(startCodeFromIni);
       
    77 		
       
    78 		TPtrC stopCodeFromIni;
       
    79 		if(!GetStringFromConfig(ConfigSection(), KEventStopCode, stopCodeFromIni))
       
    80 			{
       
    81 			ERR_PRINTF1(_L("Event Stop code is not specified"));
       
    82 			SetTestStepResult(EFail);
       
    83 			}
       
    84 		else
       
    85 			{
       
    86 			TInstrumentationPoint stopeventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(stopCodeFromIni);
       
    87 			iSharedDataSMTP.iPeriodic->Cancel();
       
    88 			
       
    89 			INFO_PRINTF2(_L("Minimum Ram usage value is %d KB "), iSharedDataSMTP.iMinRamValue);
       
    90 			INFO_PRINTF2(_L("Maximum Ram usage value is %d KB "), iSharedDataSMTP.iMaxRamValue);
       
    91 			INFO_PRINTF2(_L("Start Ram usage value is %d KB "), iSharedDataSMTP.iStartRamValue);
       
    92 			INFO_PRINTF2(_L("End Ram usage value is %d KB "), iSharedDataSMTP.iEndRamValue);
       
    93 
       
    94 			TInt maxRamUsage = ( iSharedDataSMTP.iMaxRamValue - iSharedDataSMTP.iStartRamValue );
       
    95 			TInt extremeRamUsage = ( iSharedDataSMTP.iMaxRamValue - iSharedDataSMTP.iMinRamValue );
       
    96 			TInt actualRamUsage = ( iSharedDataSMTP.iEndRamValue - iSharedDataSMTP.iStartRamValue );
       
    97 			
       
    98 			INFO_PRINTF2(_L("Maximum(Mx-St) Ram usage diff value is %d KB "), maxRamUsage );
       
    99 			INFO_PRINTF2(_L("Extreme(Mx-Mn) Ram usage diff value is %d KB "), extremeRamUsage );
       
   100 			INFO_PRINTF2(_L("Actual(En-St) Ram usage diff value is %d KB "), actualRamUsage );
       
   101 			if( starteventcode || stopeventcode )
       
   102 				{
       
   103 				INFO_PRINTF5(_L("EVENT_LOG_INFORMATION,%d,%d,%d,%d"),0,0,starteventcode,iSharedDataSMTP.iStartRamValue);
       
   104 				INFO_PRINTF5(_L("EVENT_LOG_INFORMATION,%d,%d,%d,%d"),0,0,stopeventcode,iSharedDataSMTP.iMaxRamValue);
       
   105 				}
       
   106 			else
       
   107 				{
       
   108 				ERR_PRINTF1(_L("**ERROR**: Bad Event code. Check t_testinstrumentation.h for valid event code"));					
       
   109 				}	
       
   110 			}		
       
   111 		}
       
   112 	return TestStepResult();
       
   113 	}
       
   114 
       
   115 /**
       
   116   Function 		: ProgressL
       
   117   Description 	: Displays the progress information of the asynchronous operation
       
   118   @return 		: void
       
   119 */
       
   120 void CT_StopRamUsageTimer::ProgressL(TBool /*aFinal*/)
       
   121 	{}
       
   122 
       
   123 /**
       
   124   Function 		: CancelStep
       
   125   Description 	: Cancels the asynchronous operation
       
   126   @return 		: void
       
   127 */
       
   128 void CT_StopRamUsageTimer::CancelStep()
       
   129 	{}