Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 209343 | Differences between
and this patch

Collapse All | Expand All

(-)src-hierarchy/org/eclipse/hyades/loaders/hierarchy/IgnoredXMLFragmentLoader.java (-2 / +28 lines)
Lines 11-16 Link Here
11
 **********************************************************************/
11
 **********************************************************************/
12
package org.eclipse.hyades.loaders.hierarchy;
12
package org.eclipse.hyades.loaders.hierarchy;
13
13
14
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
14
import org.eclipse.hyades.loaders.util.HierarchyContext;
15
import org.eclipse.hyades.loaders.util.HierarchyContext;
15
import org.eclipse.hyades.loaders.util.XMLFragmentLoader;
16
import org.eclipse.hyades.loaders.util.XMLFragmentLoader;
16
17
Lines 18-24 Link Here
18
/**
19
/**
19
 * @author slavescu
20
 * @author slavescu
20
 */
21
 */
21
public class IgnoredXMLFragmentLoader implements XMLFragmentLoader {
22
public class IgnoredXMLFragmentLoader implements XMLFragmentLoader, BinaryFragmentLoader {
22
    //~ Instance fields ----------------------------------------------------------------------------
23
    //~ Instance fields ----------------------------------------------------------------------------
23
24
24
    protected HierarchyContext context;
25
    protected HierarchyContext context;
Lines 29-35 Link Here
29
    	// do nothing
30
    	// do nothing
30
    }
31
    }
31
32
32
    public void addCharacters(char[] data, int offset, int length) {
33
    /**
34
     * Inefficient, pilot version.
35
     * TODO These methods should invoke real setters w/o toString conversion. 
36
     */
37
	public void addAttribute(String name, byte value) {
38
		addAttribute(name, Byte.toString(value));
39
	}
40
41
	public void addAttribute(String name, short value) {
42
		addAttribute(name, Short.toString(value));
43
	}
44
45
	public void addAttribute(String name, int value) {
46
		addAttribute(name, Integer.toString(value));
47
	}
48
49
	public void addAttribute(String name, long value) {
50
		addAttribute(name, Long.toString(value));
51
	}
52
53
	public void addAttribute(String name, double value) {
54
		addAttribute(name, Double.toString(value));
55
	}
56
57
	public void addCharacters(char[] data, int offset, int length) {
33
    	// do nothing
58
    	// do nothing
34
    }
59
    }
35
60
Lines 52-55 Link Here
52
    public void startChild(String name) {
77
    public void startChild(String name) {
53
    	// do nothing
78
    	// do nothing
54
    }
79
    }
80
55
}
81
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFNodeParser.java (+43 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFNodeParser extends BinaryFragmentParser {
22
	
23
	public static final Short ID = new Short((short)1001);
24
25
	public static final String NAME = "node";
26
27
	public BFNodeParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(NODE_ID, reader.readString(data, offset));
36
		loader.addAttribute(HOSTNAME, reader.readString(data, offset));
37
		loader.addAttribute(IPADDRESS, reader.readString(data, offset));
38
		loader.addAttribute(TIMEZONE, reader.readTimestamp(data, offset));
39
		loader.addAttribute(TIMESTAMP, reader.readLong(data, offset));
40
		
41
		return true;
42
	}
43
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFThreadInterruptCalledParser.java (+23 lines)
Added Link Here
1
/**********************************************************************
2
 * Copyright (c) 2005 - 2008 IBM Corporation, Intel Corporation.
3
 * All rights reserved. This content is made available under
4
 * the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html       
7
 * $Id$
8
 *
9
 * Contributors:
10
 * Stas Polevic - Initial contribution
11
 **********************************************************************/
12
package org.eclipse.hyades.loaders.internal.binary.v1;
13
14
public class BFThreadInterruptCalledParser extends BFMonNotifyCalledParser {
15
16
	public static final Short ID = new Short((short) 1043);
17
	
18
	public static final String NAME = "threadInterruptCalled"; 
19
	
20
	public BFThreadInterruptCalledParser() {
21
		super(ID, NAME);
22
	}
23
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFGCFinishParser.java (+47 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFGCFinishParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1027);
24
25
	public static final String NAME = "gcFinish";
26
27
	public BFGCFinishParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int)reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(TOTAL_OBJECT_SPACE, reader.readLong(data, offset));
39
		loader.addAttribute(USED_OBJECT_SPACE, reader.readLong(data, offset));
40
		loader.addAttribute(USED_OBJECTS, reader.readLong(data, offset));
41
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
42
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
43
		
44
		return true;
45
	}
46
47
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFThreadStartParser.java (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFThreadStartParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1009);
24
25
	public static final String NAME = "threadStart";
26
27
	public BFThreadStartParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		// transThreadId ignored
36
		loader.addAttribute(TRANS_THREAD_ID, reader.readLong(data, offset));
37
		loader.addAttribute(THREAD_ID, (int)reader.readLong(data, offset));
38
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
39
		loader.addAttribute(GROUP_NAME, reader.readString(data, offset));
40
		loader.addAttribute(PARENT_NAME, reader.readString(data, offset));
41
		loader.addAttribute(TRANS_OBJ_ID_REF, reader.readLong(data, offset));
42
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
43
		loader.addAttribute(THREAD_NAME, reader.readString(data, offset));
44
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
45
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
46
			
47
		return true;
48
	}
49
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFGCRootParser.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFGCRootParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1039);
24
	
25
	public static final String NAME = "gcRoot"; 
26
27
	public BFGCRootParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(CLASS_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
37
		loader.addAttribute(TYPE, reader.readString(data, offset));
38
		
39
		return true;
40
	}
41
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFInvocationContextParser.java (+47 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFInvocationContextParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1018);
23
24
	public static final String NAME = "invocationContext";
25
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
28
//		// NodeIdRef ignored
29
//		reader.readLong(data, offset);
30
//		// processIdRef ignored
31
//		reader.readLong(data, offset);
32
//		// agentIdRef ignored
33
//		reader.readLong(data, offset);
34
//		// threadIdRef ignored
35
//		reader.readLong(data, offset);
36
//		// ticket ignored
37
//		reader.readInt(data, offset);
38
//		// sequenceNumber ignored
39
//		reader.readLong(data, offset);
40
//		// colValue ignored
41
//		reader.readString(data, offset);
42
//		// traceIdRef ignored
43
//		reader.readString(data, offset);
44
		
45
		return true;
46
	}
47
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFAgentCreateParser.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFAgentCreateParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1003);
24
25
	public static final String NAME = "agentCreate";
26
27
	public BFAgentCreateParser() {
28
		super(ID, NAME);
29
	}
30
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
		
35
		loader.addAttribute(AGENT_ID, reader.readString(data, offset));
36
		loader.addAttribute(PROCESS_ID_REF, reader.readString(data, offset));
37
		loader.addAttribute(AGENT_NAME, reader.readString(data, offset));
38
		loader.addAttribute(AGENT_TYPE, reader.readString(data, offset));
39
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
40
		loader.addAttribute(AGENT_PARAMETERS, reader.readString(data, offset));
41
		loader.addAttribute(VERSION, reader.readString(data, offset));
42
		
43
		return true;
44
	}
45
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMonContendedEnterParser.java (+50 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFMonContendedEnterParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short) 1034);
24
	
25
	public static final String NAME = "monContendedEnter"; 
26
27
	public BFMonContendedEnterParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(THREAD_ID_REF, (int) reader.readLong(data, offset));
36
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
37
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
38
		loader.addAttribute(THREAD_OWNER, (int) reader.readLong(data, offset));
39
		
40
		long stackDepth = reader.readUnsignedInt(data, offset);
41
		
42
		String[] stackMethods = reader.readStringArray(data, (int)stackDepth, offset); // Possible truncation
43
		addAnnotation(loader, stackMethods, CALL_STACK_METHODS);
44
45
		Long[] stackLines = reader.readLongArray(data, (int)stackDepth, offset);
46
		addAnnotation(loader, stackLines, CALL_STACK_LINES);
47
		
48
		return true;
49
	}
50
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFObjAllocParser.java (+52 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFObjAllocParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1013);
24
25
	public static final String NAME = "objAlloc";
26
27
	public BFObjAllocParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int)reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(IS_ARRAY, reader.readByte(data, offset));
39
		loader.addAttribute(TRANS_OBJ_ID_REF, reader.readLong(data, offset));
40
		loader.addAttribute(OBJ_ID, reader.readLong(data, offset));
41
		loader.addAttribute(SIZE, (int) reader.readLong(data, offset));
42
		loader.addAttribute(LINE, (int) reader.readLong(data, offset));
43
		loader.addAttribute(METHOD_ID_REF, (int)reader.readLong(data, offset));
44
		loader.addAttribute(TRANS_CLASS_ID_REF, reader.readLong(data, offset));
