author | Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com> |
Wed, 23 Jun 2010 15:05:09 +0300 | |
changeset 12 | ae255c9aa552 |
parent 5 | 844b047e260d |
permissions | -rw-r--r-- |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
8 |
* |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
11 |
* |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
13 |
* |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
15 |
* |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
17 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
18 |
package com.nokia.carbide.cpp.internal.pi.analyser; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
19 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
20 |
import java.util.ArrayList; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
21 |
import java.util.HashMap; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
22 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
23 |
import org.eclipse.core.runtime.IStatus; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
24 |
import org.eclipse.swt.widgets.Composite; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
25 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
26 |
import com.nokia.carbide.cpp.internal.pi.manager.PluginRegisterer; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
27 |
import com.nokia.carbide.cpp.internal.pi.model.GenericTrace; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
28 |
import com.nokia.carbide.cpp.internal.pi.model.TraceDataRepository; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
29 |
import com.nokia.carbide.cpp.internal.pi.plugin.model.AbstractPiPlugin; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
30 |
import com.nokia.carbide.cpp.internal.pi.test.AnalysisInfoHandler; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
31 |
import com.nokia.carbide.cpp.pi.util.GeneralMessages; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
32 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
33 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
34 |
/* |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
35 |
* Try to encapsulate data related to each opened NPI file (e.g. AnalysTab and NPI related data) |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
36 |
* in one centralized location, instead of tossing around classes within UI/processing code |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
37 |
*/ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
38 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
39 |
public class NpiInstanceRepository { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
40 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
41 |
static public final int DISPOSED_UID = -1; |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
42 |
/** Constant for maximum number of CPUs in an SMP system */ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
43 |
public static final int MAX_CPU_COUNT = 4; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
44 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
45 |
/** Constant for persisting the state of Show Combined CPU View in the Address plugin */ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
46 |
public static final String PERSISTED_SHOW_COMBINED_CPU_VIEW = "com.nokia.carbide.cpp.pi.address.showCombinedCPUView";//$NON-NLS-1$ |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
47 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
48 |
private class UidObject { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
49 |
// this is just for generating UID |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
50 |
}; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
51 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
52 |
static private NpiInstanceRepository instance; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
53 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
54 |
// the UID of current UI |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
55 |
private static int activeInstance; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
56 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
57 |
// all these maps are maintained by UID of instances |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
58 |
private static HashMap<Integer, UidObject> uidObjectMap = new HashMap<Integer, UidObject>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
59 |
private static HashMap<Integer, HashMap<String,GenericTrace>> traceCollectionMap = new HashMap<Integer, HashMap<String,GenericTrace>>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
60 |
private static HashMap<Integer, HashMap<String,Object>> persistCollectionMap = new HashMap<Integer, HashMap<String,Object>>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
61 |
private static HashMap<Integer, ArrayList<AbstractPiPlugin>> pluginListMap = new HashMap<Integer, ArrayList<AbstractPiPlugin>>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
62 |
private static HashMap<Integer, ArrayList<ProfileVisualiser>> profilePagesMap = new HashMap<Integer, ArrayList<ProfileVisualiser>>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
63 |
private static HashMap<Integer, Composite> parentCompositeMap = new HashMap<Integer, Composite>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
64 |
private static HashMap<Integer, AnalysisInfoHandler> analysisInfoHandlerMap = new HashMap<Integer, AnalysisInfoHandler>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
65 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
66 |
private NpiInstanceRepository() { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
67 |
// singleton |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
68 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
69 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
70 |
public static NpiInstanceRepository getInstance() { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
71 |
if (instance == null) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
72 |
instance = new NpiInstanceRepository(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
73 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
74 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
75 |
return instance; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
76 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
77 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
78 |
public int register(Composite composite) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
79 |
UidObject uidObject = new UidObject(); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
80 |
Integer uid = Integer.valueOf(uidObject.hashCode()); |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
81 |
uidObjectMap.put(uid, uidObject); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
82 |
HashMap<String,GenericTrace> traceCollection = new HashMap<String,GenericTrace>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
83 |
traceCollectionMap.put(uid, traceCollection); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
84 |
HashMap<String,Object> persistCollection = new HashMap<String,Object>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
85 |
persistCollectionMap.put(uid, persistCollection); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
86 |
ArrayList<AbstractPiPlugin> pluginList = new ArrayList<AbstractPiPlugin>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
87 |
pluginListMap.put(uid, pluginList); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
88 |
ArrayList<ProfileVisualiser> profilePages = new ArrayList<ProfileVisualiser>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
89 |
profilePagesMap.put(uid, profilePages); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
90 |
parentCompositeMap.put(uid, composite); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
91 |
AnalysisInfoHandler analysisInfoHandler = new AnalysisInfoHandler(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
92 |
analysisInfoHandlerMap.put(uid, analysisInfoHandler); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
93 |
TraceDataRepository.getInstance().registerTraces(uid.intValue()); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
94 |
PluginRegisterer.registerAllPlugins(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
95 |
switchActiveUid(uid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
96 |
return uid; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
97 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
98 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
99 |
public void unregister(int instanceUid) { |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
100 |
Integer uidInteger = Integer.valueOf(instanceUid); |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
101 |
uidObjectMap.remove(uidInteger); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
102 |
HashMap<String,GenericTrace> traceCollection = traceCollectionMap.get(uidInteger); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
103 |
if (traceCollection != null){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
104 |
traceCollection.clear(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
105 |
traceCollectionMap.remove(uidInteger); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
106 |
} |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
107 |
HashMap<String,Object> persistCollection = persistCollectionMap.get(uidInteger); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
108 |
if (persistCollection != null){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
109 |
persistCollection.clear(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
110 |
persistCollectionMap.remove(uidInteger); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
111 |
} |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
112 |
ArrayList<AbstractPiPlugin> pluginList = pluginListMap.get(uidInteger); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
113 |
if (pluginList != null){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
114 |
pluginList.clear(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
115 |
pluginListMap.remove(uidInteger); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
116 |
} |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
117 |
ArrayList<ProfileVisualiser> profilePages = profilePagesMap.get(uidInteger); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
118 |
if (profilePages != null){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
119 |
profilePages.clear(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
120 |
profilePagesMap.remove(uidInteger); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
121 |
} |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
122 |
parentCompositeMap.remove(uidInteger); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
123 |
analysisInfoHandlerMap.remove(uidInteger); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
124 |
TraceDataRepository.getInstance().removeTraces(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
125 |
// In general it's a good idea to keep memory footprint low |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
126 |
System.runFinalization(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
127 |
System.gc(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
128 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
129 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
130 |
public int size() { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
131 |
return uidObjectMap.size(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
132 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
133 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
134 |
public void setParentComposite(int instanceUid, Composite parent) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
135 |
parentCompositeMap.remove(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
136 |
parentCompositeMap.put(instanceUid, parent); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
137 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
138 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
139 |
public void activeUidAddTrace(String className, GenericTrace trace) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
140 |
int instanceUid = activeUid(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
141 |
instance.addTrace(instanceUid, className, trace); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
142 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
143 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
144 |
private void addTrace(int instanceUid, String className, GenericTrace trace) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
145 |
HashMap<String,GenericTrace> newEntry = traceCollectionMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
146 |
newEntry.put(className + ".trace", trace); //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
147 |
traceCollectionMap.put(instanceUid, newEntry); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
148 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
149 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
150 |
public GenericTrace activeUidGetTrace(String className) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
151 |
int instanceUid = activeUid(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
152 |
return getTrace(instanceUid, className); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
153 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
154 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
155 |
private GenericTrace getTrace(int instanceUid, String className) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
156 |
HashMap<String,GenericTrace> entry = traceCollectionMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
157 |
assertLog(entry != null, Messages.getString("NpiInstanceRepository.0") + instanceUid); //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
158 |
if (entry == null) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
159 |
entry = new HashMap<String,GenericTrace>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
160 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
161 |
return entry.get(className + ".trace"); //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
162 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
163 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
164 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
165 |
public void activeUidRemoveTrace(String className) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
166 |
int instanceUid = activeUid(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
167 |
removeTrace(instanceUid, className); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
168 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
169 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
170 |
private void removeTrace(int instanceUid, String className) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
171 |
HashMap<String,GenericTrace> entry = traceCollectionMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
172 |
// if we don't have any opened NPI, the active one == disposed and trace will be |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
173 |
// harmlessly removed one more time upon exit |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
174 |
if (instanceUid != DISPOSED_UID) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
175 |
assertLog(entry != null, Messages.getString("NpiInstanceRepository.1") + instanceUid); //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
176 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
177 |
if (entry == null) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
178 |
return; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
179 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
180 |
entry.remove(className); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
181 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
182 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
183 |
public void switchActiveUid(int instanceUid) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
184 |
activeInstance = instanceUid; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
185 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
186 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
187 |
public int activeUid() { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
188 |
return activeInstance; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
189 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
190 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
191 |
// return array list of this tab's plugins |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
192 |
public ArrayList<AbstractPiPlugin> getPlugins(int instanceUid) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
193 |
ArrayList<AbstractPiPlugin> pluginList = pluginListMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
194 |
assertLog(pluginList != null, Messages.getString("NpiInstanceRepository.2") + instanceUid); //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
195 |
if (pluginList == null) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
196 |
pluginList = new ArrayList<AbstractPiPlugin>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
197 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
198 |
return pluginList; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
199 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
200 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
201 |
// add the plugin to this tab's list |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
202 |
public void addPlugin(int instanceUid, AbstractPiPlugin plugin) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
203 |
ArrayList<AbstractPiPlugin> pluginList = pluginListMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
204 |
assertLog(pluginList != null, Messages.getString("NpiInstanceRepository.3") + instanceUid); //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
205 |
if (pluginList != null && !pluginList.contains(plugin)) |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
206 |
pluginList.add(plugin); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
207 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
208 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
209 |
// return array list of this tab's pages |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
210 |
public ArrayList<ProfileVisualiser> activeUidGetProfilePages() { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
211 |
int instanceUid = activeUid(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
212 |
return getProfilePages(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
213 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
214 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
215 |
// return array list of this tab's pages |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
216 |
private ArrayList<ProfileVisualiser> getProfilePages(int instanceUid) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
217 |
ArrayList<ProfileVisualiser> pages = profilePagesMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
218 |
assertLog(pages != null, Messages.getString("NpiInstanceRepository.4") + instanceUid); //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
219 |
if (pages == null) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
220 |
pages = new ArrayList<ProfileVisualiser>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
221 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
222 |
return pages; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
223 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
224 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
225 |
// return a particular page |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
226 |
public ProfileVisualiser getProfilePage(int instanceUid, int index) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
227 |
ArrayList<ProfileVisualiser> pages = profilePagesMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
228 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
229 |
assertLog(pages != null, Messages.getString("NpiInstanceRepository.5") + instanceUid); //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
230 |
if (pages == null) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
231 |
pages = new ArrayList<ProfileVisualiser>(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
232 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
233 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
234 |
ProfileVisualiser visualizer; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
235 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
236 |
try { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
237 |
visualizer = pages.get(index); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
238 |
} catch (IndexOutOfBoundsException e) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
239 |
return null; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
240 |
} catch (Exception e) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
241 |
return null; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
242 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
243 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
244 |
return visualizer; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
245 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
246 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
247 |
public Composite activeUidGetParentComposite() { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
248 |
int instanceUid = activeUid(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
249 |
Composite parent = parentCompositeMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
250 |
return parent; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
251 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
252 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
253 |
public AnalysisInfoHandler activeUidGetAnalysisInfoHandler() { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
254 |
int instanceUid = activeUid(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
255 |
return getAnalysisInfoHandler(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
256 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
257 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
258 |
public AnalysisInfoHandler getAnalysisInfoHandler(int instanceUid) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
259 |
return analysisInfoHandlerMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
260 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
261 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
262 |
public void activeUidSetPersistState (String key, Object state) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
263 |
int instanceUid = activeUid(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
264 |
setPersistState(instanceUid, key, state); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
265 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
266 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
267 |
public void setPersistState (int instanceUid, String key, Object state) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
268 |
HashMap<String, Object> entry = persistCollectionMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
269 |
entry.put(key, state); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
270 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
271 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
272 |
private Object getPersistDefault (String key) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
273 |
if (key.equals("com.nokia.carbide.cpp.pi.address.thresholdCountThread") || //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
274 |
key.equals("com.nokia.carbide.cpp.pi.address.thresholdCountBinary") || //$NON-NLS-1$ |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
275 |
key.equals("com.nokia.carbide.cpp.pi.address.thresholdCountFunction") ) { //$NON-NLS-1$ |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
276 |
return Integer.valueOf(-1); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
277 |
} else if (key.equals("com.nokia.carbide.cpp.pi.address.thresholdLoadThread") || //$NON-NLS-1$ |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
278 |
key.equals("com.nokia.carbide.cpp.pi.address.thresholdLoadBinary")) { //$NON-NLS-1$ |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
279 |
return Double.valueOf(0.001); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
280 |
} else if (key.equals("com.nokia.carbide.cpp.pi.address.thresholdLoadFunction")) { //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
281 |
return Double.valueOf(0.0001); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
282 |
} else if (key.equals("com.nokia.carbide.cpp.pi.address.useOnlyThreadThresholds")) { //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
283 |
return Boolean.FALSE; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
284 |
} else if (key.equals(PERSISTED_SHOW_COMBINED_CPU_VIEW)){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
2
diff
changeset
|
285 |
return Boolean.TRUE; |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
286 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
287 |
return null; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
288 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
289 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
290 |
public Object activeUidGetPersistState (String key) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
291 |
int instanceUid = activeUid(); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
292 |
return getPersistState(instanceUid, key); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
293 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
294 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
295 |
public Object getPersistState (int instanceUid, String key) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
296 |
HashMap<String, Object> entry = persistCollectionMap.get(instanceUid); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
297 |
Object object = entry.get(key); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
298 |
if (object != null) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
299 |
return object; |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
300 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
301 |
return getPersistDefault(key); |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
302 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
303 |
|
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
304 |
private void assertLog(boolean cond, String message) { |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
305 |
if (!cond) { |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
306 |
GeneralMessages.piLog(message, IStatus.ERROR); |
2
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
307 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
308 |
} |
b9ab3b238396
Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
309 |
} |