|
1 // Copyright (c) 1998-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 the License "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 __ANALYSE__ |
|
17 #define __ANALYSE__ |
|
18 |
|
19 #ifndef __MSVCDOTNET__ |
|
20 #pragma warning(push, 3) // cannot compile MSVC's STL at warning level 4 |
|
21 #pragma warning(disable: 4786 4710 4530) |
|
22 #endif //__MSVCDOTNET__ |
|
23 |
|
24 int const MajorVersion=2; |
|
25 int const MinorVersion=0; |
|
26 int const Build=0; |
|
27 |
|
28 #include <vector> |
|
29 |
|
30 #ifdef __MSVCDOTNET__ |
|
31 #include <iostream> |
|
32 using namespace std; |
|
33 #else //!__MSVCDOTNET__ |
|
34 #include <iostream.h> |
|
35 class ostream; |
|
36 class istream; |
|
37 #endif //__MSVCDOTNET__ |
|
38 |
|
39 class Sampler; |
|
40 class CodeSpace; |
|
41 class SymbolFile; |
|
42 class NonXIP; |
|
43 |
|
44 class Analyse |
|
45 { |
|
46 public: |
|
47 enum TAction {EProfile, ETrace, EActivity}; |
|
48 enum TFormat {EPercent, ESamples, EExcel}; |
|
49 enum TPartition {EDefault, EDll, EFunction, EBuckets, ESize}; |
|
50 enum |
|
51 { |
|
52 ENull = 0x0001, |
|
53 EAddress = 0x0002, |
|
54 EZeros = 0x0004, |
|
55 ENoOther = 0x0008, |
|
56 ETotalOnly = 0x0010, |
|
57 ERange = 0x0020 |
|
58 }; |
|
59 enum TCfgFileErrors {EOk, ENoCfgFile, EErrorCfgFile}; |
|
60 public: |
|
61 static int ProcessCommandLine(int argc,char ** argv); |
|
62 static int ProcessCfgFile(const char* aCfgFileName); |
|
63 static void ExplainUsage(); |
|
64 static void ExplainConfigUsage(); |
|
65 static void Run(); |
|
66 // |
|
67 static inline bool Option(int type) |
|
68 {return (sOptions & type) != 0;} |
|
69 static inline TAction Action() |
|
70 {return sAction;} |
|
71 static inline TFormat Format() |
|
72 {return sFormat;} |
|
73 static inline TPartition Partition() |
|
74 {return sPartition;} |
|
75 // |
|
76 static void Abort(); |
|
77 static void Abort(char const* message); |
|
78 static void Corrupt(char const* message); |
|
79 static ostream& Error(); |
|
80 static ostream& Warning(); |
|
81 // |
|
82 static bool Match(const char* aString, const char* aMatch); |
|
83 private: |
|
84 static void Information(); |
|
85 static CodeSpace* CreateCodeSpace(SymbolFile* aSymbols, NonXIP *aNonXIP); |
|
86 static Sampler* CreateSampler(SymbolFile* aSymbols, NonXIP *aNonXIP); |
|
87 private: |
|
88 static TAction sAction; |
|
89 static TFormat sFormat; |
|
90 static TPartition sPartition; |
|
91 static int sOptions; |
|
92 static std::vector<const char*> sTraces; |
|
93 static const char* sRomFile; |
|
94 static const char* sDll; |
|
95 static const char* sFunction; |
|
96 static unsigned sBase; |
|
97 static unsigned sLim; |
|
98 static unsigned sBuckets; |
|
99 static unsigned sBucketSize; |
|
100 static double sCutOff; |
|
101 static unsigned sBeginSample; |
|
102 static unsigned sEndSample; |
|
103 |
|
104 static std::string iRomFile; |
|
105 static std::string iDll; |
|
106 static std::string iFunction; |
|
107 static std::string iThread; |
|
108 static std::vector<std::string> iTraces; |
|
109 public: |
|
110 static const char* sThread; |
|
111 }; |
|
112 |
|
113 #endif |