|
1 // Copyright (c) 2009 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 // |
|
15 |
|
16 #ifndef UTRACESQLITE_H_ |
|
17 #define UTRACESQLITE_H_ |
|
18 |
|
19 #if defined SQLITE_ENABLE_TRACE |
|
20 |
|
21 // UID3 of sqlite3.dll |
|
22 #define EXECUTABLE_DEFAULT_MODULEUID 0x10285A79 |
|
23 |
|
24 //The UTF header can only be included after EXECUTABLE_DEFAULT_MODULEUID is defined |
|
25 #include <e32utf.h> |
|
26 |
|
27 /** |
|
28 Enable this macro to compile in the SQLite trace points that certain porting layer functions entry and exit. |
|
29 From the timestamps of these trace, the total time spent in these functions can be worked out. |
|
30 These traces are particularly useful for performance investigations. |
|
31 |
|
32 @SymTraceMacro |
|
33 */ |
|
34 #undef SYMBIAN_TRACE_SQLITE_FUNC |
|
35 |
|
36 /** |
|
37 Enable this macro to compile in the SQLite trace points that trace the following internal events. |
|
38 - Extra internal information for certain porting layer functions |
|
39 These traces can be used to assist performance and debug investigations |
|
40 |
|
41 @SymTraceMacro |
|
42 */ |
|
43 #undef SYMBIAN_TRACE_SQLITE_EVENTS |
|
44 |
|
45 #endif //SQLITE_ENABLE_TRACE |
|
46 |
|
47 |
|
48 //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
49 ////////// UTrace Related Strings /////////////////////// |
|
50 //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
51 #if defined SQLITE_ENABLE_TRACE |
|
52 #ifdef __SQLITETRACE_STRINGS__ |
|
53 #define CONST_LIT8(var, val) extern const TLitC8<sizeof(val)> var = {sizeof(val) - 1, val} |
|
54 #define CONST_LIT16(var, val) extern const TLitC16<sizeof(L##val)/2> var = {sizeof(L##val)/2 - 1, L##val} |
|
55 #else |
|
56 #define CONST_LIT8(var, val) extern const TLitC8<sizeof(val)> var |
|
57 #define CONST_LIT16(var, val) extern const TLitC16<sizeof(L##val)/2> var |
|
58 #endif |
|
59 |
|
60 //File I/O trace format strings |
|
61 CONST_LIT8(KFileRead, "Sqlite: Size - %d bytes, File Offset Position - %d,"); |
|
62 CONST_LIT8(KFileWrite, "Sqlite: Size - %d bytes, File Offset Position - %d,"); |
|
63 CONST_LIT8(KFileTruncate, "Sqlite: Size - %d bytes"); |
|
64 CONST_LIT8(KFileFileCtr, "Sqlite: Opeartion Called - %d"); |
|
65 CONST_LIT16(KFileOpen, "Sqlite: Sqlite3_file - 0x%x, Filename - \"%S\""); |
|
66 CONST_LIT16(KFileName, "Sqlite: Filename - \"%S\""); |
|
67 |
|
68 //TSqlUTraceProfiler trace format strings, used to display function entry and exit |
|
69 CONST_LIT8(KProfilerBegin, "Function Entry:\"%S\", Address - 0x%x"); |
|
70 CONST_LIT8(KProfilerEnd, "Function Exit:\"%S\", Address - 0x%x"); |
|
71 |
|
72 #endif //SQLITE_ENABLE_TRACE |
|
73 |
|
74 //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
75 ////////// UTrace Related Macro Functions and Class Declarations //////////////////// |
|
76 //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
77 #ifdef SYMBIAN_TRACE_SQLITE_FUNC |
|
78 |
|
79 /** |
|
80 This class is used to help trace function entry and exits within sqlite3.dll |
|
81 Exist only when SYMBIAN_TRACE_SQLITE_FUNC is enabled. |
|
82 |
|
83 @internalComponent |
|
84 */ |
|
85 class TSqlUTraceProfiler |
|
86 { |
|
87 public: |
|
88 TSqlUTraceProfiler(const TAny* aObj, const char* aFunctionStr); |
|
89 ~TSqlUTraceProfiler(); |
|
90 private: |
|
91 const TAny* iObj; |
|
92 TPtrC8 iFunctionStr; |
|
93 }; |
|
94 |
|
95 //This macro should be used to trace function entry and exits within Symbian SQL |
|
96 //Works only when SYMBIAN_TRACE_SQLITE_FUNC is enabled. Otherwise it evaluates to zero |
|
97 #define SQLUTRACE_PROFILER(x) TSqlUTraceProfiler _profiler(x, __PRETTY_FUNCTION__) |
|
98 |
|
99 #else |
|
100 |
|
101 #define SQLUTRACE_PROFILER(x) void(0) |
|
102 #endif //SYMBIAN_TRACE_SQLITE_FUNC |
|
103 |
|
104 #ifdef SYMBIAN_TRACE_SQLITE_EVENTS |
|
105 |
|
106 //This macro should be used to trace events occuring within Symbian SQL. |
|
107 //To use the macro, insert the full UTF statement as the macro parameter |
|
108 //Works only when SYMBIAN_TRACE_SQLITE_EVENTS is enabled. Otherwise it evaluates to zero |
|
109 #define SYMBIAN_TRACE_SQLITE_EVENTS_ONLY(c) c |
|
110 const TPtrC8 GetFuncString(TInt aFunction); |
|
111 |
|
112 #else |
|
113 |
|
114 #define SYMBIAN_TRACE_SQLITE_EVENTS_ONLY(c) void(0) |
|
115 #endif //SYMBIAN_TRACE_SQLITE_EVENTS |
|
116 //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
117 #endif /* UTRACESQLITE_H_ */ |