memspy/MemSpyClient/inc/memspysession.h
changeset 20 a71a3e32a2ae
child 30 86a2e675b80a
equal deleted inserted replaced
15:ccab7f1f8266 20:a71a3e32a2ae
       
     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 
       
    31 #include <memspy/engine/memspythreaddata.h> //for Threads
       
    32 #include <memspy/api/memspyapithread.h>
       
    33 #include <memspy/api/memspyapithreadinfoitem.h>
       
    34 #include <memspy/engine/memspythreadinfoitemdata.h>
       
    35 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
       
    36 
       
    37 #include <memspy/engine/memspykernelobjectdata.h> //for KernelObjects
       
    38 #include <memspy/api/memspyapikernelobject.h>
       
    39 
       
    40 #include <memspy/api/memspyapikernelobjectitem.h> //for KernelObjectItems
       
    41 
       
    42 #include <memspy/engine/memspyheapdata.h> //for Heap
       
    43 #include <memspy/api/memspyapiheap.h>
       
    44 
       
    45 #include <memspyengineclientinterface.h>
       
    46 
       
    47 // Constants
       
    48 const TInt KMemSpyVersion           = 2;
       
    49 
       
    50 enum TSortType
       
    51 	{
       
    52 	ESortProcById,
       
    53 	ESortProcByName,
       
    54 	ESortProcByThreadCount,
       
    55 	ESortProcByCodeSegs,
       
    56 	ESortProcByHeapUsage,
       
    57 	ESortProcByStackUsage
       
    58 	};
       
    59 
       
    60 enum TMemSpyOutputType
       
    61     {
       
    62     EOutputTypeDebug = 0,
       
    63     EOutputTypeFile
       
    64     };
       
    65 
       
    66 
       
    67 NONSHARABLE_CLASS( RMemSpySession ) : public RSessionBase
       
    68     {
       
    69 public:
       
    70     IMPORT_C RMemSpySession();
       
    71     IMPORT_C TInt Connect();
       
    72     
       
    73 public:	//API
       
    74     IMPORT_C void OutputKernelHeapDataL(TMemSpyOutputType aOutputType); //EMemSpyClientServerOpHeapData
       
    75     IMPORT_C void OutputThreadHeapDataL(TMemSpyOutputType aOutputType, TThreadId aThreadId); //EMemSpyClientServerOpHeapData
       
    76     IMPORT_C void OutputThreadCellListL(TMemSpyOutputType aOutputType, TThreadId aThreadId);//EMemSpyClientServerOpHeapCellListing
       
    77     IMPORT_C void OutputKernelObjectsL(TMemSpyOutputType aOutputType);// EMemSpyClientServerOpEnumerateKernelContainerAll
       
    78     IMPORT_C void OutputCompactStackInfoL(TMemSpyOutputType aOutputType);// EMemSpyClientServerOpStackInfoCompact
       
    79     IMPORT_C void OutputCompactHeapInfoL(TMemSpyOutputType aOutputType);// EMemSpyClientServerOpHeapInfoCompact
       
    80     
       
    81     IMPORT_C void GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType = ESortProcById);
       
    82     
       
    83     IMPORT_C TProcessId GetProcessIdByNameL(const TDesC& aProcessName);
       
    84     
       
    85     IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType = ESortProcById);
       
    86     
       
    87     IMPORT_C TInt ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue ); //aValue -> return value
       
    88     
       
    89     IMPORT_C void SetThreadPriorityL(TThreadId aId, TInt aPriority);
       
    90     IMPORT_C TInt EndProcess( TProcessId aId, TMemSpyEndType aType );
       
    91     
       
    92     IMPORT_C TInt SwitchToProcess( TProcessId aId, TBool aBrought  );
       
    93     
       
    94     
       
    95     //Threads operations
       
    96     /**
       
    97      * 
       
    98      */
       
    99     IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiProcess*> &aThreads, TSortType aSortType = ESortProcById);
       
   100     
       
   101     IMPORT_C TInt ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue );
       
   102         
       
   103     IMPORT_C TInt EndThread( TThreadId aId, TMemSpyEndType aType );
       
   104     
       
   105     IMPORT_C TInt SwitchToThread( TThreadId aId, TBool aBrought );
       
   106     
       
   107     IMPORT_C TInt GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType );
       
   108     
       
   109     IMPORT_C void GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType );
       
   110     
       
   111     //KernelObjects operations    
       
   112     /**
       
   113      * 
       
   114      */
       
   115     IMPORT_C TInt GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects );
       
   116     
       
   117     IMPORT_C TInt GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer );
       
   118     
       
   119     IMPORT_C void OutputAllContainerContents();
       
   120     
       
   121     /**
       
   122      * 
       
   123      */    
       
   124 	IMPORT_C CMemSpyApiHeap* GetHeap();
       
   125 	
       
   126 	IMPORT_C void DumpKernelHeap();
       
   127     
       
   128 private:
       
   129     TInt StartServer();
       
   130     
       
   131     void SetOutputTypeL(TMemSpyOutputType aOutputType);
       
   132     };
       
   133 
       
   134 #endif // MEMSPYSESSION_H