/*******************************************************************************
- * 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
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! */
FUNC_EXIT_EVENTS.add("lttng_ust_cyg_profile_fast:func_exit"); //$NON-NLS-1$
}
+ /**
+ * 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;
+
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
* @param trace
* The UST trace
*/
- public LttngUstCallStackProvider(LttngUstTrace trace) {
+ public LttngUstCallStackProvider(ITmfTrace trace) {
super(trace);
}
// ------------------------------------------------------------------------
@Override
- public LttngUstTrace getTrace() {
- /* Type is enforced by the constructor */
- return (LttngUstTrace) super.getTrace();
+ public LttngUstCallStackProvider getNewInstance() {
+ return new LttngUstCallStackProvider(getTrace());
}
@Override
- public LttngUstCallStackProvider getNewInstance() {
- return new LttngUstCallStackProvider(getTrace());
+ public int getVersion() {
+ return VERSION;
}
// ------------------------------------------------------------------------
@Override
public String functionEntry(ITmfEvent event) {
- String eventName = ((CtfTmfEvent) event).getEventName();
+ String eventName = event.getType().getName();
if (!FUNC_ENTRY_EVENTS.contains(eventName)) {
return null;
}
Long address = (Long) event.getContent().getField(FIELD_ADDR).getValue();
- return getFunctionNameFromAddress(address.longValue());
+ return Long.toHexString(address);
}
@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 CallStackStateProvider.UNDEFINED;
}
Long address = (Long) field.getValue();
- return getFunctionNameFromAddress(address.longValue());
+ return Long.toHexString(address);
}
@Override
return new String(procName + '-' + vtid.toString());
}
-
- // ------------------------------------------------------------------------
- // Internal helper methods
- // ------------------------------------------------------------------------
-
- private static String getFunctionNameFromAddress(long address) {
- /*
- * We do not support getting the real function name yet, just print the
- * hex string.
- */
- return new String("0x" + Long.toHexString(address)); //$NON-NLS-1$
- }
}