45
		loader.addAttribute(CLASS_ID_REF, reader.readLong(data, offset));
46
		loader.addAttribute(CONTEXT_DATA, reader.readString(data, offset));
47
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
48
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
49
		
50
		return true;
51
	}
52
}
(-)src-hierarchy/org/eclipse/hyades/loaders/util/BinaryLoader.java (+119 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.util;
14
15
import java.io.IOException;
16
import java.io.InputStream;
17
18
import org.eclipse.hyades.loaders.internal.binary.BFHeader;
19
import org.eclipse.hyades.loaders.internal.binary.BFParser;
20
import org.eclipse.hyades.loaders.internal.binary.BFParserFactory;
21
import org.eclipse.hyades.loaders.internal.binary.BFReader;
22
import org.eclipse.hyades.loaders.internal.binary.Offset;
23
import org.eclipse.hyades.models.hierarchy.TRCAgent;
24
import org.eclipse.hyades.models.hierarchy.TRCAgentProxy;
25
import org.eclipse.hyades.models.hierarchy.TRCMonitor;
26
import org.eclipse.hyades.models.hierarchy.util.internal.InvalidEventException;
27
import org.eclipse.hyades.models.util.ModelDebugger;
28
29
public class BinaryLoader extends XMLLoader {
30
31
	private final BFParserFactory parserFactory = new BFParserFactory();
32
	
33
	private final BFHeader formatHeader = new BFHeader();
34
	
35
	private final BFReader reader = new BFReader();
36
	
37
	private boolean loadXml = true; 
38
39
	public BinaryLoader(TRCAgent agent) {
40
		super(agent);
41
	}
42
43
	public BinaryLoader(TRCAgentProxy agentProxy) {
44
		super(agentProxy);
45
	}
46
47
	public BinaryLoader(TRCMonitor monitor) {
48
		super(monitor);
49
	}
50
51
	public boolean isLoadXml() {
52
		return loadXml;
53
	}
54
55
	public void setLoadXml(boolean loadXml) {
56
		this.loadXml = loadXml;
57
	}
58
59
	public void loadEvent(byte[] buffer, int offset, int length, boolean loadToModel) throws InvalidXMLException {
60
		if (isLoadXml()) {
61
			super.loadEvent(buffer, offset, length, loadToModel);
62
			return;
63
		}
64
		
65
		setLoadToModel(loadToModel);
66
		if (ModelDebugger.INSTANCE.debugEventsToFile) {
67
			writeToBinaryOutputFile(buffer, offset, length);
68
		} else {
69
			Offset marker = new Offset(offset, length);
70
			if (formatHeader.parse(buffer, offset, marker)) {
71
				formatHeader.visit(reader);
72
			}
73
74
			BFParser parser = parserFactory.get(formatHeader, context, reader);
75
//			if(getContext().getAgent()==null)
76
//			{
77
//				LoadersUtils.createAgent(getContext());
78
//			}
79
			parser.parseEvents(buffer, marker);
80
		}
81
	}
82
83
	public void loadEvents(InputStream inputStream, long offset, long length) throws InvalidEventException {
84
		if (isLoadXml()) {
85
			super.loadEvents(inputStream, offset, length);
86
			return;
87
		}
88
89
		if (offset > 0) {
90
			try {
91
				inputStream.skip(offset);
92
			} catch (IOException e) {
93
				e.printStackTrace();
94
			}
95
		}
96
		Offset marker = new Offset((int)offset, length);
97
98
		try {
99
			if (!formatHeader.parse(inputStream, marker)) {
100
				return;
101
			}
102
			formatHeader.visit(reader);
103
			
104
			BFParser parser = parserFactory.get(formatHeader, context, reader);
105
			
106
//			if(getContext().getAgent()==null)
107
//			{
108
//				LoadersUtils.createAgent(getContext());
109
//			}
110
			parser.parseEvents(inputStream, marker);
111
			if ((getContext().getAgent() != null) && (getContext().getAgent().eResource() != null) && !getContext().getAgent().eResource().isModified()) {
112
				getContext().getAgent().eResource().setModified(true);
113
			}
114
		} catch (Exception e) {
115
			e.printStackTrace();
116
			throw new InvalidXMLException(e);
117
		}
118
	}
119
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFObjFreeParser.java (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFObjFreeParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1024);
24
25
	public static final String NAME = "objFree";
26
27
	public BFObjFreeParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int)reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(TRANS_OBJ_ID_REF, reader.readLong(data, offset));
39
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
40
		loader.addAttribute(OBJ_AGE, reader.readLong(data, offset));
41
		loader.addAttribute(SEQUENCE_COUNTER, reader.readLong(data, offset));
42
		loader.addAttribute(STACK_DEPTH, reader.readLong(data, offset));
43
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
44
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
45
		
46
		return true;
47
	}
48
49
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMonNotifyCalledParser.java (+54 lines)
Added Link Here
1
/**********************************************************************
2
 * Copyright (c) 2005 - 2008 IBM Corporation, Intel Corporation.
3
 * All rights reserved. This content is made available under
4
 * the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html       
7
 * $Id$
8
 *
9
 * Contributors:
10
 * Stas Polevic - Initial contribution
11
 **********************************************************************/
12
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFMonNotifyCalledParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short) 1042);
24
	
25
	public static final String NAME = "monNotifyCalled"; 
26
27
	public BFMonNotifyCalledParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	protected BFMonNotifyCalledParser(Short id, String name) {
32
		super(id, name);
33
	}
34
	
35
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
36
		byte[] data = fragment.getBody();
37
		BinaryFragmentLoader loader = getLoader();
38
39
		loader.addAttribute(THREAD_ID_REF, (int) reader.readLong(data, offset));
40
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
41
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
42
		loader.addAttribute(IS_NOTIFY_ALL, reader.readByte(data, offset));
43
		
44
		long stackDepth = reader.readUnsignedInt(data, offset);
45
		
46
		String[] stackMethods = reader.readStringArray(data, (int)stackDepth, offset); // Possible truncation
47
		addAnnotation(loader, stackMethods, CALL_STACK_METHODS);
48
49
		Long[] stackLines = reader.readLongArray(data, (int)stackDepth, offset);
50
		addAnnotation(loader, stackLines, CALL_STACK_LINES);
51
		
52
		return true;
53
	}
54
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFThrowParser.java (+29 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFThrowParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1028);
23
24
	public static final String NAME = "throw";
25
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
		return true;
28
	}
29
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/BFReader.java (+246 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
import java.io.UnsupportedEncodingException;
16
17
public class BFReader implements NumberReader, StringReader {
18
19
20
	public static final StringReader ASCII_READER = new StringReader() {
21
			private static final char EOS = '\0';
22
			
23
			private static final String DEFAULT_ENCODING = "UTF-8";
24
25
			private String encoding = DEFAULT_ENCODING;
26
			
27
			public void setEncoding(String encoding) {
28
				this.encoding = encoding;
29
			}
30
31
			public String readString(byte[] b, Offset offset) {
32
				int start = offset.getOffset();
33
				int end = -1;
34
				for(int i = start; i < b.length; ++i) {
35
					char c = (char) b[i];
36
					if (c == EOS) {
37
						end = i;
38
						break;
39
					}
40
				}
41
				
42
				if (end >= 0) {
43
					int stringOffset = (end - start) + 1;
44
					if (offset.increaseOffset(stringOffset) < 0) {
45
						return null;
46
					}
47
					
48
					try {
49
						return new String(b, start, stringOffset - 1, encoding);
50
					} catch (UnsupportedEncodingException e) {
51
						setEncoding(DEFAULT_ENCODING);
52
						return  new String(b, start, stringOffset - 1);
53
					}
54
				}
55
				return null;
56
			}
57
58
			public String[] readStringArray(byte[] b, int length, Offset offset) {
59
				String[] res = new String[length];
60
				for (int i = 0; i < length; ++i) {
61
					res[i] = readString(b, offset);
62
				}
63
				return res;
64
			}
65
66
		};
67
	
68
	public static final NumberReader LE_64_READER = new NumberReader() { // Little-endian, IA64
69
70
			private long cpuFrequency;
71
			
72
			public short readShort(byte[] b, Offset offset) {
73
				int start = offset.getOffset();
74
		        if (offset.increaseOffset(2) < 0) {
75
		        	return 0;
76
		        }
77
		        int ch1 = b[start];
78
		        int ch2 = b[start + 1];
79
		        
80
		        return (short)((ch2 << 8) + (ch1 << 0));			
81
			} 
82
			
83
			public int readUnsignedShort(byte[] b, Offset offset) {
84
				int start = offset.getOffset();
85
		        if (offset.increaseOffset(2) < 0) {
86
		        	return 0;
87
		        }
88
		        int ch1 = b[start] & 0xFF;
89
		        int ch2 = b[start + 1] & 0xFF;
90
		        
91
		        return ((ch2 << 8) + (ch1 << 0));			
92
			}
93
94
			public int readInt(byte[] b, Offset offset) {
95
				int start = offset.getOffset();
96
				if (offset.increaseOffset(4) < 0) {
97
					return 0;
98
				}
99
		        int ch1 = b[start];
100
		        int ch2 = b[start + 1];
101
		        int ch3 = b[start + 2];
102
		        int ch4 = b[start + 3];
103
		        
104
		        return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0));
105
			}
106
		
107
			public long readUnsignedInt(byte[] b, Offset offset) {
108
				int start = offset.getOffset();
109
				if (offset.increaseOffset(4) < 0) {
110
					return 0;
111
				}
112
		        int ch1 = b[start] & 0xFF;
113
		        int ch2 = b[start + 1] & 0xFF;
114
		        int ch3 = b[start + 2] & 0xFF;
115
		        int ch4 = b[start + 3] & 0xFF;
116
		        
117
		        return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 >> 0));
