memspy/MemSpyClient/inc/memspysession.h
changeset 17 67c6ff54ec25
child 22 a009639409f5
equal deleted inserted replaced
15:ccab7f1f8266 17:67c6ff54ec25
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MEMSPYSESSION_H
       
    20 #define MEMSPYSESSION_H
       
    21 
       
    22 
       
    23 // System includes
       
    24 #include <e32base.h>
       
    25 #include <u32std.h>
       
    26 
       
    27 //user includes
       
    28 #include <memspy/engine/memspyprocessdata.h> //for Processes
       
    29 #include <memspy/api/memspyapiprocess.h>
       
    30 #include <memspy/engine/memspythreaddata.h> //for Threads
       
    31 #include <memspy/api/memspyapithread.h>
       
    32 #include <memspy/engine/memspykernelobjectdata.h> //for KernelObjects
       
    33 #include <memspy/api/memspyapikernelobject.h>
       
    34 #include <memspy/api/memspyapikernelobjectitem.h> //for KernelObjectItems
       
    35 #include <memspy/engine/memspyheapdata.h> //for Heap
       
    36 #include <memspy/api/memspyapiheap.h>
       
    37 
       
    38 // Constants
       
    39 const TInt KMemSpyVersion           = 2;
       
    40 
       
    41 // Literal constants 
       
    42 _LIT( KMemSpyServer2, "MemSpyServer.exe" );
       
    43 
       
    44 
       
    45 //
       
    46 enum TMemSpyOperations
       
    47     {
       
    48 	//Output operations
       
    49 	
       
    50 //	EGetSinkType,
       
    51 //	EOutputToDebug,
       
    52 //	EOutputToFile,
       
    53 //	EOutputKernelObjects,
       
    54 //	ESetServerTimeOutStatus,
       
    55 //	EOutputProcessInfo,
       
    56 	
       
    57 	//Processes operations
       
    58 	
       
    59 	EGetProcessCount,
       
    60 	EGetProcesses,
       
    61 	EGetThreadCount,
       
    62 	EGetThreads,
       
    63 	ESetThreadPriority,
       
    64 	EProcessSystemPermanentOrCritical,
       
    65 	EEndProcess,
       
    66 	ESwitchToProcess,
       
    67 //	EOpenCloseCurrentProcess
       
    68 	
       
    69 	//Threads operations
       
    70 	EThreadSystemPermanentOrCritical,	
       
    71 	EEndThread,
       
    72 	ESwitchToThread,
       
    73 	
       
    74 	//Kernel Objects operations
       
    75 	EGetKernelObjectTypeCount,
       
    76 	EGetKernelObjects,
       
    77 	EGetKernelObjectItemsCount,
       
    78 	EGetKernelObjectItems,
       
    79 	//EOutputKernelObjects
       
    80 	
       
    81 	//Heap operations
       
    82 	EGetHeap
       
    83     };
       
    84 
       
    85 enum TSortType
       
    86 	{
       
    87 	ESortProcById,
       
    88 	ESortProcByName,
       
    89 	ESortProcByThreadCount,
       
    90 	ESortProcByCodeSegs,
       
    91 	ESortProcByHeapUsage,
       
    92 	ESortProcByStackUsage
       
    93 	};
       
    94 
       
    95 enum TEndType
       
    96 	{
       
    97 	ETerminate,
       
    98 	EKill,
       
    99 	EPanic
       
   100 };
       
   101 
       
   102 NONSHARABLE_CLASS( RMemSpySession ) : public RSessionBase
       
   103     {
       
   104 public:
       
   105     IMPORT_C RMemSpySession();
       
   106     IMPORT_C TInt Connect();
       
   107     
       
   108 public:	//API
       
   109     //Output operations
       
   110     //inline TMemSpySinkType GetSinkType();    
       
   111     //inline void OutputToDebug();
       
   112     //inline void OutputToFile();    
       
   113     //inline void OutputKernelObjects();    
       
   114     //inline void SetServerTimeOutStatus( TUint32 aValue, TBool aEnabled );
       
   115     //inline void OutputProcessInfo( TMemSpyProcess aProcess );
       
   116     
       
   117     //Processes operations    
       
   118     /**
       
   119      * 
       
   120      */
       
   121     IMPORT_C void GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType = ESortProcById);        
       
   122     
       
   123     IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType = ESortProcById);
       
   124     IMPORT_C TInt ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue ); //aValue -> return value
       
   125     
       
   126     IMPORT_C void SetThreadPriorityL(TThreadId aId, TInt aPriority);
       
   127     IMPORT_C TInt EndProcess( TProcessId aId, TEndType aType );
       
   128     
       
   129     IMPORT_C TInt SwitchToProcess( TProcessId aId, TBool aBrought  );
       
   130     
       
   131     //inline void OpenCloseCurrentProcess( TProcessId aId, TBool aOpen );
       
   132     
       
   133     //Threads operations
       
   134     /**
       
   135      * 
       
   136      */
       
   137     IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiProcess*> &aThreads, TSortType aSortType = ESortProcById);
       
   138     
       
   139     IMPORT_C TInt ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue );
       
   140         
       
   141     IMPORT_C TInt EndThread( TThreadId aId, TEndType aType );
       
   142     
       
   143     IMPORT_C TInt SwitchToThread( TThreadId aId, TBool aBrought );
       
   144     
       
   145     //KernelObjects operations    
       
   146     /**
       
   147      * 
       
   148      */
       
   149     IMPORT_C TInt GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects );
       
   150     
       
   151     IMPORT_C TInt GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer );
       
   152     
       
   153     /**
       
   154      * 
       
   155      */
       
   156     //IMPORT_C TInt GetHeap( RArray<CMemSpyApiHeap*> &aHeap );
       
   157 	//IMPORT_C TInt GetHeap( CMemSpyApiHeap* aHeap );
       
   158 	IMPORT_C CMemSpyApiHeap* GetHeap();
       
   159     
       
   160 private:
       
   161     TInt StartServer();
       
   162     };
       
   163 
       
   164 #endif // MEMSPYSESSION_H