|
1 // extrabtrace.cpp |
|
2 // |
|
3 // Copyright (c) 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 #include <fshell/extrabtrace.h> |
|
13 #include "common.h" |
|
14 |
|
15 NONSHARABLE_CLASS(RExtraBtraceImpl) : public RBusLogicalChannel |
|
16 { |
|
17 public: |
|
18 TInt Connect(); |
|
19 TInt EnableProfiling(TInt aSamplingPeriod); |
|
20 }; |
|
21 |
|
22 #define iImplementation (*reinterpret_cast<RExtraBtraceImpl*>(iImpl)) |
|
23 #define iConstImplementation (*reinterpret_cast<const RExtraBtraceImpl*>(iImpl)) |
|
24 |
|
25 EXPORT_C RExtraBtrace::RExtraBtrace() |
|
26 { |
|
27 iImplementation.SetHandle(0); |
|
28 } |
|
29 |
|
30 EXPORT_C TInt RExtraBtrace::Connect() |
|
31 { |
|
32 return iImplementation.Connect(); |
|
33 } |
|
34 |
|
35 EXPORT_C void RExtraBtrace::Close() |
|
36 { |
|
37 iImplementation.Close(); |
|
38 } |
|
39 |
|
40 EXPORT_C TInt RExtraBtrace::Handle() const |
|
41 { |
|
42 return iConstImplementation.Handle(); |
|
43 } |
|
44 |
|
45 EXPORT_C TInt RExtraBtrace::EnableProfiling(TInt aSamplingPeriod) |
|
46 { |
|
47 return iImplementation.EnableProfiling(aSamplingPeriod); |
|
48 } |
|
49 |
|
50 TInt RExtraBtraceImpl::Connect() |
|
51 { |
|
52 _LIT(KLddName,"extrabtracek"); |
|
53 TInt r = User::LoadLogicalDevice(KLddName); |
|
54 if(r!=KErrNone && r!=KErrAlreadyExists) |
|
55 return r; |
|
56 |
|
57 #ifdef FSHELL_CUSTOM_BTRACE_SUPPORT_LIBRARY |
|
58 // If FSHELL_TRACE_LIBRARY etc has been overridden it's possible that we need to load an additional driver to have extrabtrace function |
|
59 r = User::LoadLogicalDevice(TPtrC((const TUint16*)FSHELL_CUSTOM_BTRACE_SUPPORT_LIBRARY)); |
|
60 if(r!=KErrNone && r!=KErrAlreadyExists) |
|
61 return r; |
|
62 #endif |
|
63 |
|
64 r = DoCreate(KLogicalDeviceName, TVersion(), KNullUnit, NULL, NULL, EOwnerThread); |
|
65 return r; |
|
66 } |
|
67 |
|
68 TInt RExtraBtraceImpl::EnableProfiling(TInt aSamplingPeriod) |
|
69 { |
|
70 return DoControl(EControlEnableProfiling, (TAny*)aSamplingPeriod); |
|
71 } |