sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.ipc/src/com/nokia/carbide/cpp/pi/internal/ipc/IpcTraceParser.java
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--
Performance Investigator Carbide extension 2.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.ipc;
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.ArrayList;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    26
import java.util.HashMap;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    27
import java.util.List;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    28
import java.util.Map;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    29
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    30
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
    31
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
    32
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    33
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    34
/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    35
 * 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
    36
 * Converts parsed content into IpcSamples.
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
public class IpcTraceParser extends Parser {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    39
	private static final String IPC_EVENT_NOT_RECOGNISED = Messages.IpcTraceParser_0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    40
	private static final int MAX_IPC_EVENTS_TRACED = 14; //2 IPC events * 5 possible values + 4 optional L2 counter values
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    41
	private static final int MAX_IPC_NO_L2_EVENTS_TRACED = 10; //2 IPC events * 5 possible values
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    42
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    43
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    44
	//private static 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
    45
	private boolean debug = false; //CH: this could be replaced with Eclipse-style logging
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    46
	private boolean l2Enabled = false;
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
	long time = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    49
	
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    50
	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
    51
	static {
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    52
		EVENT_TYPE_TABLE.put(0x0,Messages.IpcTraceParser_1);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    53
		EVENT_TYPE_TABLE.put(0x1,Messages.IpcTraceParser_2);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    54
		EVENT_TYPE_TABLE.put(0x2,Messages.IpcTraceParser_3);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    55
		EVENT_TYPE_TABLE.put(0x3,Messages.IpcTraceParser_4);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    56
		EVENT_TYPE_TABLE.put(0x4,Messages.IpcTraceParser_5);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    57
	}
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    58
	private static final Map<Integer, String> COUNTER_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
    59
	static {
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    60
		COUNTER_TYPE_TABLE.put(0x0,Messages.IpcTraceParser_6);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    61
		COUNTER_TYPE_TABLE.put(0x1,Messages.IpcTraceParser_7);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    62
		COUNTER_TYPE_TABLE.put(0x2,Messages.IpcTraceParser_8);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    63
		COUNTER_TYPE_TABLE.put(0x3,Messages.IpcTraceParser_9);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    64
		COUNTER_TYPE_TABLE.put(0x4,Messages.IpcTraceParser_10);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    65
		COUNTER_TYPE_TABLE.put(0x5,Messages.IpcTraceParser_11);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    66
	}	
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    67
	private static final Map<Integer, String> L2_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
    68
	static {
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    69
		L2_EVENT_TYPE_TABLE.put(0x3,Messages.IpcTraceParser_12);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    70
		L2_EVENT_TYPE_TABLE.put(0x4,Messages.IpcTraceParser_13);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    71
		L2_EVENT_TYPE_TABLE.put(0x5,Messages.IpcTraceParser_14);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    72
		L2_EVENT_TYPE_TABLE.put(0x6,Messages.IpcTraceParser_15);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    73
		L2_EVENT_TYPE_TABLE.put(0x7,Messages.IpcTraceParser_16);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    74
		L2_EVENT_TYPE_TABLE.put(0xC,Messages.IpcTraceParser_17);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    75
		L2_EVENT_TYPE_TABLE.put(0xD,Messages.IpcTraceParser_18);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    76
	}			
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    77
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    78
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    79
	 * @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
    80
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    81
	@Override
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    82
	public ParsedTraceData parse(File file) throws Exception 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    83
	{
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    84
		ParsedTraceData ptd = new ParsedTraceData();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    85
		ptd.functionResolvers = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    86
		ptd.staticData = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    87
		ptd.traceData = new IpcTrace();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    88
		doParsing(file,(IpcTrace)ptd.traceData);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    89
		time = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    90
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    91
		return ptd;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    92
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    93
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    94
	private void doParsing(File f, IpcTrace trace) throws FileNotFoundException
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    95
 {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    96
		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
    97
		try {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    98
			int len = dis.readByte();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    99
			byte[] versionString = new byte[len];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   100
			dis.read(versionString);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   101
			this.traceVersion = new String(versionString);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   102
			if (debug){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   103
				System.out.println("IPC 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
   104
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   105
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   106
			List<Integer> counterTypes = new ArrayList<Integer>();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   107
			List<Integer> counterL2Types = new ArrayList<Integer>();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   108
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   109
			// IPC counters
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   110
			int firstCounter = dis.readUnsignedByte();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   111
			counterTypes.add(firstCounter);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   112
			int secondCounter = dis.readUnsignedByte();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   113
			counterTypes.add(secondCounter);
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
			// 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
   116
			// int thirdData = CPU_CLOCK_TICK_DIV64;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   117
			// valueTypeVector.add(new Integer(thirdData));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   118
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   119
			if (dis.readUnsignedByte() != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   120
				// L2 counters, add if available
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   121
				int thirdCounter = dis.readUnsignedByte();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   122
				counterL2Types.add(thirdCounter);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   123
				int fourthCounter = dis.readUnsignedByte();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   124
				counterL2Types.add(fourthCounter);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   125
				int fifthCounter = dis.readUnsignedByte();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   126
				counterL2Types.add(fifthCounter);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   127
				int sixthCounter = dis.readUnsignedByte();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   128
				counterL2Types.add(sixthCounter);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   129
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   130
				trace.setValueTypes(this.parseValueTypes(counterTypes, counterL2Types));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   131
			} else {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   132
				trace.setValueTypes(this.parseValueTypes(counterTypes, null));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   133
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   134
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   135
			// System.out.println("IPC first "+firstCounter+" second "+secondCounter);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   136
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   137
			IpcSample s = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   138
			while (true) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   139
				s = readSample(dis, s);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   140
				// System.out.println(this.time+" "+Long.toHexString(s.values[0])+" "+Long.toHexString(s.values[1])+" "+Long.toHexString(s.values[2]));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   141
				trace.addSample(s);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   142
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   143
		} catch (IOException ioe) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   144
			// CH: is this just caught for end-of-file condition?
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   145
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   146
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   147
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   148
	private IpcSample readSample(DataInputStream dis, IpcSample prevSample)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   149
			throws IOException {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   150
		// int headerByte = (dis.readInt()); // << 24) >>> 24;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   151
		int headerByte1 = (dis.readByte() << 24) >>> 24;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   152
		int headerByte2 = (dis.readByte() << 24) >>> 24;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   153
		int headerByte3 = (dis.readByte() << 24) >>> 24;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   154
		int headerByte4 = (dis.readByte() << 24) >>> 24;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   155
		int headerByte = ((((headerByte1) | (headerByte2) << 8) | (headerByte3) << 16) | headerByte4 << 24);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   156
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   157
		int headerByte11 = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   158
		int headerByte12 = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   159
		int headerByteL2 = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   160
		// int j = ((headerByte >>> 30)&1);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   161
		if (((headerByte >>> 30) & 1) != 0 || l2Enabled) // flag bit in trace =>
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   162
															// L2 trace included
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   163
		{
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   164
			l2Enabled = true;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   165
			headerByte11 = (dis.readByte() << 24) >>> 24;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   166
			headerByte12 = (dis.readByte() << 24) >>> 24; // overflow bits
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   167
			headerByteL2 = ((headerByte11) | ((headerByte12) << 8));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   168
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   169
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   170
		int eventNumber = l2Enabled ? MAX_IPC_EVENTS_TRACED
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   171
				: MAX_IPC_NO_L2_EVENTS_TRACED;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   172
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   173
		int[] neg = new int[eventNumber];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   174
		int[] prev = new int[eventNumber];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   175
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   176
		if (prevSample != null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   177
			prev[0] = prevSample.values[0];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   178
			prev[1] = prevSample.values[1];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   179
			prev[2] = prevSample.values[2];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   180
			prev[3] = prevSample.values[3];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   181
			prev[4] = prevSample.values[4];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   182
			prev[5] = prevSample.values[5];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   183
			prev[6] = prevSample.values[6];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   184
			prev[7] = prevSample.values[7];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   185
			prev[8] = prevSample.values[8];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   186
			prev[9] = prevSample.values[9];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   187
			if (l2Enabled) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   188
				prev[10] = prevSample.values[10];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   189
				prev[11] = prevSample.values[11];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   190
				prev[12] = prevSample.values[12];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   191
				prev[13] = prevSample.values[13];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   192
			}
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
		// /*if(debug) if(this.time > 7820 && this.time < 7830)*/
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   195
		// System.out.println("header: "+Long.toHexString(headerByte)+" = "+Integer.toBinaryString(headerByte));
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
		if (((headerByte >>> 29) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   198
			neg[0] = 1;
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
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   201
		if (((headerByte >>> 28) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   202
			neg[1] = 1;
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
		if (((headerByte >>> 27) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   206
			neg[2] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   207
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   208
		if (((headerByte >>> 26) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   209
			neg[3] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   210
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   211
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   212
		if (((headerByte >>> 25) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   213
			neg[4] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   214
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   215
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   216
		if (((headerByte >>> 24) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   217
			neg[5] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   218
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   219
		if (((headerByte >>> 23) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   220
			neg[6] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   221
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   222
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   223
		if (((headerByte >>> 22) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   224
			neg[7] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   225
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   226
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   227
		if (((headerByte >>> 21) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   228
			neg[8] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   229
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   230
		if (((headerByte >>> 20) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   231
			neg[9] = 1;
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
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   234
		// check overflows of L2 counters
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   235
		if (l2Enabled) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   236
			if (((headerByteL2 >>> 11) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   237
				neg[10] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   238
			}
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 (((headerByteL2 >>> 10) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   241
				neg[11] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   242
			}
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
			if (((headerByteL2 >>> 9) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   245
				neg[12] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   246
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   247
			if (((headerByteL2 >>> 8) & 1) != 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   248
				neg[13] = 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   249
			}
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
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   252
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   253
		int[] len = new int[eventNumber];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   254
		len[0] = (((headerByte >> 18) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   255
		len[1] = (((headerByte >> 16) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   256
		len[2] = (((headerByte >> 14) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   257
		len[3] = (((headerByte >> 12) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   258
		len[4] = (((headerByte >> 10) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   259
		len[5] = (((headerByte >> 8) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   260
		len[6] = (((headerByte >> 6) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   261
		len[7] = (((headerByte >> 4) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   262
		len[8] = (((headerByte >> 2) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   263
		len[9] = (((headerByte) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   264
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   265
		if (l2Enabled) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   266
			len[10] = (((headerByteL2 >> 6) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   267
			len[11] = (((headerByteL2 >> 4) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   268
			len[12] = (((headerByteL2 >> 2) << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   269
			len[13] = ((headerByteL2 << 30) >>> 30) + 1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   270
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   271
		if (debug)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   272
			if (this.time > 7820 && this.time < 7830)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   273
				System.out.println("T:" + this.time + " len0:" + len[0] + " len1:" + len[1] + " len2:" + len[2]); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   274
		if (debug)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   275
			if (this.time > 7900 && this.time < 7900)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   276
				System.out.println("H: " + Integer.toBinaryString(headerByte) + " N0:" + neg[0] + " N1:" + neg[1] + " N2:" + neg[2]); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   277
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   278
		int[] val = new int[eventNumber];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   279
		val[0] = readVal(neg[0], len[0], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   280
		val[1] = readVal(neg[1], len[1], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   281
		val[2] = readVal(neg[2], len[2], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   282
		val[3] = readVal(neg[3], len[3], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   283
		val[4] = readVal(neg[4], len[4], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   284
		val[5] = readVal(neg[5], len[5], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   285
		val[6] = readVal(neg[6], len[6], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   286
		val[7] = readVal(neg[7], len[7], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   287
		val[8] = readVal(neg[8], len[8], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   288
		val[9] = readVal(neg[9], len[9], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   289
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   290
		if (l2Enabled) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   291
			val[10] = readVal(neg[10], len[10], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   292
			val[11] = readVal(neg[11], len[11], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   293
			val[12] = readVal(neg[12], len[12], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   294
			val[13] = readVal(neg[13], len[13], dis);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   295
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   296
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   297
		if (debug)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   298
			if (this.time > 7820 && this.time < 7900)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   299
				System.out.println("READ T:" + this.time + "   V0:" + Integer.toHexString(val[0]) + " V1:" + Long.toHexString(val[1]) + " V2:" + Long.toHexString(val[2])); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   300
		for (int i = 0; i < eventNumber; i++) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   301
			val[i] = prev[i] - val[i];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   302
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   303
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   304
		IpcSample ps = new IpcSample(val, this.time);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   305
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   306
		if (debug)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   307
			if (this.time > 7820 && this.time < 7900)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   308
				System.out.println("T:" + this.time + "   V0:" + Long.toHexString(val[0]) + " V1:" + Long.toHexString(val[1]) + " V2:" + Long.toHexString(val[2])); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   309
		if (debug)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   310
			if (this.time > 7820 && this.time < 7900)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   311
				System.out.println("T:" + this.time + " " + val[0] + " " + val[1] + " " + val[2]); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   312
		this.time++;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   313
		/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   314
		 * dis.readByte(); dis.readByte(); dis.readByte(); dis.readByte();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   315
		 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   316
		return ps;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   317
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   318
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   319
	private int 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
   320
	{
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   321
		byte[] array = new byte[len];
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   322
		dis.read(array);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   323
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   324
		//System.out.println("array: "+array);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   325
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   326
		if(debug)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   327
			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
   328
			{
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   329
				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
   330
			}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   331
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   332
		long total = 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   333
		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
   334
		{
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   335
			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
   336
			total |= value;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   337
		}
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
		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
   340
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   341
		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
   342
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   343
		if(neg != 0) total = ~total;
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
		return (int)total;
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
	private String[] parseValueTypes(List<Integer> counterTypes, List<Integer> counterL2Types){
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   349
		String[] s = new String[counterTypes.size() * EVENT_TYPE_TABLE.size() + (counterL2Types == null ? 0 : counterL2Types.size())];
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   350
		int k = 0;
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   351
		for (int i = 0; i < EVENT_TYPE_TABLE.size(); i++) {
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   352
			String eventType =  EVENT_TYPE_TABLE.get(i);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   353
			for (Integer counterType : counterTypes) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   354
				s[k] = String.format(Messages.IpcTraceParser_20, eventType, convertCounterType(counterType));
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   355
				k++;
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
		}
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 (counterL2Types != null){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   360
			for (Integer l2Type : counterL2Types) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   361
				s[k] = convertL2EventType(l2Type);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   362
				k++;				
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
		return s;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   366
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   367
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   368
	private String convertL2EventType(Integer value) {
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   369
		String s = IpcTraceParser.L2_EVENT_TYPE_TABLE.get(value);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   370
		if (s == null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   371
			s = String.format(IPC_EVENT_NOT_RECOGNISED, value);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   372
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   373
		return s;
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
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   376
	private String convertCounterType(Integer value) {
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   377
		String s = IpcTraceParser.COUNTER_TYPE_TABLE.get(value);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   378
		if (s == null) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   379
			s = String.format(IPC_EVENT_NOT_RECOGNISED, value);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   380
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   381
		return s;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   382
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   383
}