author | Matti Laitinen <matti.t.laitinen@nokia.com> |
Thu, 11 Feb 2010 15:52:57 +0200 | |
changeset 1 | 3ff3fecb12fe |
permissions | -rw-r--r-- |
1
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
8 |
* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
11 |
* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
13 |
* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
15 |
* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
17 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
18 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
19 |
// Include Files |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
20 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
21 |
#include "DiskWriterPlugin.h" // CDiskWriterPlugin |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
22 |
#include <e32base.h> |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
23 |
#include <sysutil.h> |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
24 |
#include <piprofiler/EngineUIDs.h> |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
25 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
26 |
// constants |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
27 |
//const TInt KDelayBeforeTimerStarts( 5000000 ); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
28 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
29 |
// engine properties |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
30 |
const TUid KEngineStatusPropertyCat={0x2001E5AD}; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
31 |
enum TEnginePropertyKeys |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
32 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
33 |
EProfilerEngineStatus = 8, |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
34 |
EProfilerErrorStatus |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
35 |
}; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
36 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
37 |
/* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
38 |
* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
39 |
* Class CDiskWriterPlugin implementation |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
40 |
* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
41 |
*/ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
42 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
43 |
// Member Functions |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
44 |
CDiskWriterPlugin* CDiskWriterPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
45 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
46 |
LOGTEXT(_L("CDiskWriterPlugin::NewL() - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
47 |
CDiskWriterPlugin* self = new (ELeave) CDiskWriterPlugin(KDiskWriterPluginUid); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
48 |
CleanupStack::PushL( self ); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
49 |
self->ConstructL(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
50 |
CleanupStack::Pop(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
51 |
LOGTEXT(_L("CDiskWriterPlugin::NewL() - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
52 |
return self; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
53 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
54 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
55 |
CDiskWriterPlugin::CDiskWriterPlugin(const TUid aImplementationUid) : |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
56 |
iWriterType(aImplementationUid.iUid) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
57 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
58 |
LOGTEXT(_L("CDiskWriterPlugin::CDiskWriterPlugin - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
59 |
isEnabled = EFalse; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
60 |
iWriterId = Id().iUid; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
61 |
LOGTEXT(_L("CDiskWriterPlugin::CDiskWriterPlugin - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
62 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
63 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
64 |
CDiskWriterPlugin::~CDiskWriterPlugin() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
65 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
66 |
LOGTEXT(_L("CDiskWriterPlugin::~CDiskWriterPlugin - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
67 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
68 |
iErrorStatus.Close(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
69 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
70 |
if(iWriterHandler) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
71 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
72 |
iWriterHandler->Cancel(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
73 |
delete iWriterHandler; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
74 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
75 |
LOGTEXT(_L("CDiskWriterPlugin::~CDiskWriterPlugin - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
76 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
77 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
78 |
void CDiskWriterPlugin::ConstructL() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
79 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
80 |
// second phase constructor, anything that may leave must be constructed here |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
81 |
LOGTEXT(_L("CDiskWriterPlugin::ConstructL() - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
82 |
iWriterHandler = CDiskWriterHandler::NewL(this); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
83 |
User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus)); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
84 |
LOGTEXT(_L("CDiskWriterPlugin::ConstructL() - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
85 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
86 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
87 |
void CDiskWriterPlugin::GetCaption( TDes& aCaption ) const |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
88 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
89 |
aCaption.Copy(KFileOutShortName); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
90 |
aCaption.TrimRight(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
91 |
LOGSTRING2("CDiskWriterPlugin::GetCaptionL() - Plugin name: %S", &aCaption); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
92 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
93 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
94 |
TUid CDiskWriterPlugin::Id() const |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
95 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
96 |
LOGSTRING2("CDiskWriterPlugin::Id():0x%X", KDiskWriterPluginUid.iUid ); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
97 |
return KDiskWriterPluginUid; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
98 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
99 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
100 |
void CDiskWriterPlugin::GetWriterVersion(TDes* aDes) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
101 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
102 |
_LIT(KDiskWriterVersion, "1.0.0"); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
103 |
aDes->Append(KDiskWriterVersion); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
104 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
105 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
106 |
TInt CDiskWriterPlugin::Start() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
107 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
108 |
// if(isEnabled) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
109 |
// { |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
110 |
// TRAPD(err, iWriterHandler->StartL()); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
111 |
// if( err != KErrNone) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
112 |
// { |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
113 |
// LOGTEXT(_L("Could not start writer plugin")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
114 |
// return err; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
115 |
// } |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
116 |
// } |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
117 |
return KErrNone; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
118 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
119 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
120 |
void CDiskWriterPlugin::Stop() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
121 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
122 |
// stop writer handler normally |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
123 |
iWriterHandler->Stop(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
124 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
125 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
126 |
TBool CDiskWriterPlugin::GetEnabled() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
127 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
128 |
return isEnabled; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
129 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
130 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
131 |
TUint32 CDiskWriterPlugin::GetWriterType() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
132 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
133 |
return iWriterType; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
134 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
135 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
136 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
137 |
void CDiskWriterPlugin::SetValue( const TWriterPluginValueKeys aKey, |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
138 |
TDes& aValue ) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
139 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
140 |
TRAP_IGNORE( SetValueL( aKey, aValue ) ); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
141 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
142 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
143 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
144 |
void CDiskWriterPlugin::GetValue( const TWriterPluginValueKeys aKey, |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
145 |
TDes& aValue ) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
146 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
147 |
TRAP_IGNORE( GetValueL( aKey, aValue ) ); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
148 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
149 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
150 |
void CDiskWriterPlugin::SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue ) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
151 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
152 |
TInt error(KErrNone); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
153 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
154 |
switch( aKey ) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
155 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
156 |
case EWriterPluginEnabled: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
157 |
isEnabled = ETrue; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
158 |
LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin enabled")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
159 |
break; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
160 |
case EWriterPluginDisabled: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
161 |
isEnabled = EFalse; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
162 |
LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin disabled")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
163 |
break; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
164 |
case EWriterPluginSettings: // file name in case of disk writer plugin |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
165 |
iFileName.Zero(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
166 |
iFileName.Append(aValue); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
167 |
error = iWriterHandler->TestFile(iFileName); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
168 |
User::LeaveIfError(error); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
169 |
break; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
170 |
default: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
171 |
break; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
172 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
173 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
174 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
175 |
void CDiskWriterPlugin::GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue ) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
176 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
177 |
switch( aKey ) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
178 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
179 |
case EWriterPluginVersion: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
180 |
GetWriterVersion(&aValue); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
181 |
break; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
182 |
case EWriterPluginType: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
183 |
break; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
184 |
case EWriterPluginSettings: // file name in disk writer case |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
185 |
aValue.Copy(iFileName); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
186 |
default: |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
187 |
break; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
188 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
189 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
190 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
191 |
void CDiskWriterPlugin::DoCancel() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
192 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
193 |
LOGTEXT(_L("CDebOutWriterPlugin::DoCancel - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
194 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
195 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
196 |
void CDiskWriterPlugin::WriteData() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
197 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
198 |
// Activate handler to write data from buffer to output |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
199 |
LOGTEXT(_L("CDiskWriterPlugin::WriteData() - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
200 |
iWriterHandler->StartL(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
201 |
LOGTEXT(_L("CDiskWriterPlugin::WriteData() - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
202 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
203 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
204 |
void CDiskWriterPlugin::HandleError(TInt aError) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
205 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
206 |
TInt err(KErrNone); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
207 |
RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error received: %d"), aError); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
208 |
err = iErrorStatus.Set(aError); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
209 |
if(err != KErrNone) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
210 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
211 |
RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error in updating property: %d"), err); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
212 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
213 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
214 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
215 |
/* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
216 |
* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
217 |
* Implementation of class CDiskWriterHandler |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
218 |
* |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
219 |
*/ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
220 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
221 |
CDiskWriterHandler* CDiskWriterHandler::NewL(CDiskWriterPlugin* aWriter) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
222 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
223 |
LOGTEXT(_L("CDiskWriterHandler::NewL() - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
224 |
CDiskWriterHandler* self = new (ELeave) CDiskWriterHandler(aWriter); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
225 |
CleanupStack::PushL( self ); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
226 |
self->ConstructL(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
227 |
CleanupStack::Pop(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
228 |
LOGTEXT(_L("CDiskWriterHandler::NewL() - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
229 |
return self; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
230 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
231 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
232 |
CDiskWriterHandler::CDiskWriterHandler(CDiskWriterPlugin* aWriter) : |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
233 |
CActive(EPriorityStandard) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
234 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
235 |
LOGTEXT(_L("CDiskWriterHandler::CDiskWriterHandler - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
236 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
237 |
iWriter = aWriter; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
238 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
239 |
// set initial mode to non-stopping |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
240 |
iStopping = EFalse; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
241 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
242 |
// add the handler to the active scheduler |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
243 |
CActiveScheduler::Add(this); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
244 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
245 |
LOGTEXT(_L("CDiskWriterHandler::CDiskWriterHandler - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
246 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
247 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
248 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
249 |
CDiskWriterHandler::~CDiskWriterHandler() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
250 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
251 |
LOGTEXT(_L("CDiskWriterHandler::~CDiskWriterHandler - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
252 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
253 |
LOGTEXT(_L("CDiskWriterHandler::~CDiskWriterHandler - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
254 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
255 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
256 |
void CDiskWriterHandler::ConstructL() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
257 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
258 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
259 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
260 |
TInt CDiskWriterHandler::TestFile(const TDesC& totalPrefix) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
261 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
262 |
TParse parse; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
263 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
264 |
TInt err(KErrNone); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
265 |
if((err = parse.Set(totalPrefix, NULL, NULL)) != KErrNone) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
266 |
return err; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
267 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
268 |
err = iFs.Connect(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
269 |
if(err != KErrNone) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
270 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
271 |
LOGTEXT(_L("CDiskWriterHandler::TestFile() - Failed to open a session to file server")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
272 |
return KErrNotFound; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
273 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
274 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
275 |
iFs.MkDirAll(parse.FullName()); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
276 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
277 |
err = iFile.Replace(iFs,parse.FullName(),EFileWrite); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
278 |
if(err != KErrNone) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
279 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
280 |
iFs.Close(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
281 |
return KErrNotFound; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
282 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
283 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
284 |
iFileName.Copy(parse.FullName()); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
285 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
286 |
return KErrNone; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
287 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
288 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
289 |
void CDiskWriterHandler::Reset() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
290 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
291 |
// cancel active object |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
292 |
Cancel(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
293 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
294 |
// start writing new buffer if there is one available |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
295 |
TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
296 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
297 |
// empty the rest of the buffers synchronously |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
298 |
while(nextBuf != 0) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
299 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
300 |
LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
301 |
if(nextBuf->iDataSize != 0) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
302 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
303 |
LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
304 |
WriteMemBufferToFile(*(nextBuf->iBufDes),iStatus); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
305 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
306 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
307 |
// empty buffers when profiling stopped |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
308 |
iWriter->iStream->AddToFreeBuffers(nextBuf); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
309 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
310 |
LOGTEXT(_L("CDiskWriterHandler::Reset - get next full buffer")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
311 |
// start writing new buffer if there is one available |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
312 |
nextBuf = iWriter->iStream->GetNextFilledBuffer(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
313 |
LOGSTRING2(_L("CDiskWriterHandler::Reset - got next filled 0x%x"),nextBuf); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
314 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
315 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
316 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
317 |
void CDiskWriterHandler::HandleFullBuffers() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
318 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
319 |
LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
320 |
// previous write operation has finished |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
321 |
// release the previous buffer |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
322 |
iWriter->iStream->AddToFreeBuffers(iBufferBeingWritten); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
323 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
324 |
LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - get next full buffer")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
325 |
// start writing new buffer if there is one available |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
326 |
TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
327 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
328 |
if(nextBuf != 0) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
329 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
330 |
LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - writing to file")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
331 |
if(nextBuf->iDataSize != 0) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
332 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
333 |
WriteBufferToOutput(nextBuf); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
334 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
335 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
336 |
LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
337 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
338 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
339 |
void CDiskWriterHandler::RunL() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
340 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
341 |
LOGTEXT(_L("CDiskWriterHandler::RunL - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
342 |
// call function to complete full buffer handling |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
343 |
HandleFullBuffers(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
344 |
LOGTEXT(_L("CDiskWriterHandler::RunL - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
345 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
346 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
347 |
void CDiskWriterHandler::DoCancel() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
348 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
349 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
350 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
351 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
352 |
//----------------------------------------------------------------------------- |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
353 |
// CPIProfilerTraceCoreLauncher::RunError(TInt aError) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
354 |
// Handle leaves from RunL(). |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
355 |
//----------------------------------------------------------------------------- |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
356 |
TInt CDiskWriterHandler::RunError(TInt aError) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
357 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
358 |
// no reason to continue if disk full or removed |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
359 |
iFile.Close(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
360 |
// close handle to file server too |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
361 |
iFs.Close(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
362 |
iFileName.Zero(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
363 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
364 |
iWriter->HandleError(KErrDiskFull); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
365 |
return aError; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
366 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
367 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
368 |
void CDiskWriterHandler::WriteMemBufferToFile(TDesC8& aDes, TRequestStatus& aStatus) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
369 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
370 |
LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
371 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
372 |
TUint sampleSize(aDes.Length()); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
373 |
TInt err(KErrNone); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
374 |
TInt drive(0); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
375 |
TDriveInfo info; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
376 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
377 |
err = iFile.Drive(drive,info); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
378 |
// check first if still space on disk |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
379 |
if( SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, sampleSize, drive) ) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
380 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
381 |
// set error to disk full |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
382 |
err = KErrDiskFull; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
383 |
LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - disk full, cannot write")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
384 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
385 |
else |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
386 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
387 |
// check if profiling in stopping mode |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
388 |
if(iStopping) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
389 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
390 |
// RDebug::Print(_L("CDiskWriterPlugin::WriteMemBufferToFile - data written, length %d, stopping"), aDes.Length()); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
391 |
// write to file without status |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
392 |
err = iFile.Write(aDes); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
393 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
394 |
else |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
395 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
396 |
// RDebug::Print(_L("CDiskWriterPlugin::WriteMemBufferToFile - data written, length %d"), aDes.Length()); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
397 |
// write to file with status |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
398 |
iFile.Write(aDes,aStatus); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
399 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
400 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
401 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
402 |
// check if error in write |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
403 |
if(err != KErrNone) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
404 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
405 |
// stop writer handler (and its timer) immediately, DO NOT try write data! |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
406 |
Cancel(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
407 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
408 |
// no reason to continue if disk full or removed |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
409 |
// end of stream detected, file can be closed |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
410 |
iFile.Close(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
411 |
// close handle to file server too |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
412 |
iFs.Close(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
413 |
iFileName.Zero(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
414 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
415 |
// set error status for engine to read |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
416 |
iWriter->HandleError(err); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
417 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
418 |
LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
419 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
420 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
421 |
void CDiskWriterHandler::WriteBufferToOutput(TBapBuf* aBuf) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
422 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
423 |
LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
424 |
iBufferBeingWritten = aBuf; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
425 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
426 |
// set the data length just to be sure |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
427 |
iBufferBeingWritten->iBufDes->SetLength(aBuf->iDataSize); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
428 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
429 |
LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - writing to file")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
430 |
WriteMemBufferToFile(*(iBufferBeingWritten->iBufDes), iStatus); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
431 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
432 |
// set AO back to active, until filled buffers are emptied |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
433 |
SetActive(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
434 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
435 |
LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
436 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
437 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
438 |
void CDiskWriterHandler::StartL() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
439 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
440 |
LOGTEXT(_L("CDiskWriterHandler::StartL - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
441 |
if(!IsActive()) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
442 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
443 |
LOGTEXT(_L("CDiskWriterHandler::StartL - is not active")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
444 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
445 |
TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
446 |
LOGSTRING2(_L("CDiskWriterHandler::StartL - got next filled 0x%x"),nextBuf); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
447 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
448 |
if(nextBuf != 0) |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
449 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
450 |
LOGTEXT(_L("CDiskWriterHandler::StartL - writing to file")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
451 |
WriteBufferToOutput(nextBuf); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
452 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
453 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
454 |
LOGTEXT(_L("CDiskWriterHandler::StartL - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
455 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
456 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
457 |
void CDiskWriterHandler::Stop() |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
458 |
{ |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
459 |
LOGTEXT(_L("CDiskWriterHandler::Stop - entry")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
460 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
461 |
// set to stopping mode, needed for emptying the remaining full buffers |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
462 |
iStopping = ETrue; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
463 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
464 |
// stop the timer |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
465 |
Reset(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
466 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
467 |
// end of stream detected, file can be closed |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
468 |
iFile.Close(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
469 |
// close handle to file server too |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
470 |
iFs.Close(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
471 |
iFileName.Zero(); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
472 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
473 |
// set mode back to non-stopping |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
474 |
iStopping = EFalse; |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
475 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
476 |
LOGTEXT(_L("CDiskWriterHandler::Stop - exit")); |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
477 |
} |
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
478 |
|
3ff3fecb12fe
Add initial version of PI Profiler under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
479 |
// end of file |