118
			}
119
120
			public long readLong(byte[] b, Offset offset) {
121
				int start = offset.getOffset();
122
				if (offset.increaseOffset(8) < 0) {
123
					return 0;
124
				}
125
		        int ch1 = b[start];
126
		        int ch2 = b[start + 1];
127
		        int ch3 = b[start + 2];
128
		        int ch4 = b[start + 3];
129
		        int ch5 = b[start + 4];
130
		        int ch6 = b[start + 5];
131
		        int ch7 = b[start + 6];
132
		        int ch8 = b[start + 7];
133
		        
134
		        return (((long)ch8 << 56) + ((long)(ch7 & 255) << 48) + ((long)(ch6 & 255) << 40) + ((long)(ch5 & 255) << 32) +
135
		                ((long)(ch4 & 255) << 24) + ((ch3 & 255) << 16) + ((ch2 & 255) <<  8) + ((ch1 & 255) <<  0));
136
	        }
137
138
			public Long[] readLongArray(byte[] b, int length, Offset offset) {
139
				Long[] res = new Long[length];
140
				for (int i = 0; i < length; ++i) {
141
					res[i] = new Long(readLong(b, offset));
142
				}
143
				return res;
144
			}
145
146
			public void setCpuFrequency(long frequency) {
147
				this.cpuFrequency = frequency;
148
			}
149
150
			public double readTimestamp(byte[] b, Offset offset) {
151
				long value = readLong(b, offset);
152
				
153
				if (cpuFrequency > 0) {
154
					value /= cpuFrequency;
155
				}
156
				
157
		    	double high = (value / 1000000000);
158
		    	double low = (value % 1000000000) * 0.000000001;
159
		    	double result = high + low;
160
161
		    	return result;
162
			}
163
164
		};
165
	
166
	private NumberReader numberReader;
167
	
168
	private StringReader stringReader;
169
170
	public BFReader(NumberReader numberReader, StringReader stringReader) {
171
		this.numberReader = numberReader;
172
		this.stringReader = stringReader;
173
	}
174
	
175
	public BFReader() {
176
		this(LE_64_READER, ASCII_READER);
177
	}
178
179
	public NumberReader getNumberReader() {
180
		return numberReader;
181
	}
182
183
	public void setNumberReader(NumberReader numberReader) {
184
		this.numberReader = numberReader;
185
	}
186
187
	public StringReader getStringReader() {
188
		return stringReader;
189
	}
190
191
	public void setStringReader(StringReader stringReader) {
192
		this.stringReader = stringReader;
193
	}
194
195
	public String readString(byte[] b, Offset offset) {
196
		return stringReader.readString(b, offset);
197
	}
198
	
199
	public String[] readStringArray(byte[] b, int length, Offset offset) {
200
		return stringReader.readStringArray(b, length, offset);
201
	}
202
203
	public byte readByte(byte[] b, Offset offset) {
204
		int start = offset.getOffset();
205
		if (offset.increaseOffset(1) < 0) {
206
			return 0;
207
		}
208
		return b[start];
209
	}
210
211
	public short readShort(byte[] b, Offset offset) {
212
		return numberReader.readShort(b, offset);
213
	}
214
215
	public int readUnsignedShort(byte[] b, Offset offset) {
216
		return numberReader.readUnsignedShort(b, offset);
217
	}
218
219
	public int readInt(byte[] b, Offset offset) {
220
		return numberReader.readInt(b, offset);
221
	}
222
223
	public long readUnsignedInt(byte[] b, Offset offset) {
224
		return numberReader.readUnsignedInt(b, offset);
225
	}
226
227
	public long readLong(byte[] b, Offset offset) {
228
		return numberReader.readLong(b, offset);
229
	}
230
231
	public Long[] readLongArray(byte[] b, int length, Offset offset) {
232
		return numberReader.readLongArray(b, length, offset);
233
	}
234
235
	public double readTimestamp(byte[] b, Offset offset) {
236
		return numberReader.readTimestamp(b, offset);
237
	}
238
239
	public void setCpuFrequency(long frequency) {
240
		numberReader.setCpuFrequency(frequency);
241
	}
242
243
	public void setEncoding(String encoding) {
244
		stringReader.setEncoding(encoding);
245
	}
246
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/BFHeader.java (+218 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
import java.io.IOException;
16
import java.io.InputStream;
17
import java.util.HashMap;
18
import java.util.Map;
19
20
public class BFHeader {
21
	
22
	public static final int LENGTH = 12;
23
	
24
	private Magic magic = Magic.TBF_INDENT;
25
	
26
	private Version version = Version.VERSION_1_0;
27
28
	private Platform platform = Platform.IA32;
29
	
30
	private Endianness endianness = Endianness.BIG_ENDIAN;
31
	
32
	public BFHeader() {
33
	}
34
	
35
	public boolean parse(InputStream inputStream, Offset offset) throws IOException {
36
		byte[] header = new byte[LENGTH];
37
		if (inputStream.read(header) < 0) {
38
			throw new IllegalArgumentException("Malformed header");
39
		}
40
		return parse(header, 0, offset);
41
	}
42
	
43
	public boolean parse(byte[] header, int start, Offset offset) {
44
		Offset marker = new Offset(start, LENGTH);
45
46
		// indent is ignored
47
		marker.increaseOffset(1);
48
		magic = Magic.read(header, marker);
49
		if (magic == null) {
50
			return false;
51
		}
52
		version = Version.read(header, marker);
53
		if (version == null) {
54
			throw new IllegalArgumentException("Version is not supported");
55
		}
56
		platform = Platform.read(header, marker);
57
		if (platform == null) {
58
			throw new IllegalArgumentException("Platform is not supported");
59
		}
60
		endianness = Endianness.read(header, marker);
61
		if (endianness == null) {
62
			throw new IllegalArgumentException("Endianness is not supported");
63
		}
64
		// offset to data is ignored at the moment
65
		
66
		offset.increaseOffset(LENGTH);
67
		return true;
68
	}
69
70
	public Magic getMagic() {
71
		return magic;
72
	}
73
74
	public Platform getPlatform() {
75
		return platform;
76
	}
77
78
	public Endianness getEndianness() {
79
		return endianness;
80
	}
81
82
	public Version getVersion() {
83
		return version;
84
	}
85
86
	public BFReader visit(BFReader reader) {
87
		if (Platform.IA32.equals(platform) && Endianness.LITTLE_ENDIAN.equals(endianness)) {
88
			reader.setNumberReader(BFReader.LE_64_READER);
89
		} else if (Platform.IA64.equals(platform) && Endianness.LITTLE_ENDIAN.equals(endianness)) {
90
			reader.setNumberReader(BFReader.LE_64_READER);
91
		}
92
		
93
		return reader;
94
	}
95
	
96
	public static class Magic {
97
98
		private static Map entries = new HashMap();
99
		
100
		public static int LENGTH = 3;
101
		
102
		public static final Magic TBF_INDENT = new Magic("TBF");
103
			
104
		private final String magic;
105
		
106
		public Magic(String magic) {
107
			this.magic = magic;
108
			entries.put(magic, this);
109
		}
110
111
		public String getMagic() {
112
			return magic;
113
		}
114
		
115
		public static Magic read(byte[] header, Offset offset) {
116
			String magic = new String(header, offset.increaseOffset(LENGTH), LENGTH);
117
			return (Magic) entries.get(magic);
118
		}
119
	}
120
	
121
	public static class Platform {
122
123
		private static Map entries = new HashMap();
124
		
125
		public static final Platform IA32 = new Platform(0);
126
127
		public static final Platform IA64 = new Platform(1);
128
		
129
130
		private final int code;
131
		
132
		public Platform(int code) {
133
			this.code = code;
134
			entries.put(new Integer(code), this);
135
		}
136
137
		public int getCode() {
138
			return code;
139
		}
140
141
		public static Platform read(byte[] header, Offset offset) {
142
			int code = header[offset.increaseOffset(1)];
143
			return (Platform) entries.get(new Integer(code));
144
		}
145
	}
146
	
147
	public static class Endianness {
148
		private static Map entries = new HashMap();
149
150
		public static final Endianness BIG_ENDIAN = new Endianness(0);
151
		
152
		public static final Endianness LITTLE_ENDIAN = new Endianness(1);
153
154
		private final int code;
155
		
156
		public Endianness(int code) {
157
			this.code = code;
158
			entries.put(new Integer(code), this);
159
		}
160
161
		public int getCode() {
162
			return code;
163
		}
164
		
165
		public static Endianness read(byte[] header, Offset offset) {
166
			int code = header[offset.increaseOffset(1)];
167
			return (Endianness) entries.get(new Integer(code));
168
		}
169
	}
170
	
171
	public static class Version {
172
		private static Map entries = new HashMap();
173
174
		public static final Version VERSION_1_0 = new Version(1.0);
175
		
176
		private final double version;
177
		
178
		public Version(double version) {
179
			this.version = version;
180
			entries.put(new Double(version), this);
181
		}
182
183
		public double getVersion() {
184
			return version;
185
		}
186
187
		public static Version read(byte[] header, Offset offset) {
188
			int major = header[offset.increaseOffset(1)];
189
			int minor = header[offset.increaseOffset(1)];
190
			double ver = major + (minor * 0.1);
191
			return (Version) entries.get(new Double(ver));
192
		}
193
	}
194
	
195
	public static class Encoding {
196
		private static Map entries = new HashMap();
197
198
		public static final Encoding UTF8 = new Encoding(0);
199
		
200
		public static final Encoding ASCII = new Encoding(1);
201
202
		private final int code;
203
		
204
		public Encoding(int code) {
205
			this.code = code;
206
			entries.put(new Integer(code), this);
207
		}
208
209
		public int getCode() {
210
			return code;
211
		}
212
		
213
		public static Encoding read(byte[] header, Offset offset) {
214
			int code = header[offset.increaseOffset(1)];
215
			return (Encoding) entries.get(new Integer(code));
216
		}
217
	}
218
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFThreadEndParser.java (+44 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFThreadEndParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1010);
24
25
	public static final String NAME = "threadEnd";
26
27
	public BFThreadEndParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int) reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
39
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
40
		
41
		return true;
42
	}
