51
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: Declaration of the class TATDriveInfo.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef ANALYZETOOLFILELOG_H_
|
|
19 |
#define ANALYZETOOLFILELOG_H_
|
|
20 |
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <s32file.h> //RFileWriteStream
|
|
23 |
#include <f32file.h> //RFs
|
|
24 |
#include <analyzetool/atcommon.h>
|
|
25 |
|
|
26 |
class RATFileLog : public CBase
|
|
27 |
{
|
|
28 |
enum EMessageType{
|
|
29 |
EFileVersion = 0,
|
|
30 |
EProcessStart,
|
|
31 |
EProcessEnd,
|
|
32 |
EThreadStart,
|
|
33 |
EThreadEnd,
|
|
34 |
EDllLoad,
|
|
35 |
EDllUnload,
|
|
36 |
EAllocH,
|
|
37 |
EAllocF,
|
|
38 |
EFreeH,
|
|
39 |
EFreeF,
|
|
40 |
EReallocH,
|
|
41 |
EReallocF,
|
|
42 |
ETestStart,
|
|
43 |
ETestEnd,
|
|
44 |
EHandleLeak,
|
|
45 |
EDeviceInfo,
|
|
46 |
EError
|
|
47 |
};
|
|
48 |
|
|
49 |
public:
|
|
50 |
|
|
51 |
RATFileLog();
|
|
52 |
virtual ~RATFileLog();
|
|
53 |
|
|
54 |
/**
|
|
55 |
* TBD
|
|
56 |
* @return KErrNone.
|
|
57 |
*/
|
|
58 |
|
|
59 |
TInt ATFileLogVersion();
|
|
60 |
|
|
61 |
/**
|
|
62 |
* TBD
|
|
63 |
* @param aProcessName The name of the new process started. The length of this
|
|
64 |
* descriptor must not be greater than KMaxProcessName.
|
|
65 |
* @param aIsDebug Determines whether a binary is UDEB or UREL
|
|
66 |
* @return KErrNone.
|
|
67 |
*/
|
|
68 |
|
|
69 |
TInt ATFileLogProcessStarted( const TDesC8& aProcessName,
|
|
70 |
TUint aProcessId,
|
|
71 |
TUint32 aIsDebug,
|
|
72 |
const TDesC8& aAtoolVersion,
|
|
73 |
const TDesC8& aApiVersion );
|
|
74 |
|
|
75 |
/**
|
|
76 |
* TBD
|
|
77 |
* @param aProcessId The ID number of the process ended.
|
|
78 |
* @param aHandleLeakCount Number of handles open.
|
|
79 |
* @return KErrNone, if successful; otherwise one of the other
|
|
80 |
* system-wide error codes.
|
|
81 |
*/
|
|
82 |
TInt ATFileLogProcessEnded( TUint aHandleLeakCount );
|
|
83 |
|
|
84 |
/**
|
|
85 |
* TBD
|
|
86 |
* @param aDllName The name of the new DLL loaded. The length of this descriptor
|
|
87 |
* must not be greater than KMaxLibraryName.
|
|
88 |
* @param aStartAddress The start address of the DLL loaded.
|
|
89 |
* @param aEndAddress The end address of the DLL loaded.
|
|
90 |
* @return KErrNone.
|
|
91 |
*/
|
|
92 |
TInt ATFileLogDllLoaded( const TDesC8& aDllName, TUint32 aStartAddress,
|
|
93 |
TUint32 aEndAddress );
|
|
94 |
|
|
95 |
/**
|
|
96 |
* TBD
|
|
97 |
* @param aDllName The name of the DLL to be unloaded. The length of this
|
|
98 |
* descriptor must not be greater than KMaxLibraryName.
|
|
99 |
* @param aStartAddress The start address of the DLL to be unloaded.
|
|
100 |
* @param aEndAddress The end address of the DLL to be unloaded.
|
|
101 |
* @return KErrNone.
|
|
102 |
*/
|
|
103 |
TInt ATFileLogDllUnloaded( const TDesC8& aDllName, TUint32 aStartAddress,
|
|
104 |
TUint32 aEndAddress );
|
|
105 |
|
|
106 |
/**
|
|
107 |
* TBD
|
|
108 |
* @param aMemAddress The memory location where memory has been allocated.
|
|
109 |
* @param aCallstack An array including the current call stack.
|
|
110 |
* @param aSize The size of the newly allocated memory chunk.
|
|
111 |
* @param aThreadId ID of the thread
|
|
112 |
* @return KErrNone.
|
|
113 |
*/
|
|
114 |
TInt ATFileLogMemoryAllocated( TUint32 aMemAddress,
|
|
115 |
TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
|
|
116 |
TInt aSize, TUint aThreadId );
|
|
117 |
|
|
118 |
/**
|
|
119 |
* TBD
|
|
120 |
* @param aMemAddress The memory location where memory has been deallocated.
|
|
121 |
* @param aFreeCallstack An array including the current call stack.
|
|
122 |
* @param aThreadId ID of the thread
|
|
123 |
* @return KErrNone.
|
|
124 |
*/
|
|
125 |
TInt ATFileLogMemoryFreed( TUint32 aMemAddress,
|
|
126 |
TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack,
|
|
127 |
TUint aThreadId );
|
|
128 |
|
|
129 |
/**
|
|
130 |
* TBD
|
|
131 |
* @param aMemAddressFree The memory location where memory has been deallocated.
|
|
132 |
* @param aMemAddressAlloc The memory location where memory has been allocated.
|
|
133 |
* @param aFreeCallstack An array including the current call stack.
|
|
134 |
* @param aThreadId ID of the thread
|
|
135 |
* @return KErrNone.
|
|
136 |
*/
|
|
137 |
TInt ATFileLogMemoryReallocated( TUint32 aMemAddressFree, TUint32 aMemAddressAlloc,
|
|
138 |
TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
|
|
139 |
TInt aSize, TUint aThreadId );
|
|
140 |
|
|
141 |
/**
|
|
142 |
* TBD
|
|
143 |
* @param aThreadID An ID of the new thread started
|
|
144 |
* @return KErrNone.
|
|
145 |
*/
|
|
146 |
TInt ATFileLogThreadStarted( TUint aThreadId );
|
|
147 |
|
|
148 |
/**
|
|
149 |
* TBD
|
|
150 |
* @param aThreadID An ID of the thread ended
|
|
151 |
* @return KErrNone.
|
|
152 |
*/
|
|
153 |
TInt ATFileLogThreadEnded( TUint64 aThreadId );
|
|
154 |
|
|
155 |
/**
|
|
156 |
* TBD
|
|
157 |
* @param aS60Version S60 version
|
|
158 |
* @aChecksum ROM checksum
|
|
159 |
* @return KErrNone.
|
|
160 |
*/
|
|
161 |
TInt ATFileLogDeviceInfo( const TDesC8& aS60Version, const TDesC8& aChecksum);
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Opens a file server session and a file with the name specified.
|
|
165 |
* @param aFileName The name of the file into which to log.
|
|
166 |
* @param aProcessName Current process name.
|
|
167 |
* @return KErrNone, if successful; otherwise one of the other system wide
|
|
168 |
* error codes.
|
|
169 |
*/
|
|
170 |
TInt OpenFsAndFile( const TDesC& aFileName, const TDesC& aFilePath, const TDesC8& aProcessName );
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Method is used to parse file name extension.
|
|
174 |
* @param aFileName The name of the file into which to log.
|
|
175 |
* @param aExtension Parsed file extension.
|
|
176 |
*/
|
|
177 |
void ParseExtension( TDes& aFileName, TDes& aExtension );
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Called internally when need generate new file name.
|
|
181 |
* @param aFileName The name of the file into which to log.
|
|
182 |
* @param aProcessName Current process name.
|
|
183 |
*/
|
|
184 |
void GenerateNewFileName( TDes& aFileName, const TDesC8& aProcessName );
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Method is used to check that file exists and is valid.
|
|
188 |
* @param aFileName The name of the file into which to log.
|
|
189 |
*/
|
|
190 |
void CheckIfFileAlreadyExist( const TDes& aFileName );
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Closes the handles to the file server session and to the file (if currently open).
|
|
194 |
*/
|
|
195 |
void CloseFsAndFile();
|
|
196 |
|
|
197 |
// Local time function.
|
|
198 |
TInt64 CurrentTime();
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
/**
|
|
203 |
* A variable telling the number of microseconds from January 1st, 0 AD
|
|
204 |
* nominal Gregorian to January 1st, 1970 AD nominal Gregorian.
|
|
205 |
*/
|
|
206 |
TInt64 iMicroSecondsAt1970;
|
|
207 |
|
|
208 |
/** A handle to a file server */
|
|
209 |
RFs iFileServer;
|
|
210 |
|
|
211 |
/** A handle to a file write stream */
|
|
212 |
RFileWriteStream iFile;
|
|
213 |
|
|
214 |
/** The logging file of this process */
|
|
215 |
TBuf8<KMaxFileName> iLogFile;
|
|
216 |
|
|
217 |
/** A member variable for storing results of server function calls. */
|
|
218 |
TInt iError;
|
|
219 |
|
|
220 |
|
|
221 |
};
|
|
222 |
|
|
223 |
#endif /* ANALYZETOOLFILELOG_H_ */
|