os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComAccumulatedClientRequestPerfTestStep.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Implementation of ECom Test to determine performance of ECom client calls during different stages of start-up.
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @internalComponent
sl@0
    21
*/
sl@0
    22
sl@0
    23
#include "Te_EComAccumulatedClientRequestPerfTestStep.h"
sl@0
    24
#include <startup.hrh>
sl@0
    25
#include <ecom/ecom.h>
sl@0
    26
#include "Interface.h"
sl@0
    27
#include "EComSessionAux.h"
sl@0
    28
#include "EComPerformance.h"
sl@0
    29
sl@0
    30
CEComAccumulatedClientRequestsPerfTest::CEComAccumulatedClientRequestsPerfTest() : CEComPerfTestBase(KEComAccumulatedClientRequestsPerfTest)
sl@0
    31
	{
sl@0
    32
	}
sl@0
    33
sl@0
    34
CEComAccumulatedClientRequestsPerfTest::~CEComAccumulatedClientRequestsPerfTest()
sl@0
    35
	{
sl@0
    36
	}
sl@0
    37
sl@0
    38
/**
sl@0
    39
 This test will retrieve the timing servicing client requests for the start-up states in this list
sl@0
    40
 */
sl@0
    41
const TStartupStateIdentifier CEComAccumulatedClientRequestsPerfTest::iMeasuredStartupStates[] = 
sl@0
    42
	{
sl@0
    43
	EStartupStateCriticalStatic,
sl@0
    44
	EStartupStateCriticalDynamic,
sl@0
    45
	EStartupStateNonCritical
sl@0
    46
	};
sl@0
    47
const TInt CEComAccumulatedClientRequestsPerfTest::iNumMeasuredStartupStates = sizeof(iMeasuredStartupStates)/sizeof(iMeasuredStartupStates[0]);
sl@0
    48
sl@0
    49
/**
sl@0
    50
 Retrieves client request timer results from the ECom server
sl@0
    51
 then prints out timer results organized by startup state, client request type, and then all client requests
sl@0
    52
 */
sl@0
    53