43
44
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFGCStartParser.java (+44 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFGCStartParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1023);
24
25
	public static final String NAME = "gcStart";
26
27
	public BFGCStartParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int)reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
39
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
40
		
41
		return true;
42
	}
43
44
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFRuntimeInitDoneParser.java (+30 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFRuntimeInitDoneParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1030);
23
24
	public static final String NAME = "runtimeInitDone";
25
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
		// ignored!
28
		return true;
29
	}
30
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMethodExitParser.java (+51 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFMethodExitParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1015);
24
25
	public static final String NAME = "methodExit";
26
27
	public BFMethodExitParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int) reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(TICKET, reader.readLong(data, offset));
39
		loader.addAttribute(THREAD_CPU_TIME, reader.readLong(data, offset));
40
		loader.addAttribute(METHOD_ID_REF, (int) reader.readLong(data, offset));
41
		loader.addAttribute(TRANS_OBJ_ID_REF, reader.readLong(data, offset));
42
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
43
		loader.addAttribute(TRANS_CLASS_ID_REF, reader.readLong(data, offset));
44
		loader.addAttribute(CLASS_ID_REF, reader.readLong(data, offset));
45
		loader.addAttribute(SEQUENCE_COUNTER, reader.readLong(data, offset));
46
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
47
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
48
		
49
		return true;
50
	}
51
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFClassUnloadParser.java (+29 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFClassUnloadParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1025);
23
24
	public static final String NAME = "classUnload";
25
	
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
		return true;
28
	}
29
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFAGMethodExitParser.java (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFAGMethodExitParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short) 1037);
24
	
25
	public static final String NAME = "agMethodExit"; 
26
27
	public BFAGMethodExitParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(THREAD_ID_REF, (int) reader.readLong(data, offset));
36
		loader.addAttribute(METHOD_ID_REF, (int) reader.readLong(data, offset));
37
		
38
		return true;
39
	}
40
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMethodDefParser.java (+55 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFMethodDefParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1012);
24
25
	public static final String NAME = "methodDef";
26
27
	public BFMethodDefParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
36
		loader.addAttribute(NAME_ATTR, reader.readString(data, offset));
37
		loader.addAttribute(SIGNATURE, reader.readString(data, offset));
38
		loader.addAttribute(VISIBILITY, reader.readString(data, offset));
39
		loader.addAttribute(IS_NATIVE, reader.readByte(data, offset));
40
		loader.addAttribute(IS_ABSTRACT, reader.readByte(data, offset));
41
		loader.addAttribute(IS_STATIC, reader.readByte(data, offset));
42
		loader.addAttribute(IS_SYNCHRONIZED, reader.readByte(data, offset));
43
		loader.addAttribute(EXCEPTIONS, reader.readString(data, offset));
44
		loader.addAttribute(START_LINE_NUMBER, (int) reader.readLong(data, offset));
45
		loader.addAttribute(END_LINE_NUMBER, (int) reader.readLong(data, offset));
46
		loader.addAttribute(SIGNATURE_NOTATION, reader.readString(data, offset));
47
		loader.addAttribute(TRANS_CLASS_ID_REF, reader.readLong(data, offset));
48
		loader.addAttribute(CLASS_ID_REF, reader.readLong(data, offset));
49
		loader.addAttribute(METHOD_ID, (int)reader.readLong(data, offset));
50
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
51
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
52
		
53
		return true;
54
	}
55
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/IgnoredBinaryFragmentLoader.java (+35 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
import org.eclipse.hyades.loaders.hierarchy.IgnoredXMLFragmentLoader;
16
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
17
18
public class IgnoredBinaryFragmentLoader extends IgnoredXMLFragmentLoader implements BinaryFragmentLoader {
19
20
	public void addAttribute(String name, byte value) {
21
	}
22
23
	public void addAttribute(String name, short value) {
24
	}
25
26
	public void addAttribute(String name, int value) {
27
	}
28
29
	public void addAttribute(String name, long value) {
30
	}
31
32
	public void addAttribute(String name, double value) {
33
	}
34
35
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFObjRefParser.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFObjRefParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1040);
24
	
25
	public static final String NAME = "objReference"; 
26
27
	public BFObjRefParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(OWNER_OBJ_ID_REF, (int)reader.readLong(data, offset));
36
		loader.addAttribute(TARGET_OBJ_ID_REF, reader.readLong(data, offset));
37
		loader.addAttribute(HEAP_DUMP_ID_REF, (short) reader.readLong(data, offset));
38
		
39
		return true;
40
	}
41
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFLineParser.java (+29 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFLineParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1022);
23
24
	public static final String NAME = "line";
25
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
		return true;
28
	}
29
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFThreadStartCalledParser.java (+24 lines)
Added Link Here
1
/**********************************************************************
2
 * Copyright (c) 2005 - 2008 IBM Corporation, Intel Corporation.
3
 * All rights reserved. This content is made available under
4
 * the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html       
7
 * $Id$
8
 *
9
 * Contributors:
10
 * Stas Polevic - Initial contribution
11
 **********************************************************************/
12
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
public class BFThreadStartCalledParser extends BFMonNotifyCalledParser {
16
	public static final Short ID = new Short((short) 1044);
17
	
18
	public static final String NAME = "threadStartCalled"; 
19
	
20
	public BFThreadStartCalledParser() {
21
		super(ID, NAME);
22
	}
23
24
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFValueParser.java (+29 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFValueParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1020);
23
24
	public static final String NAME = "value";
25
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
		return true;
28
	}
