/*******************************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Alexandre Montplaisir - Initial API and implementation
+ * Patrick Tasse - Add support for thread id
*******************************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ust.core.trace.callstack;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.linuxtools.lttng2.ust.core.trace.LttngUstTrace;
import org.eclipse.linuxtools.tmf.core.callstack.CallStackStateProvider;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
/**
* Callstack provider for LTTng-UST traces.
private static final String FIELD_ADDR = "addr"; //$NON-NLS-1$
/** Event names indicating function entry */
- private static final Set<String> FUNC_ENTRY_EVENTS = new HashSet<String>();
+ private static final Set<String> FUNC_ENTRY_EVENTS = new HashSet<>();
/** Event names indicating function exit */
- private static final Set<String> FUNC_EXIT_EVENTS = new HashSet<String>();
+ private static final Set<String> FUNC_EXIT_EVENTS = new HashSet<>();
static {
/* This seems overkill, but it will be checked every event. Gotta go FAST! */
* Version number of this state provider. Please bump this if you modify
* the contents of the generated state history in some way.
*/
- private static final int VERSION = 1;
+ private static final int VERSION = 2;
// ------------------------------------------------------------------------
// Constructor
* @param trace
* The UST trace
*/
- public LttngUstCallStackProvider(LttngUstTrace trace) {
+ public LttngUstCallStackProvider(ITmfTrace trace) {
super(trace);
}
// Methods from AbstractTmfStateProvider
// ------------------------------------------------------------------------
- @Override
- public LttngUstTrace getTrace() {
- /* Type is enforced by the constructor */
- return (LttngUstTrace) super.getTrace();
- }
-
@Override
public LttngUstCallStackProvider getNewInstance() {
return new LttngUstCallStackProvider(getTrace());
@Override
public String functionEntry(ITmfEvent event) {
- String eventName = ((CtfTmfEvent) event).getEventName();
+ String eventName = event.getType().getName();
if (!FUNC_ENTRY_EVENTS.contains(eventName)) {
return null;
}
@Override
public String functionExit(ITmfEvent event) {
- String eventName = ((CtfTmfEvent) event).getEventName();
+ String eventName = event.getType().getName();
if (!FUNC_EXIT_EVENTS.contains(eventName)) {
return null;
}
return new String(procName + '-' + vtid.toString());
}
+
+ @Override
+ protected Long getThreadId(ITmfEvent event) {
+ ITmfEventField content = ((CtfTmfEvent) event).getContent();
+ return (Long) content.getField(CONTEXT_VTID).getValue();
+ }
}