TVerdict CEComAccumulatedClientRequestsPerfTest::doTestStepL()
sl@0
    54
	{
sl@0
    55
#ifdef __ECOM_SERVER_PERFORMANCE__
sl@0
    56
	// get all the timer results from the server
sl@0
    57
	RClientRequestTimerResults clientTimerResults;
sl@0
    58
	CleanupClosePushL(clientTimerResults);
sl@0
    59
	clientTimerResults.RetrieveResultsL();
sl@0
    60
	
sl@0
    61
	
sl@0
    62
	INFO_PRINTF1(_L("ECom client request start-up timing broken down by request type and startup state:\n"));
sl@0
    63
	//
sl@0
    64
	// ECom start-up timing broken down by request type and startup state
sl@0
    65
	// This loop goes through each start-up state in iMeasuredStartupStates, and for each client request type, retrieves the timing results from the clientTimerResults array
sl@0
    66
	//
sl@0
    67
	for (TInt startupStateIndex = 0; startupStateIndex < iNumMeasuredStartupStates; startupStateIndex++)
sl@0
    68
		{
sl@0
    69
		TPtrC startupStateName = StartupStateName(iMeasuredStartupStates[startupStateIndex]);
sl@0
    70
		for (TInt clientRequestTypeInt = 0; clientRequestTypeInt < EEComNumClientRequestTypes; clientRequestTypeInt++)
sl@0
    71
			{
sl@0
    72
			TEComClientRequestType clientRequestType = (TEComClientRequestType)clientRequestTypeInt;
sl@0
    73
			TPtrC clientRequestTypeName = ClientRequestTypeName(clientRequestType);
sl@0
    74
			
sl@0
    75
			TUint numRequestsByTypeAndStartupState = 0;
sl@0
    76
			TReal timeForRequestsByTypeAndStartupState = clientTimerResults.GetAccumulatedClientRequestTime(iMeasuredStartupStates[startupStateIndex], clientRequestType, numRequestsByTypeAndStartupState);
sl@0
    77
			INFO_PRINTF5(_L("Time servicing %S requests, %S State: [%f] msec, number of requests: [%d]"), 
sl@0
    78
				&clientRequestTypeName, &startupStateName,
sl@0
    79
				timeForRequestsByTypeAndStartupState, numRequestsByTypeAndStartupState);
sl@0
    80
			}
sl@0
    81
		}
sl@0
    82
	
sl@0
    83
sl@0
    84
	INFO_PRINTF1(_L("\nECom client request start-up timing broken down by request type:\n"));
sl@0
    85
	//
sl@0
    86
	// ECom start-up timing broken down by request type
sl@0
    87
	// This loop goes through each client request type, retrieves the timing results from the clientTimerResults array
sl@0
    88
	//
sl@0
    89
	for (TInt clientRequestTypeInt = 0; clientRequestTypeInt < EEComNumClientRequestTypes; clientRequestTypeInt++)
sl@0
    90
		{
sl@0
    91
		TEComClientRequestType clientRequestType = (TEComClientRequestType)clientRequestTypeInt;
sl@0
    92
		TPtrC clientRequestTypeName = ClientRequestTypeName(clientRequestType);
sl@0
    93
sl@0
    94
		TUint numRequestsByType = 0;
sl@0
    95
		TReal timeForRequestsByType = clientTimerResults.GetAccumulatedClientRequestTime(clientRequestType, numRequestsByType);
sl@0
    96
		INFO_PRINTF4(_L("Time servicing %S requests: [%f] msec, number of requests: [%d]"), 
sl@0
    97
			&clientRequestTypeName, timeForRequestsByType, numRequestsByType);
sl@0
    98
		}
sl@0
    99
sl@0
   100
sl@0
   101
	INFO_PRINTF1(_L("\nECom client request start-up timing broken down by start-up state:\n"));
sl@0
   102
	//
sl@0
   103
	// ECom start-up timing broken down by start-up state
sl@0
   104
	// This loop goes through start-up state in iMeasuredStartupStates, and retrieves the timing results from the clientTimerResults array
sl@0
   105
	//
sl@0
   106
	for (TInt startupStateIndex = 0; startupStateIndex < iNumMeasuredStartupStates; startupStateIndex++)
sl@0
   107
		{
sl@0
   108
		TPtrC startupStateName = StartupStateName(iMeasuredStartupStates[startupStateIndex]);
sl@0
   109
		TUint numRequestsByStartupState = 0;
sl@0
   110
		TReal timeForRequestsByStartupState = clientTimerResults.GetAccumulatedClientRequestTime(iMeasuredStartupStates[startupStateIndex], numRequestsByStartupState);
sl@0
   111
		INFO_PRINTF4(_L("Time servicing requests in %S State: [%f] msec, number of requests: [%d]"), 
sl@0
   112
			&startupStateName, timeForRequestsByStartupState, numRequestsByStartupState);
sl@0
   113
		}
sl@0
   114
	
sl@0
   115
sl@0
   116
	//
sl@0
   117
	// Total time servicing client requests
sl@0
   118
	// This loop goes retrieves the total time spent servicing client requests
sl@0
   119
	//
sl@0
   120
	TUint totalNumRequests = 0;
sl@0
   121
	TReal totalTimeForRequests = clientTimerResults.GetAccumulatedClientRequestTime(totalNumRequests);
sl@0
   122
	INFO_PRINTF3(_L("Total time servicing all requests: [%f] msec, number of requests: [%d]"), 
sl@0
   123
		totalTimeForRequests, totalNumRequests);
sl@0
   124
		
sl@0
   125
	if (totalNumRequests >= KAccumulatedClientRequestTimerResultMaxCount)
sl@0
   126
		{
sl@0
   127
		INFO_PRINTF2(_L("Number of client requests exceeded %d. Not all client requests may have been recorded\n"), KAccumulatedClientRequestTimerResultMaxCount);
sl@0
   128
		return EFail;
sl@0
   129
		}
sl@0
   130
sl@0
   131
	CleanupStack::PopAndDestroy(&clientTimerResults);
sl@0
   132
sl@0
   133
#else
sl@0
   134
	MacroNotDefinedError();
sl@0
   135
#endif // __ECOM_SERVER_PERFORMANCE__
sl@0
   136
	return TestStepResult();
sl@0
   137
	}