29
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/Offset.java (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
public class Offset {
16
	private int offset;
17
	
18
	private final long length;
19
	
20
	public Offset(int offset, long length) {
21
		if (offset < 0 || (length > 0 && offset > length)) {
22
			throw new IllegalArgumentException("Offset should be between 0 and " + length);
23
		}
24
		this.offset = offset;
25
		this.length = length;
26
	}
27
	
28
	public Offset(int offset) {
29
		this(offset, 0);
30
	}
31
32
	public int increaseOffset(int delta) {
33
		int oldOffset = offset;
34
		int newOffset = offset + delta;
35
		if (length > 0 && newOffset > length) {
36
			return -1;
37
		}
38
		offset = newOffset;
39
		return oldOffset;
40
	}
41
	
42
	public int getOffset() {
43
		return offset;
44
	}
45
	
46
	public long getLength() {
47
		return length;
48
	}
49
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/BinaryFragmentParser.java (+247 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
16
import org.eclipse.hyades.loaders.util.HierarchyContext;
17
import org.eclipse.hyades.loaders.util.LoaderExtensions;
18
19
public abstract class BinaryFragmentParser {
20
21
	public static final String AGENT_ID = "agentId";
22
	
23
	public static final String AGENT_ID_REF = "agentIdRef";
24
25
	public static final String AGENT_NAME = "agentName";
26
	
27
	public static final String AGENT_TYPE = "agentType";
28
	
29
	public static final String PROCESS_ID_REF = "processIdRef";
30
	
31
	public static final String AGENT_PARAMETERS = "agentParameters";
32
	
33
	public static final String VERSION = "version";
34
	
35
	public static final String THREAD_ID = "threadId";
36
37
	public static final String THREAD_ID_REF = "threadIdRef";
38
	
39
	public static final String TRANS_THREAD_ID_REF = "transientThreadIdRef";
40
	
41
	public static final String TRANS_THREAD_ID= "transientThreadId";
42
	
43
	public static final String GROUP_NAME = "groupName";
44
45
	public static final String PARENT_NAME = "parentName";
46
47
	public static final String THREAD_NAME = "threadName";
48
49
	public static final String METHOD_ID = "methodId";
50
51
	public static final String METHOD_ID_REF = "methodIdRef";
52
	
53
	public static final String TIME = "time";
54
	
55
	public static final String BASE_TIME = "baseTime";
56
	
57
	public static final String MIN_TIME = "minTime";
58
	
59
	public static final String MAX_TIME = "maxTime";
60
	
61
	public static final String CPU_TIME = "cpuTime";
62
	
63
	public static final String TIMEOUT = "timeout";
64
65
	public static final String THREAD_CPU_TIME = "threadCpuTime";
66
67
	public static final String COUNT = "count";
68
	
69
	public static final String NUM_INTERFACES = "numInterfaces";
70
	
71
	public static final String INTERFACE_NAMES = "interfaceNames";
72
	
73
	public static final String CLASS_ID = "classId";
74
	
75
	public static final String CLASS_ID_REF = "classIdRef";
76
77
	public static final String TRANS_CLASS_ID = "transientClassId";
78
	
79
	public static final String TRANS_CLASS_ID_REF = "transientClassIdRef";
80
81
	public static final String CLASS_LOADER = "classLoader";
82
	
83
	public static final String SUPER_CLASS = "superClass";
84
	
85
	public static final String SOURCE_NAME = "sourceName";
86
	
87
	public static final String OBJ_ID_REF = "objIdRef";
88
	
89
	public static final String OBJ_ID = "objId";
90
91
	public static final String TRANS_OBJ_ID_REF = "transientObjIdRef";
92
	
93
	public static final String OWNER_OBJ_ID_REF = "ownerObjIdRef";
94
	
95
	public static final String TARGET_OBJ_ID_REF = "targetObjIdRef";
96
97
	public static final String OBJ_AGE = "objAge";
98
99
	public static final String NAME_ATTR = "name";
100
	
101
	public static final String ACCESS = "access";
102
	
103
	public static final String NUM_STATIC_FIELDS= "numStaticFields";
104
	
105
	public static final String NUM_METHODS = "numMethods";
106
	
107
	public static final String NUM_INSTANCE_FIELDS = "numInstanceFields";
108
	
109
	public static final String COLLATION_VALUE = "collationValue";
110
		
111
	public static final String TRACE_ID = "traceId";
112
113
	public static final String TRACE_ID_REF = "traceIdRef";
114
	
115
	public static final String PATTERN = "pattern";
116
	
117
	public static final String GENERIC_PATTERN = "genericPattern";
118
	
119
	public static final String MODE = "mode";
120
	
121
	public static final String METHOD_PATTERN = "methodPattern";
122
	
123
	public static final String METHOD_GENERIC_PATTERN = "methodGenericPattern";
124
	
125
	public static final String METHOD_MODE = "methodMode";
126
	
127
	public static final String TOTAL_OBJECT_SPACE = "totalObjectSpace";
128
129
	public static final String USED_OBJECT_SPACE = "usedObjectSpace";
130
	
131
	public static final String USED_OBJECTS = "usedObjects";
132
133
	public static final String TYPE = "type";
134
135
	public static final String HEAP_DUMP_ID_REF = "heapDumpIdRef";
136
137
	public static final String SIGNATURE = "signature";
138
	
139
	public static final String VISIBILITY = "visibility";
140
141
	public static final String IS_NATIVE = "isNative";
142
143
	public static final String IS_ABSTRACT = "isAbstract";
144
145
	public static final String IS_STATIC = "isStatic";
146
	
147
	public static final String IS_SYNCHRONIZED = "isSynchronized";
148
149
    public static final String IS_ARRAY = "isArray";
150
151
    public static final String EXCEPTIONS = "exceptions";
152
153
	public static final String START_LINE_NUMBER = "startLineNumber";
154
155
	public static final String END_LINE_NUMBER = "endLineNumber";
156
157
	public static final String SIGNATURE_NOTATION = "signatureNotation";
158
	
159
	public static final String TICKET = "ticket";
160
161
	public static final String SEQUENCE_COUNTER = "sequenceCounter";
162
163
	public static final String STACK_DEPTH = "stackDepth";
164
	
165
    public static final String ANNOTATION = "annotation";
166
    
167
    public static final String KEY = "key";
168
169
    public static final String VALUE = "value";
170
    
171
    public static final String CALL_STACK_METHODS = "callStackDumpMethods";
172
    
173
    public static final String CALL_STACK_LINES = "callStackDumpLineNumbers";
174
    
175
    public static final String THREAD_OWNER = "threadOwner";
176
177
    public static final String NODE_ID = "nodeId";
178
179
    public static final String NODE_ID_REF = "nodeIdRef";
180
181
    public static final String HOSTNAME = "hostname";
182
183
    public static final String IPADDRESS = "ipaddress";
184
185
    public static final String TIMEZONE = "timezone";
186
187
    public static final String TIMESTAMP = "timestamp";
188
189
    public static final String SIZE = "size";
190
191
    public static final String LINE = "line";
192
193
    public static final String CONTEXT_DATA = "contextData";
194
    
195
    public static final String PROCESS_ID = "processId";
196
    
197
    public static final String PID = "pid";
198
    
199
    public static final String APPLICATION_EXECUTABLE = "applicationExecutable";
200
201
    public static final String IS_NOTIFY_ALL = "isNotifyAll";
202
203
    private BinaryFragmentLoader loader;
204
	
205
	private String name;
206
	
207
	public BinaryFragmentParser() {
208
		loader = new IgnoredBinaryFragmentLoader();
209
	}
210
	
211
	protected BinaryFragmentParser(Short id, String name) {
212
		loader = (BinaryFragmentLoader) LoaderExtensions.getInstance().get(name);
213
		if (loader == null) {
214
			System.err.println("Message " + name + " handler is not found - using default");
215
			loader = new IgnoredBinaryFragmentLoader();
216
		}
217
		this.name = name;
218
	}
219
	
220
	public BinaryFragmentLoader getLoader() {
221
		return loader;
222
	}
223
	
224
	public abstract boolean parse(BinaryFragment fragment, Offset offset, BFReader reader);
225
226
	public void addYourselfInContext() {
227
		loader.addYourselfInContext();
228
	}
229
230
	public void initialize(HierarchyContext context) {
231
		if (name != null) {
232
			loader.initialize(context, name);
233
		}
234
	}
235
236
    protected void addAnnotation(BinaryFragmentLoader loader, Object[] data, String name) {
237
        loader.startChild(ANNOTATION);
238
        loader.addAttribute(NAME_ATTR, name);
239
        for(int i = 0; i < data.length; ++i) {
240
            char[] charData = data[i].toString().toCharArray();
241
            loader.startChild(VALUE);
242
            loader.addCharacters(charData, 0, charData.length);
243
            loader.endChild(VALUE);
244
        }
245
        loader.endChild(ANNOTATION);
246
    }
247
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFFrequencyParser.java (+31 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFFrequencyParser extends BinaryFragmentParser {
21
	public static final Short ID = new Short((short)2);
22
23
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
24
		byte[] data = fragment.getBody();
25
		
26
		long frequency = reader.readLong(data, offset);
27
		reader.setCpuFrequency(frequency);
28
		
29
		return true;
30
	}		
31
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFAGMethodEntryParser.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFAGMethodEntryParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short) 1036);
24
	
25
	public static final String NAME = "agMethodEntry"; 
26
27
	public BFAGMethodEntryParser() {
28
		super(ID, NAME);
29
	}
30
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(THREAD_ID_REF, (int) reader.readLong(data, offset));
36
		loader.addAttribute(METHOD_ID_REF, (int) reader.readLong(data, offset));
37
		loader.addAttribute(BASE_TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(MIN_TIME, reader.readTimestamp(data, offset));
39
		loader.addAttribute(MAX_TIME, reader.readTimestamp(data, offset));
40
		loader.addAttribute(CPU_TIME, reader.readLong(data, offset));
41
		loader.addAttribute(COUNT, (int)reader.readLong(data, offset));
42
		
43
		return true;
44
	}
45
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/BinaryFragment.java (+72 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
import java.io.IOException;
16
17
public class BinaryFragment {
18
19
	public static final int HEADER_LENGTH = 6;
20
21
	Short id;
22
	
23
	int length;
24
	
25
	int bodyOffset;
26
	
27
	byte[] body;
28
	
29
	public BinaryFragment(byte[] header, int offset, BFReader reader) throws IOException {
30
		Offset headerMarker = new Offset(offset, offset + HEADER_LENGTH);
31
		this.id = new Short((short)reader.readUnsignedShort(header, headerMarker));
32
		this.length = (int)reader.readUnsignedInt(header, headerMarker);
33
	}
34
35
	public Short getId() {
36
		return id;
37
	}
38
39
	public int getLength() {
40
		return length;
41
	}
42
43
	public int getBodyOffset() {
44
		return bodyOffset;
45
	}
46
47
	public void setBodyOffset(int bodyOffset) {
48
		this.bodyOffset = bodyOffset;
49
	}
50
51
	public byte[] getBody() {
52
		return body;
53
	}
54
55
	public void setBody(byte[] body) {
56
		this.body = body;
57
	}
58
	
59
	public static boolean isEOF(byte[] header, int offset) {
60
		int headerOffset = offset + HEADER_LENGTH;
61
62
		if (headerOffset > header.length) {
63
			return true;
64
		}
65
		for (int i = offset; i < headerOffset; ++i) {
66
			if (header[i] != 0) {
67
				return false;
68
			}
69
		}
70
		return true;
71
	}
72
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFAgentDestroyParser.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFAgentDestroyParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1004);
24
25
	public static final String NAME = "agentDestroy";
26
27
	public BFAgentDestroyParser() {
28
		super(ID, NAME);
29
	}
30
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(AGENT_ID_REF, reader.readString(data, offset));
36
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
37
		
38
		return true;
39
	}
40
41
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFProcessCreateParser.java (+44 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFProcessCreateParser extends BinaryFragmentParser {
22
	public static final Short ID = new Short((short)1002);
23
24
	public static final String NAME = "processCreate";
25
26
	public BFProcessCreateParser() {
27
		super(ID, NAME);
28
	}
29
	
30
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
31
		byte[] data = fragment.getBody();
32
		BinaryFragmentLoader loader = getLoader();
33
34
		loader.addAttribute(PROCESS_ID, reader.readString(data, offset));
35
		loader.addAttribute(NAME_ATTR, reader.readString(data, offset));
36
		loader.addAttribute(PID, reader.readInt(data, offset));
37
		loader.addAttribute(NODE_ID_REF, reader.readString(data, offset));
38
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
39
		loader.addAttribute(APPLICATION_EXECUTABLE, reader.readString(data, offset));
40
		
41
		return true;
42
	}
43
44
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFTraceEndParser.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFTraceEndParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1006);
24
25
	public static final String NAME = "traceEnd";
26
27
	public BFTraceEndParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
36
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
37
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
38
		
39
		return true;
40
	}
41
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFEncodingParser.java (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFEncodingParser extends BinaryFragmentParser {
21
	public static final Short ID = new Short((short)1);
22
23
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
24
		byte[] data = fragment.getBody();
25
		
26
		String encoding = reader.readString(data, offset);
27
		reader.setEncoding(encoding);
28
		
29
		return true;
30
	}		
31
	
32
	
33
34
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFOptionParser.java (+43 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFOptionParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1008);
24
25
	public static final String NAME = "option";
26
27
	public BFOptionParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		// traceIdRef ignored
36
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
37
		loader.addAttribute(KEY, reader.readString(data, offset));
38
		loader.addAttribute(VALUE, reader.readString(data, offset));
39
		
40
		return true;
41
	}
42
43
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMonWaitParser.java (+50 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFMonWaitParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1032);
24
25
	public static final String NAME = "monWait";
26
27
	public BFMonWaitParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(THREAD_ID_REF, (int)reader.readLong(data, offset));
36
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
37
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
38
		loader.addAttribute(TIMEOUT, reader.readLong(data, offset));
39
40
		// stackDepth
41
		int stackDepth = reader.readInt(data, offset);
42
		String stackMethods[] = reader.readStringArray(data, stackDepth, offset);
43
		addAnnotation(loader, stackMethods, CALL_STACK_METHODS);
44
45
		Long stackLines[] = reader.readLongArray(data, stackDepth, offset);
46
		addAnnotation(loader, stackLines, CALL_STACK_LINES);
47
		
48
		return true;
49
	}
50
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/StringReader.java (+21 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
public interface StringReader {
16
	public void setEncoding(String encoding);
17
	
18
	public String readString(byte[] b, Offset offset);
19
20
	public String[] readStringArray(byte[] b, int length, Offset offset);
21
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/BFParserFactory.java (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
import java.util.HashMap;
16
import java.util.Map;
17
18
import org.eclipse.hyades.loaders.internal.binary.v1.ParserImpl1;
19
import org.eclipse.hyades.loaders.util.HierarchyContext;
20
21
public class BFParserFactory {
22
	private static final Class[] constructorArgs = new Class[] {HierarchyContext.class, BFReader.class};
23
	
24
	private final Map parsers = new HashMap();
25
	
26
	public BFParserFactory() {
27
		ParserImpl1.register(this);
28
	}
29
	
30
	public BFParser get(BFHeader header, HierarchyContext context, BFReader reader) {
31
		Class parserClass = (Class) parsers.get(new Double(header.getVersion().getVersion()));
32
		if (parserClass == null) {
33
			return null;
34
		}
35
			
36
		try {
37
			return (BFParser) parserClass.getConstructor(constructorArgs).newInstance(new Object[] {context, reader});
38
		} catch (Exception ex) {
39
			ex.printStackTrace();
40
		}
41
		
42
		return null;
43
	}
44
45
	public void put(Double version, Class parser) {
46
		parsers.put(version, parser);
47
	}
48
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/NumberReader.java (+31 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
public interface NumberReader {
16
	public short readShort(byte[] b, Offset offset);
17
	
18
	public int readUnsignedShort(byte[] b, Offset offset);
19
20
	public int readInt(byte[] b, Offset offset);
21
	
22
	public long readUnsignedInt(byte[] b, Offset offset);
23
24
	public long readLong(byte[] b, Offset offset);
25
	
26
	public Long[] readLongArray(byte[] b, int length, Offset offset);
27
28
	public void setCpuFrequency(long frequency);
29
	
30
	public double readTimestamp(byte[] b, Offset offset);
31
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFRuntimeShutdownParser.java (+44 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFRuntimeShutdownParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1031);
24
25
	public static final String NAME = "runtimeShutdown";
26
27
	public BFRuntimeShutdownParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int)reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
39
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
40
		
41
		return true;
42
	}
43
44
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/ParserImpl1.java (+218 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import java.io.IOException;
16
import java.io.InputStream;
17
import java.util.HashMap;
18
import java.util.Map;
19
20
import org.eclipse.hyades.loaders.internal.binary.BFParser;
21
import org.eclipse.hyades.loaders.internal.binary.BFParserFactory;
22
import org.eclipse.hyades.loaders.internal.binary.BFReader;
23
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
24
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
25
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
26
import org.eclipse.hyades.loaders.internal.binary.Offset;
27
import org.eclipse.hyades.loaders.util.HierarchyContext;
28
29
public class ParserImpl1 implements BFParser {
30
	
31
	public static final Double version = new Double(1.0);
32
	
33
	// ID (Short) -> Class (class)
34
	Map messageHandlers = new HashMap();
35
	
36
	private final HierarchyContext context;
37
	
38
	private final BFReader reader;
39
	
40
	public ParserImpl1(HierarchyContext context, BFReader reader) {
41
		this.context = context;
42
		this.reader = reader;
43
		initialize();
44
	}
45
46
	protected void initialize() {
47
		// System handlers 0-1000
48
		messageHandlers.put(BFEncodingParser.ID, BFEncodingParser.class);
49
		messageHandlers.put(BFFrequencyParser.ID, BFFrequencyParser.class);
50
		
51
		// Data handlers 1000-32767
52
		messageHandlers.put(BFNodeParser.ID, BFNodeParser.class);
53
		messageHandlers.put(BFProcessCreateParser.ID, BFProcessCreateParser.class);
54
		messageHandlers.put(BFAgentCreateParser.ID, BFAgentCreateParser.class);
55
		messageHandlers.put(BFAgentDestroyParser.ID, BFAgentDestroyParser.class);
56
		messageHandlers.put(BFTraceStartParser.ID, BFTraceStartParser.class);
57
		messageHandlers.put(BFTraceEndParser.ID, BFTraceEndParser.class);
58
		messageHandlers.put(BFFilterParser.ID, BFFilterParser.class);
59
		messageHandlers.put(BFOptionParser.ID, BFOptionParser.class);
60
		messageHandlers.put(BFThreadStartParser.ID, BFThreadStartParser.class);
61
		messageHandlers.put(BFThreadEndParser.ID, BFThreadEndParser.class);
62
		messageHandlers.put(BFClassDefParser.ID, BFClassDefParser.class);
63
		messageHandlers.put(BFMethodDefParser.ID, BFMethodDefParser.class);
64
		messageHandlers.put(BFObjAllocParser.ID, BFObjAllocParser.class);
65
		messageHandlers.put(BFMethodEntryParser.ID, BFMethodEntryParser.class);
66
		messageHandlers.put(BFMethodExitParser.ID, BFMethodExitParser.class);
67
		// Method call ignored
68
		// Method exit ignored
69
		messageHandlers.put(BFInvocationContextParser.ID, BFInvocationContextParser.class);
70
		messageHandlers.put(BFObjDefParser.ID, BFObjDefParser.class);
71
		messageHandlers.put(BFValueParser.ID, BFValueParser.class);
72
		messageHandlers.put(BFMethodCountParser.ID, BFMethodCountParser.class);
73
		messageHandlers.put(BFLineParser.ID, BFLineParser.class);
74
		messageHandlers.put(BFGCStartParser.ID, BFGCStartParser.class);
75
		messageHandlers.put(BFObjFreeParser.ID, BFObjFreeParser.class);
76
		messageHandlers.put(BFClassUnloadParser.ID, BFClassUnloadParser.class);
77
		messageHandlers.put(BFObjMoveParser.ID, BFObjMoveParser.class);
78
		messageHandlers.put(BFGCFinishParser.ID, BFGCFinishParser.class);
79
		messageHandlers.put(BFThrowParser.ID, BFThrowParser.class);
80
		messageHandlers.put(BFCatchParser.ID, BFCatchParser.class);
81
		messageHandlers.put(BFRuntimeInitDoneParser.ID, BFRuntimeInitDoneParser.class);
82
		messageHandlers.put(BFRuntimeShutdownParser.ID, BFRuntimeShutdownParser.class);
83
		messageHandlers.put(BFMonWaitParser.ID, BFMonWaitParser.class);
84
		messageHandlers.put(BFMonWaitedParser.ID, BFMonWaitedParser.class);
85
		messageHandlers.put(BFMonContendedEnterParser.ID, BFMonContendedEnterParser.class);
86
		messageHandlers.put(BFMonContendedEnteredParser.ID, BFMonContendedEnteredParser.class);
87
		messageHandlers.put(BFAGMethodEntryParser.ID, BFAGMethodEntryParser.class);
88
		messageHandlers.put(BFAGMethodExitParser.ID, BFAGMethodExitParser.class);
89
		messageHandlers.put(BFHeapDumpDefParser.ID, BFHeapDumpDefParser.class);
90
		messageHandlers.put(BFGCRootParser.ID, BFGCRootParser.class);
91
		messageHandlers.put(BFObjRefParser.ID, BFObjRefParser.class);
92
		// Insert Custom message parser here
93
		messageHandlers.put(BFMonNotifyCalledParser.ID, BFMonNotifyCalledParser.class);
94
		messageHandlers.put(BFThreadInterruptCalledParser.ID, BFThreadInterruptCalledParser.class);
95
		messageHandlers.put(BFThreadStartCalledParser.ID, BFThreadStartCalledParser.class);
96
	}
97
	
98
	public void parseEvents(byte[] buffer, Offset marker) {
99
		try {
100
			do {
101
				BinaryFragment binaryFragment = getBinaryFragment(buffer, marker);
102
				if (binaryFragment == null) {
103
					break;
104
				} else if (binaryFragment.getId() == null) {
105
					continue;
106
				}
107
				parseBinaryFragment(binaryFragment, marker);
108
			} while (true);
109
		} catch (Throwable e) {
110
			e.printStackTrace();
111
		}
112
	}
113
114
	public void parseEvents(InputStream inputStream, Offset marker) {
115
		try {
116
			do {
117
				BinaryFragment binaryFragment = getBinaryFragment(inputStream, marker);
118
				if (binaryFragment == null) {
119
					break;
120
				} else if (binaryFragment.getId() == null) {
121
					continue;
122
				}
123
				parseBinaryFragment(binaryFragment, marker);
124
			} while (true);
125
		} catch (Throwable e) {
126
			e.printStackTrace();
127
		}
128
	}
129
130
	protected BinaryFragment getBinaryFragment(byte[] buffer, Offset marker) throws IOException {
131
		if (BinaryFragment.isEOF(buffer, marker.getOffset())) {
132
			return null;
133
		}
134
		BinaryFragment binaryFragment = new BinaryFragment(buffer, marker.getOffset(), reader);
135
		if (marker.increaseOffset(BinaryFragment.HEADER_LENGTH) < 0) {
136
			return null;
137
		}
138
		
139
		binaryFragment.setBody(buffer);
140
		binaryFragment.setBodyOffset(marker.getOffset());
141
		if (marker.increaseOffset(binaryFragment.getLength()) < 0) {
142
			return null;
143
		}
144
		
145
		if (binaryFragment.getId() == null) {
146
			System.err.println("Unparseable event " + buffer);
147
		}
148
149
		return binaryFragment;
150
	}
151
	
152
	protected BinaryFragment getBinaryFragment(InputStream inputStream, Offset marker) throws IOException {
153
		byte[] header = new byte[BinaryFragment.HEADER_LENGTH];
154
		if (inputStream.read(header) < 0) {
155
			return null;
156
		}
157
		if (BinaryFragment.isEOF(header, 0)) {
158
			return null;
159
		}
160
		BinaryFragment binaryFragment = new BinaryFragment(header, 0, reader);
161
		if (marker.increaseOffset(BinaryFragment.HEADER_LENGTH) < 0) {
162
			return null;
163
		}
164
165
		byte[] body = new byte[binaryFragment.getLength()];
166
		if(inputStream.read(body) < 0) {
167
			return null;
168
		}
169
170
		binaryFragment.setBody(body);
171
		if (marker.increaseOffset(binaryFragment.getLength()) < 0) {
172
			return null;
173
		}
174
		
175
		if (binaryFragment.getId() == null) {
176
			System.err.println("Unparseable event " + header);
177
		}
178
179
		return binaryFragment;
180
	}
181
	
182
	protected void parseBinaryFragment(BinaryFragment binaryFragment, Offset marker) 
183
			throws InstantiationException, IllegalAccessException {
184
		BinaryFragmentParser fragmentParser = getFragmentParser(binaryFragment.getId());
185
		
186
		if (fragmentParser.getClass().equals(IgnoredBinaryFragmentParser.class)) {
187
			System.err.println("Got unknown message at " + marker.getOffset());
188
		}
189
190
		fragmentParser.initialize(context);
191
		Offset bodyOffset = new Offset(binaryFragment.getBodyOffset(), binaryFragment.getBodyOffset() + binaryFragment.getLength());
192
		if (fragmentParser.parse(binaryFragment, bodyOffset, reader)) {
193
			fragmentParser.addYourselfInContext();
194
			if ((context.getAgent() != null) && (context.getAgent().eResource() != null) && !context.getAgent().eResource().isModified()) {
195
				context.getAgent().eResource().setModified(true);
196
			}
197
		}
198
	}
199
200
	protected BinaryFragmentParser getFragmentParser(Short id) throws InstantiationException, IllegalAccessException {
201
		Class clazz = (Class) messageHandlers.get(id);
202
203
		if (clazz == null) {
204
			return new IgnoredBinaryFragmentParser();
205
		}
206
		BinaryFragmentParser fragmentParser = (BinaryFragmentParser) clazz.newInstance();
207
		if (fragmentParser == null) {
208
			return new IgnoredBinaryFragmentParser();
209
		}
210
		
211
		return fragmentParser; 
212
	}
213
214
	public static void register(BFParserFactory parserFactory) {
215
		parserFactory.put(version, ParserImpl1.class);
216
	}
217
218
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFCatchParser.java (+29 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFCatchParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1029);
23
24
	public static final String NAME = "catch";
25
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
		return true;
28
	}
29
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMonContendedEnteredParser.java (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFMonContendedEnteredParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short) 1035);
24
	
25
	public static final String NAME = "monContendedEntered"; 
26
27
	public BFMonContendedEnteredParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(THREAD_ID_REF, (int) reader.readLong(data, offset));
36
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
37
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
38
39
		long stackDepth = reader.readUnsignedInt(data, offset);
40
41
		String[] stackMethods = reader.readStringArray(data, (int)stackDepth, offset); // Possible truncation
42
		addAnnotation(loader, stackMethods, CALL_STACK_METHODS);
43
44
		Long[] stackLines = reader.readLongArray(data, (int)stackDepth, offset);
45
		addAnnotation(loader, stackLines, CALL_STACK_LINES);
46
			
47
		return true;
48
	}
49
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFClassDefParser.java (+57 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFClassDefParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1011);
24
25
	public static final String NAME = "classDef";
26
27
	public BFClassDefParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int)reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(NUM_INTERFACES, reader.readInt(data, offset));
39
		loader.addAttribute(INTERFACE_NAMES, reader.readString(data, offset));
40
		loader.addAttribute(TRANS_CLASS_ID, reader.readLong(data, offset));
41
		loader.addAttribute(CLASS_ID, reader.readLong(data, offset));
42
		loader.addAttribute(SOURCE_NAME, reader.readString(data, offset));
43
		loader.addAttribute(CLASS_LOADER, reader.readString(data, offset));
44
		loader.addAttribute(SUPER_CLASS, reader.readString(data, offset));
45
		loader.addAttribute(TRANS_OBJ_ID_REF, reader.readLong(data, offset));
46
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
47
		loader.addAttribute(NAME_ATTR, reader.readString(data, offset));
48
		loader.addAttribute(ACCESS, reader.readString(data, offset));
49
		loader.addAttribute(NUM_STATIC_FIELDS, reader.readInt(data, offset));
50
		loader.addAttribute(NUM_METHODS, reader.readInt(data, offset));
51
		loader.addAttribute(NUM_INSTANCE_FIELDS, reader.readInt(data, offset));
52
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
53
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
54
		
55
		return true;
56
	}
57
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFTraceStartParser.java (+43 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFTraceStartParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1005);
24
25
	public static final String NAME = "traceStart";
26
27
	public BFTraceStartParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRACE_ID, reader.readString(data, offset));
36
		loader.addAttribute(AGENT_ID_REF, reader.readString(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
39
		
40
		return true;
41
	}
42
43
}
(-)src-hierarchy/org/eclipse/hyades/loaders/util/BinaryFragmentLoader.java (+25 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.util;
14
15
public interface BinaryFragmentLoader extends XMLFragmentLoader {
16
	public void addAttribute(String name, byte value);
17
18
	public void addAttribute(String name, short value);
19
20
	public void addAttribute(String name, int value);
21
22
	public void addAttribute(String name, long value);
23
24
	public void addAttribute(String name, double value);
25
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMethodEntryParser.java (+50 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFMethodEntryParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1014);
24
25
	public static final String NAME = "methodEntry";
26
27
	public BFMethodEntryParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRANS_THREAD_ID_REF, reader.readLong(data, offset));
36
		loader.addAttribute(THREAD_ID_REF, (int) reader.readLong(data, offset));
37
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
38
		loader.addAttribute(METHOD_ID_REF, (int) reader.readLong(data, offset));
39
		loader.addAttribute(TICKET, reader.readLong(data, offset));
40
		loader.addAttribute(TRANS_OBJ_ID_REF, reader.readLong(data, offset));
41
		loader.addAttribute(CLASS_ID_REF, reader.readLong(data, offset));
42
		loader.addAttribute(THREAD_CPU_TIME, reader.readLong(data, offset));
43
		loader.addAttribute(SEQUENCE_COUNTER, reader.readLong(data, offset));
44
		loader.addAttribute(STACK_DEPTH, (short) reader.readLong(data, offset));
45
		loader.addAttribute(COLLATION_VALUE, reader.readString(data, offset));
46
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
47
		
48
		return true;
49
	}
50
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFHeapDumpDefParser.java (+42 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFHeapDumpDefParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short) 1038);
24
	
