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-- |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
8 |
* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
11 |
* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
13 |
* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
15 |
* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
17 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
18 |
package com.nokia.carbide.cpp.pi.internal.perfcounters; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
19 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
20 |
import java.io.DataInputStream; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
21 |
import java.io.File; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
22 |
import java.io.FileInputStream; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
23 |
import java.io.FileNotFoundException; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
24 |
import java.io.IOException; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
25 |
import java.util.HashMap; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
26 |
import java.util.Map; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
27 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
28 |
import org.eclipse.jface.window.Window; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
29 |
import org.eclipse.swt.widgets.Display; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
30 |
import org.eclipse.ui.PlatformUI; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
31 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
32 |
import com.nokia.carbide.cpp.internal.pi.model.ParsedTraceData; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
33 |
import com.nokia.carbide.cpp.internal.pi.model.Parser; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
34 |
import com.nokia.carbide.cpp.pi.internal.perfcounters.ui.ProcessorSpeedInputDialog; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
35 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
36 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
37 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
38 |
* Parser for performance counter event traces in binary format. |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
39 |
* Converts parsed content into PecSamples. |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
40 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
41 |
public class PecTraceParser extends Parser { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
42 |
private static final int INSTRUCTIONS_EXECUTED = 0x7; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
43 |
private static final int CPU_CLOCK_TICK_DIV64 = 0xFFFF; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
44 |
private static final int DUMMY_MIPS_ID = -1; |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
45 |
private static final int DUMMY_CPU_CLOCK_ID = -2; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
46 |
private static final String DATA_FORMAT_VERSION_OLD = "Bappea_V1.24_PEC"; |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
47 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
48 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
49 |
private boolean debug = false; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
50 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
51 |
private long time = 0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
52 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
53 |
/** true if dialogs etc is allowed here, false for quiet mode */ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
54 |
private boolean allowUserInteraction; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
55 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
56 |
/** produce MIPS graph data */ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
57 |
protected boolean mipsEnabled; |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
58 |
/** the processor speed to use for MIPS graph calculations. Updated from data samples if data is available */ |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
59 |
protected int processorSpeed; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
60 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
61 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
62 |
* Constructor |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
63 |
* @param allowUserInteraction true, if user interactions such as dialogs are allowed |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
64 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
65 |
public PecTraceParser(boolean allowUserInteraction) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
66 |
super(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
67 |
this.allowUserInteraction = allowUserInteraction; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
68 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
69 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
70 |
private static final Map<Integer, String> EVENT_TYPE_TABLE = new HashMap<Integer, String>(); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
71 |
static { |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
72 |
EVENT_TYPE_TABLE.put(0x0,Messages.PecTraceParser_0); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
73 |
EVENT_TYPE_TABLE.put(0x1,Messages.PecTraceParser_1); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
74 |
EVENT_TYPE_TABLE.put(0x2,Messages.PecTraceParser_2); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
75 |
EVENT_TYPE_TABLE.put(0x3,Messages.PecTraceParser_3); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
76 |
EVENT_TYPE_TABLE.put(0x4, Messages.PecTraceParser_4); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
77 |
EVENT_TYPE_TABLE.put(0x5, Messages.PecTraceParser_5); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
78 |
EVENT_TYPE_TABLE.put(0x6, Messages.PecTraceParser_6); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
79 |
EVENT_TYPE_TABLE.put(INSTRUCTIONS_EXECUTED, Messages.PecTraceParser_7); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
80 |
EVENT_TYPE_TABLE.put(0x9, Messages.PecTraceParser_8); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
81 |
EVENT_TYPE_TABLE.put(0xA, Messages.PecTraceParser_9); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
82 |
EVENT_TYPE_TABLE.put(0xB, Messages.PecTraceParser_10); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
83 |
EVENT_TYPE_TABLE.put(0xC, Messages.PecTraceParser_11); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
84 |
EVENT_TYPE_TABLE.put(0xD, Messages.PecTraceParser_12); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
85 |
EVENT_TYPE_TABLE.put(0xF, Messages.PecTraceParser_13); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
86 |
EVENT_TYPE_TABLE.put(0x10, Messages.PecTraceParser_14); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
87 |
EVENT_TYPE_TABLE.put(0x11, Messages.PecTraceParser_15); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
88 |
EVENT_TYPE_TABLE.put(0x12, Messages.PecTraceParser_16); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
89 |
EVENT_TYPE_TABLE.put(0x20, Messages.PecTraceParser_17); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
90 |
EVENT_TYPE_TABLE.put(0x21, Messages.PecTraceParser_18); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
91 |
EVENT_TYPE_TABLE.put(0x22, Messages.PecTraceParser_19); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
92 |
EVENT_TYPE_TABLE.put(0xFF, Messages.PecTraceParser_20); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
93 |
EVENT_TYPE_TABLE.put(CPU_CLOCK_TICK_DIV64, Messages.PecTraceParser_21); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
94 |
EVENT_TYPE_TABLE.put(DUMMY_MIPS_ID, PecTrace.MIPS_NAME); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
95 |
EVENT_TYPE_TABLE.put(DUMMY_CPU_CLOCK_ID, Messages.PecTraceParser_23); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
96 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
97 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
98 |
/* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
99 |
* @see com.nokia.carbide.cpp.internal.pi.model.Parser#parse(java.io.File) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
100 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
101 |
@Override |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
102 |
public ParsedTraceData parse(File file) throws FileNotFoundException |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
103 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
104 |
ParsedTraceData ptd = new ParsedTraceData(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
105 |
ptd.functionResolvers = null; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
106 |
ptd.staticData = null; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
107 |
PecTrace pecTrace = new PecTrace(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
108 |
ptd.traceData = pecTrace; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
109 |
doParsing(file, pecTrace); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
110 |
time = 0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
111 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
112 |
return ptd; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
113 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
114 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
115 |
private void doParsing(File f, PecTrace trace) throws FileNotFoundException |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
116 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
117 |
DataInputStream dis = new DataInputStream(new FileInputStream(f)); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
118 |
try |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
119 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
120 |
int len = dis.readByte(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
121 |
byte[] versionString = new byte[len]; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
122 |
dis.read(versionString); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
123 |
this.traceVersion = new String(versionString); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
124 |
if(debug)System.out.println("PEC trace version:"+this.traceVersion); //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
125 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
126 |
int firstData = dis.readUnsignedByte(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
127 |
int secondData = dis.readUnsignedByte(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
128 |
int thirdData = CPU_CLOCK_TICK_DIV64; |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
129 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
130 |
if (this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
131 |
if (allowUserInteraction && (firstData == INSTRUCTIONS_EXECUTED || secondData == INSTRUCTIONS_EXECUTED)){ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
132 |
Display.getDefault().syncExec( new Runnable() { |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
133 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
134 |
public void run () { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
135 |
// in future, if we don't want to have a dialog in the core parser class |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
136 |
// we could call into an interface which ProcessorSpeedInputDialog would have to implement |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
137 |
ProcessorSpeedInputDialog dialog = new ProcessorSpeedInputDialog( |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
138 |
PlatformUI.getWorkbench() |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
139 |
.getActiveWorkbenchWindow().getShell()); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
140 |
if (dialog.open() == Window.OK){ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
141 |
processorSpeed = dialog.getIntValue(); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
142 |
mipsEnabled = true; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
143 |
} |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
144 |
} |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
145 |
}); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
146 |
} |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
147 |
} |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
148 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
149 |
// >=Bappea_V1.25_PEC |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
150 |
else { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
151 |
if (firstData == INSTRUCTIONS_EXECUTED || secondData == INSTRUCTIONS_EXECUTED) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
152 |
mipsEnabled = true; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
153 |
} |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
154 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
155 |
long cpuClockRate = readCpuClockRate(dis); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
156 |
if(cpuClockRate > 0){ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
157 |
// Hz => MHz |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
158 |
trace.setCpuClockRate((int) cpuClockRate / 1000000); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
159 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
160 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
161 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
162 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
163 |
int graphCount = 0; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
164 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
165 |
if (this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
166 |
graphCount = 4; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
167 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
168 |
// >=Bappea_V1.25_PEC |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
169 |
else { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
170 |
graphCount = 5; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
171 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
172 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
173 |
Integer[] valueTypeVector = new Integer[mipsEnabled ? graphCount : 3]; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
174 |
|
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
175 |
valueTypeVector[0] = Integer.valueOf(firstData); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
176 |
valueTypeVector[1] = Integer.valueOf(secondData); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
177 |
// this type is always the cpu clock tick div 64 |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
178 |
valueTypeVector[2] = Integer.valueOf(thirdData); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
179 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
180 |
if (mipsEnabled){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
181 |
valueTypeVector[3] = DUMMY_MIPS_ID; |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
182 |
// >=Bappea_V1.25_PEC |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
183 |
if (!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
184 |
{ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
185 |
valueTypeVector[4] = DUMMY_CPU_CLOCK_ID; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
186 |
} |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
187 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
188 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
189 |
trace.setValueTypes(this.parseValueTypes(valueTypeVector)); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
190 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
191 |
PecSample s = null; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
192 |
while(true) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
193 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
194 |
s = readSample(dis,s); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
195 |
trace.addSample(s); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
196 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
197 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
198 |
catch (IOException ioe) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
199 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
200 |
//TODO: should we log this or handle it? |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
201 |
//my guess is this signifies the end of file |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
202 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
203 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
204 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
205 |
private PecSample readSample(DataInputStream dis,PecSample prevSample) throws IOException |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
206 |
{ |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
207 |
int headerByte = 0; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
208 |
int negBitOffset = 0; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
209 |
int sampleBitOffset = 0; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
210 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
211 |
if (this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
212 |
headerByte = (dis.readByte() << 24) >>> 24; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
213 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
214 |
// >=Bappea_V1.25_PEC |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
215 |
else { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
216 |
int headerByte1 = (dis.readByte() << 24) >>> 24; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
217 |
int headerByte2 = (dis.readByte() << 24) >>> 24; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
218 |
headerByte = ((headerByte1) | (headerByte2) << 8); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
219 |
negBitOffset = 1; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
220 |
sampleBitOffset = 2; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
221 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
222 |
|
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
223 |
int neg0 = 0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
224 |
int neg1 = 0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
225 |
int neg2 = 0; |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
226 |
int neg3 = 0; |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
227 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
228 |
int prev0 = 0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
229 |
int prev1 = 0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
230 |
int prev2 = 0; |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
231 |
int prev3 = 0; |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
232 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
233 |
if(prevSample != null) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
234 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
235 |
prev0 = prevSample.values[0]; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
236 |
prev1 = prevSample.values[1]; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
237 |
prev2 = prevSample.values[2]/64; |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
238 |
prev3 = processorSpeed; |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
239 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
240 |
if(debug) if(this.time > 7820 && this.time < 7830) System.out.println("header: "+Long.toHexString(headerByte)+" = "+Integer.toBinaryString(headerByte)); //$NON-NLS-1$//$NON-NLS-2$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
241 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
242 |
if( ((headerByte >>> 7 + negBitOffset + sampleBitOffset)&1) != 0) |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
243 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
244 |
neg0 = 1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
245 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
246 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
247 |
if( ((headerByte >>> 6 + negBitOffset + sampleBitOffset)&1) != 0) |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
248 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
249 |
neg1 = 1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
250 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
251 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
252 |
if( ((headerByte >>> 5 + negBitOffset + sampleBitOffset)&1) != 0) |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
253 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
254 |
neg2 = 1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
255 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
256 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
257 |
// >=Bappea_V1.25_PEC |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
258 |
if(!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD) && ((headerByte >>> 7)&1) != 0) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
259 |
neg3 = 1; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
260 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
261 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
262 |
int len0 = (((headerByte >> 3 + sampleBitOffset) << 30) >>> 30)+1; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
263 |
int len1 = (((headerByte >> 1 + sampleBitOffset) << 30) >>> 30)+1; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
264 |
int len2 = ((((headerByte >> sampleBitOffset) << 31) >>> 31)+1)*2; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
265 |
int len3 = -1; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
266 |
// >=Bappea_V1.25_PEC |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
267 |
if(!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
268 |
len3 = ((((headerByte) << 30) >>> 30)+1); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
269 |
} |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
270 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
271 |
if(debug) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
272 |
if(!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
273 |
if(debug) if(this.time > 7820 && this.time < 7830) System.out.println("T:"+this.time+" len0:"+len0+" len1:"+len1+" len2:"+len2+" len3:"+len3); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
274 |
if(debug) if(this.time > 7900 && this.time < 7900) System.out.println("H: "+Integer.toBinaryString(headerByte)+" N0:"+neg0+" N1:"+neg1+" N2:"+neg2+" N3:"+neg3); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
275 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
276 |
} else { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
277 |
if(debug) if(this.time > 7820 && this.time < 7830) System.out.println("T:"+this.time+" len0:"+len0+" len1:"+len1+" len2:"+len2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
278 |
if(debug) if(this.time > 7900 && this.time < 7900) System.out.println("H: "+Integer.toBinaryString(headerByte)+" N0:"+neg0+" N1:"+neg1+" N2:"+neg2); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
279 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
280 |
} |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
281 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
282 |
long val0 = readVal(neg0,len0,dis); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
283 |
long val1 = readVal(neg1,len1,dis); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
284 |
long val2 = readVal(neg2,len2,dis); |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
285 |
long val3 = -1; |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
286 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
287 |
// >=Bappea_V1.25_PEC |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
288 |
if(!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
289 |
if (mipsEnabled) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
290 |
val3 = readVal(neg3,len3,dis); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
291 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
292 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
293 |
|
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
294 |
if(debug) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
295 |
if(!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
296 |
if(this.time > 7820 && this.time < 7900) System.out.println("READ T:"+this.time+" V0:"+Long.toHexString(val0)+" V1:"+Long.toHexString(val1)+" V2:"+Long.toHexString(val2)+" V3:"+Long.toHexString(val3)); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
297 |
} else { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
298 |
if(this.time > 7820 && this.time < 7900) System.out.println("READ T:"+this.time+" V0:"+Long.toHexString(val0)+" V1:"+Long.toHexString(val1)+" V2:"+Long.toHexString(val2)); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
299 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
300 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
301 |
|
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
302 |
val0 = prev0-val0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
303 |
val1 = prev1-val1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
304 |
val2 = prev2-val2; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
305 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
306 |
// >=Bappea_V1.25_PEC |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
307 |
if(!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
308 |
val3 = prev3-val3; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
309 |
processorSpeed = (int)val3; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
310 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
311 |
|
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
312 |
int[] values; |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
313 |
if (!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD) && mipsEnabled) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
314 |
values = new int[]{(int)val0,(int)val1,((int)val2)*64, (int)((val3 / 1000000) * val1 / (val2*64)), ((int)(val3 / 1000000))}; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
315 |
} else if (mipsEnabled) { |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
316 |
values = new int[]{(int)val0,(int)val1,((int)val2)*64, (int)(processorSpeed * val1 / (val2*64))}; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
317 |
} else { |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
318 |
values = new int[]{(int)val0,(int)val1,((int)val2)*64}; |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
319 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
320 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
321 |
PecSample ps = new PecSample(values, this.time); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
322 |
|
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
323 |
if (debug) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
324 |
if(!this.traceVersion.equals(DATA_FORMAT_VERSION_OLD)) { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
325 |
if(this.time > 7820 && this.time < 7900) System.out.println("T:"+this.time+" V0:"+Long.toHexString(val0)+" V1:"+Long.toHexString(val1)+" V2:"+Long.toHexString(val2)+" V3:"+Long.toHexString(val3)); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
326 |
if(this.time > 7820 && this.time < 7900) System.out.println("T:"+this.time+" "+val0+" "+val1+" "+val2+" "+val3); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4//$NON-NLS-5$$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
327 |
} else { |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
328 |
if(this.time > 7820 && this.time < 7900) System.out.println("T:"+this.time+" V0:"+Long.toHexString(val0)+" V1:"+Long.toHexString(val1)+" V2:"+Long.toHexString(val2)); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
329 |
if(this.time > 7820 && this.time < 7900) System.out.println("T:"+this.time+" "+val0+" "+val1+" "+val2); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
330 |
} |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
331 |
} |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
332 |
this.time++; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
333 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
334 |
return ps; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
335 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
336 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
337 |
private long readVal(int neg,int len,DataInputStream dis) throws IOException |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
338 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
339 |
byte[] array = new byte[len]; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
340 |
dis.read(array); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
341 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
342 |
if(debug) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
343 |
for(int k=0;k<array.length;k++) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
344 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
345 |
if(this.time > 7820 && this.time < 7900) System.out.println(" "+Integer.toHexString(array[k])); //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
346 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
347 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
348 |
long total = 0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
349 |
for(int i=0;i<len;i++) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
350 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
351 |
int value = ((array[i] << 24) >>> 24) << (i*8); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
352 |
total |= value; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
353 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
354 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
355 |
if(debug) if(this.time > 7820 && this.time < 7900) System.out.println("\n"+Long.toHexString(total)); //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
356 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
357 |
if(debug) if(this.time > 7820 && this.time < 7900) System.out.println("T:"+this.time+" "+Long.toHexString(total)); //$NON-NLS-1$//$NON-NLS-2$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
358 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
359 |
if(neg != 0) total = ~total; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
360 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
361 |
return total; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
362 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
363 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
364 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
365 |
* Converts the given event type identifiers into the appropriate event type strings. |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
366 |
* @param valueTypeIntegers list of event type identifiers |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
367 |
* @return String[] of event type strings |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
368 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
369 |
private String[] parseValueTypes(Integer[] valueTypeIntegers){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
370 |
String[] s = new String[valueTypeIntegers.length]; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
371 |
for (int i = 0; i < valueTypeIntegers.length; i++) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
372 |
s[i] = convertValueType(valueTypeIntegers[i]); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
373 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
374 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
375 |
return s; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
376 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
377 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
378 |
private String convertValueType(int value) { |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
379 |
String s = EVENT_TYPE_TABLE.get(Integer.valueOf(value)); |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
380 |
if (s == null){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
381 |
s = String.format( |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
382 |
Messages.PecTraceParser_22, |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
383 |
value); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
384 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
385 |
return s; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
386 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
387 |
} |
12
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
388 |
private long readCpuClockRate(DataInputStream dis) throws IOException |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
389 |
{ |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
390 |
long result = dis.readUnsignedByte(); |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
391 |
result += dis.readUnsignedByte() << 8; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
392 |
result += dis.readUnsignedByte() << 16; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
393 |
result += dis.readUnsignedByte() << 24; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
394 |
return result; |
ae255c9aa552
Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
5
diff
changeset
|
395 |
} |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
396 |
} |