debugsrv/runmodedebug/tsrc/rm_debug/performance_test/t_rmdebug_performance_test.h
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 // Copyright (c) 2010 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 // Tests performance of run mode debug device component   
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef RMDEBUG_PERFORMANCE_H
       
    19 #define RMDEBUG_PERFORMANCE_H
       
    20 
       
    21 #include <u32hal.h>
       
    22 #include <f32file.h>
       
    23 #include <rm_debug_api.h>
       
    24 
       
    25 /* Config for t_rmdebug_app.exe: 
       
    26  * -f1: prefetch abort,
       
    27  * -d0: zero delay before crash
       
    28  * -p: priority of test target main thread
       
    29  */    
       
    30 _LIT(KTargetOptions,"-f1 -d0 -p%d");
       
    31 
       
    32 // Default number of test runs
       
    33 const TInt KNumOfTestRuns = 7;
       
    34 
       
    35 /**
       
    36  @Class TAgentEventInfo
       
    37  
       
    38  Class for gathering event data from the run-mode driver
       
    39  */
       
    40 class TAgentEventInfo
       
    41 {
       
    42 public:
       
    43     TAgentEventInfo() : iEventInfoBuf(iEventInfo) {}
       
    44    
       
    45 public:
       
    46     // This is the underlying class for event interaction with the Run Mode debug API 
       
    47     Debug::TEventInfo          iEventInfo;
       
    48     
       
    49     TPckg<Debug::TEventInfo>  iEventInfoBuf; 
       
    50 };
       
    51 
       
    52 /**
       
    53   @Class CRunModeAgent
       
    54   
       
    55   The basic run mode agent
       
    56   */
       
    57 class CRunModeAgent : public CBase
       
    58 	{
       
    59 public:
       
    60     
       
    61     enum displayHelp {EDontDisplayHelp =0, EDisplayHelp };
       
    62     
       
    63 	static CRunModeAgent* NewL();
       
    64 	~CRunModeAgent();
       
    65 	void ClientAppL();  
       
    66 	Debug::RSecuritySvrSession&  DebugDriver() { return iServSession; };	
       
    67 
       
    68 private:
       
    69 	void ConstructL();
       
    70 	void StartTest();
       
    71 	void TestDriverPerformance();
       
    72 	void RunBenchMarkTest();
       
    73 	TInt ParseCommandLine();
       
    74 	
       
    75 	void Attach();
       
    76 	void Detach();
       
    77 	    
       
    78 	void HandleEvent(Debug::TEventInfo& aEventInfo);
       
    79 	TInt LaunchProcessL(RProcess& aProcess, const TDesC& aExeName, const TDesC& aCommandLine);
       
    80 	void DisplayUsage();
       
    81 	void GetNanoTickPeriod();
       
    82 	void SetEventAction();
       
    83 	void SetDefaultParamValues();
       
    84 	
       
    85 	void CalculatePerformance();
       
    86 	void GetEvent();
       
    87 	void GetStartTime();
       
    88 	TInt GetTimeInMs();
       
    89 	
       
    90 private:
       
    91 	
       
    92 	/** 
       
    93 	  Used for test cases interacting with the RMDBG only
       
    94 	 */
       
    95 	TRequestStatus iStatus;   
       
    96 	
       
    97 	/**
       
    98 	  The nanokernel tick period in MS
       
    99 	*/
       
   100 	TInt iTickPeriodMs;
       
   101 
       
   102 	/*
       
   103 	 * Handle to DSS
       
   104 	 */
       
   105 	Debug::RSecuritySvrSession iServSession;
       
   106 	
       
   107 	/**
       
   108 	 Array to store tick counts between an iteration of a test run
       
   109 	*/
       
   110 	RArray<TUint> iTimeDifs;
       
   111 	
       
   112 	/**
       
   113 	 Object to gather event data from RMDBG
       
   114 	*/
       
   115 	TAgentEventInfo iSEventInfo;
       
   116 		
       
   117 	/**
       
   118 	  Flag to indicate test target has crashed
       
   119 	*/
       
   120 	TBool ilaunchCompleted;
       
   121 	
       
   122 	/*
       
   123 	 * RProperty to get counter value from test app
       
   124 	 */
       
   125 	RProperty iIntegerProperty;
       
   126 		
       
   127 	struct PerformanceTestParams
       
   128 	    {
       
   129 	    enum TestOptions {EAttachAll=0,EAttachExe, EBenchMarkTest };
       
   130 	    TUint iTestType;
       
   131 	    TUint iNumOfTestRuns;
       
   132 	    TUint iTestTargetPriority;
       
   133 	    TUint iEvents;
       
   134 	    TInt iCountEnd;
       
   135 	    TInt iCountStart;
       
   136 	    TUint iDriver;
       
   137 	    } iParams;
       
   138 	    
       
   139 	};
       
   140 
       
   141 #endif // RMDEBUG_PERFORMANCE_H
       
   142