25
	public static final String NAME = "heapDumpDef"; 
26
27
	public BFHeapDumpDefParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(HEAP_DUMP_ID_REF, (short) reader.readLong(data, offset));
36
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
37
		loader.addAttribute(NAME_ATTR, reader.readString(data, offset));
38
		loader.addAttribute(BASE_TIME, reader.readTimestamp(data, offset));
39
		
40
		return true;
41
	}
42
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFObjMoveParser.java (+33 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFObjMoveParser extends BinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1026);
23
24
	public static final String NAME = "objMove";
25
26
	public BFObjMoveParser() {
27
		super(ID, NAME);
28
	}
29
	
30
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
31
		return true;
32
	}
33
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFFilterParser.java (+47 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFFilterParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1007);
24
25
	public static final String NAME = "filter";
26
27
	public BFFilterParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(TRACE_ID_REF, reader.readString(data, offset));
36
		loader.addAttribute(PATTERN, reader.readString(data, offset));
37
		loader.addAttribute(GENERIC_PATTERN, reader.readString(data, offset));
38
		loader.addAttribute(MODE, reader.readString(data, offset));
39
		loader.addAttribute(METHOD_PATTERN, reader.readString(data, offset));
40
		loader.addAttribute(METHOD_GENERIC_PATTERN, reader.readString(data, offset));
41
		loader.addAttribute(METHOD_MODE, reader.readString(data, offset));
42
		
43
		return true;
44
	}
45
46
47
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/IgnoredBinaryFragmentParser.java (+20 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
public class IgnoredBinaryFragmentParser extends BinaryFragmentParser {
16
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
17
		System.out.println("Ignored handler was invoked for id [" + fragment.getId() + "]");
18
		return true;
19
	}
20
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFObjDefParser.java (+43 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFObjDefParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1019);
23
24
	public static final String NAME = "objDef";
25
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
28
//		// objId ignored
29
//		reader.readLong(data, offset);
30
//		// isArray ignored
31
//		reader.readByte(data, offset);
32
//		// size ignored
33
//		reader.readLong(data, offset);
34
//		// classIdRef ignored
35
//		reader.readLong(data, offset);
36
//		// colValue ignored
37
//		reader.readString(data, offset);
38
//		// traceIdRef ignored
39
//		reader.readString(data, offset);
40
		
41
		return true;
42
	}
43
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/BFParser.java (+21 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary;
14
15
import java.io.InputStream;
16
17
public interface BFParser {
18
	public void parseEvents(InputStream inputStream, Offset marker);
19
20
	public void parseEvents(byte[] buffer, Offset marker);
21
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMethodCountParser.java (+29 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.IgnoredBinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
20
public class BFMethodCountParser extends IgnoredBinaryFragmentParser {
21
22
	public static final Short ID = new Short((short)1021);
23
24
	public static final String NAME = "methodCount";
25
26
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
27
		return true;
28
	}
29
}
(-)src-hierarchy/org/eclipse/hyades/loaders/internal/binary/v1/BFMonWaitedParser.java (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Stanislav Polevic, Intel - Initial API and Implementation 
10
 * 	  
11
 * $Id: 
12
 *******************************************************************************/
13
package org.eclipse.hyades.loaders.internal.binary.v1;
14
15
import org.eclipse.hyades.loaders.internal.binary.BFReader;
16
import org.eclipse.hyades.loaders.internal.binary.BinaryFragment;
17
import org.eclipse.hyades.loaders.internal.binary.BinaryFragmentParser;
18
import org.eclipse.hyades.loaders.internal.binary.Offset;
19
import org.eclipse.hyades.loaders.util.BinaryFragmentLoader;
20
21
public class BFMonWaitedParser extends BinaryFragmentParser {
22
23
	public static final Short ID = new Short((short)1033);
24
25
	public static final String NAME = "monWaited";
26
27
	public BFMonWaitedParser() {
28
		super(ID, NAME);
29
	}
30
	
31
	public boolean parse(BinaryFragment fragment, Offset offset, BFReader reader) {
32
		byte[] data = fragment.getBody();
33
		BinaryFragmentLoader loader = getLoader();
34
35
		loader.addAttribute(THREAD_ID_REF, (int)reader.readLong(data, offset));
36
		loader.addAttribute(TIME, reader.readTimestamp(data, offset));
37
		loader.addAttribute(OBJ_ID_REF, reader.readLong(data, offset));
38
		loader.addAttribute(TIMEOUT, reader.readLong(data, offset));
39
		// stackDepth
40
		int stackDepth = reader.readInt(data, offset);
41
		String stackMethods[] = reader.readStringArray(data, stackDepth, offset);
42
		addAnnotation(loader, stackMethods, CALL_STACK_METHODS);
43
44
		Long stackLines[] = reader.readLongArray(data, stackDepth, offset);
45
		addAnnotation(loader, stackLines, CALL_STACK_LINES);
46
		
47
		return true;
48
	}
49
}

Return to bug 209343