import java.util.Set;
-import org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStrings;
+import org.eclipse.tracecompass.internal.lttng2.ust.core.LttngUstEventStrings;
import org.eclipse.tracecompass.lttng2.control.core.session.SessionConfigStrings;
import org.eclipse.tracecompass.lttng2.ust.core.analysis.memory.UstMemoryAnalysisModule;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement;
/* Events */
Set<String> expectedEvents = ImmutableSet.of(
- UstMemoryStrings.MALLOC,
- UstMemoryStrings.FREE,
- UstMemoryStrings.CALLOC,
- UstMemoryStrings.REALLOC,
- UstMemoryStrings.MEMALIGN,
- UstMemoryStrings.POSIX_MEMALIGN
+ LttngUstEventStrings.MALLOC,
+ LttngUstEventStrings.FREE,
+ LttngUstEventStrings.CALLOC,
+ LttngUstEventStrings.REALLOC,
+ LttngUstEventStrings.MEMALIGN,
+ LttngUstEventStrings.POSIX_MEMALIGN
);
assertEquals(6, eventReq.getValues().size());
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson, École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.ust.core;
+
+/**
+ * Strings related to UST traces and convenience libraries.
+ *
+ * @author Matthew Khouzam
+ * @author Geneviève Bastien
+ * @noimplement This interface only contains static definitions.
+ */
+@SuppressWarnings({ "nls", "javadoc" })
+public interface LttngUstEventStrings {
+
+ /* UST_libc event names */
+ String MALLOC = "ust_libc:malloc";
+ String CALLOC = "ust_libc:calloc";
+ String REALLOC = "ust_libc:realloc";
+ String FREE = "ust_libc:free";
+ String MEMALIGN = "ust_libc:memalign";
+ String POSIX_MEMALIGN = "ust_libc:posix_memalign";
+
+ /* Possible contexts */
+ String CONTEXT_VTID = "context._vtid";
+ String CONTEXT_PROCNAME = "context._procname";
+
+ /* Event fields */
+ String FIELD_PTR = "ptr";
+ String FIELD_NMEMB = "nmemb";
+ String FIELD_SIZE = "size";
+ String FIELD_OUTPTR = "out_ptr";
+ String FIELD_INPTR = "in_ptr";
+
+}
import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.lttng2.ust.core.LttngUstEventStrings;
import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
protected void eventHandle(ITmfEvent event) {
String name = event.getName();
switch (name) {
- case UstMemoryStrings.MALLOC: {
- Long ptr = (Long) event.getContent().getField(UstMemoryStrings.FIELD_PTR).getValue();
+ case LttngUstEventStrings.MALLOC: {
+ Long ptr = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_PTR).getValue();
if (ZERO.equals(ptr)) {
return;
}
- Long size = (Long) event.getContent().getField(UstMemoryStrings.FIELD_SIZE).getValue();
+ Long size = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_SIZE).getValue();
setMem(event, ptr, size);
}
break;
- case UstMemoryStrings.FREE: {
- Long ptr = (Long) event.getContent().getField(UstMemoryStrings.FIELD_PTR).getValue();
+ case LttngUstEventStrings.FREE: {
+ Long ptr = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_PTR).getValue();
if (ZERO.equals(ptr)) {
return;
}
setMem(event, ptr, ZERO);
}
break;
- case UstMemoryStrings.CALLOC: {
- Long ptr = (Long) event.getContent().getField(UstMemoryStrings.FIELD_PTR).getValue();
+ case LttngUstEventStrings.CALLOC: {
+ Long ptr = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_PTR).getValue();
if (ZERO.equals(ptr)) {
return;
}
- Long nmemb = (Long) event.getContent().getField(UstMemoryStrings.FIELD_NMEMB).getValue();
- Long size = (Long) event.getContent().getField(UstMemoryStrings.FIELD_SIZE).getValue();
+ Long nmemb = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_NMEMB).getValue();
+ Long size = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_SIZE).getValue();
setMem(event, ptr, size * nmemb);
}
break;
- case UstMemoryStrings.REALLOC: {
- Long ptr = (Long) event.getContent().getField(UstMemoryStrings.FIELD_PTR).getValue();
+ case LttngUstEventStrings.REALLOC: {
+ Long ptr = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_PTR).getValue();
if (ZERO.equals(ptr)) {
return;
}
- Long newPtr = (Long) event.getContent().getField(UstMemoryStrings.FIELD_INPTR).getValue();
- Long size = (Long) event.getContent().getField(UstMemoryStrings.FIELD_SIZE).getValue();
+ Long newPtr = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_INPTR).getValue();
+ Long size = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_SIZE).getValue();
setMem(event, ptr, ZERO);
setMem(event, newPtr, size);
}
break;
- case UstMemoryStrings.MEMALIGN: {
- Long ptr = (Long) event.getContent().getField(UstMemoryStrings.FIELD_PTR).getValue();
+ case LttngUstEventStrings.MEMALIGN: {
+ Long ptr = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_PTR).getValue();
if (ZERO.equals(ptr)) {
return;
}
- Long size = (Long) event.getContent().getField(UstMemoryStrings.FIELD_SIZE).getValue();
+ Long size = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_SIZE).getValue();
setMem(event, ptr, size);
}
break;
- case UstMemoryStrings.POSIX_MEMALIGN: {
- Long ptr = (Long) event.getContent().getField(UstMemoryStrings.FIELD_OUTPTR).getValue();
+ case LttngUstEventStrings.POSIX_MEMALIGN: {
+ Long ptr = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_OUTPTR).getValue();
if (ZERO.equals(ptr)) {
return;
}
- Long size = (Long) event.getContent().getField(UstMemoryStrings.FIELD_SIZE).getValue();
+ Long size = (Long) event.getContent().getField(LttngUstEventStrings.FIELD_SIZE).getValue();
setMem(event, ptr, size);
}
break;
}
private static Long getVtid(ITmfEvent event) {
- ITmfEventField field = event.getContent().getField(UstMemoryStrings.CONTEXT_VTID);
+ ITmfEventField field = event.getContent().getField(LttngUstEventStrings.CONTEXT_VTID);
if (field == null) {
return MINUS_ONE;
}
}
private static String getProcname(ITmfEvent event) {
- ITmfEventField field = event.getContent().getField(UstMemoryStrings.CONTEXT_PROCNAME);
+ ITmfEventField field = event.getContent().getField(LttngUstEventStrings.CONTEXT_PROCNAME);
if (field == null) {
return EMPTY_STRING;
}
* @author Matthew Khouzam
* @author Geneviève Bastien
*/
-@SuppressWarnings({ "nls", "javadoc" })
+@SuppressWarnings("nls")
public interface UstMemoryStrings {
/** Memory state system attribute name */
- static final String UST_MEMORY_MEMORY_ATTRIBUTE = "Memory"; //$NON-NLS-1$
- /** Procname state system attribute name */
- static final String UST_MEMORY_PROCNAME_ATTRIBUTE = "Procname"; //$NON-NLS-1$
- /** Name of the attribute to store memory usage of events with no context */
- static final String OTHERS = "Others";
-
- /* UST_libc event names */
- static final String MALLOC = "ust_libc:malloc";
- static final String CALLOC = "ust_libc:calloc";
- static final String REALLOC = "ust_libc:realloc";
- static final String FREE = "ust_libc:free";
- static final String MEMALIGN = "ust_libc:memalign";
- static final String POSIX_MEMALIGN = "ust_libc:posix_memalign";
+ String UST_MEMORY_MEMORY_ATTRIBUTE = "Memory";
- /* Possible contexts */
- static final String CONTEXT_VTID = "context._vtid";
- static final String CONTEXT_PROCNAME = "context._procname";
+ /** Procname state system attribute name */
+ String UST_MEMORY_PROCNAME_ATTRIBUTE = "Procname";
- /* Event fields */
- static final String FIELD_PTR = "ptr";
- static final String FIELD_NMEMB = "nmemb";
- static final String FIELD_SIZE = "size";
- static final String FIELD_OUTPTR = "out_ptr";
- static final String FIELD_INPTR = "in_ptr";
+ /** Name of the attribute to store memory usage of events with no context */
+ String OTHERS = "Others";
-}
+}
\ No newline at end of file
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.lttng2.ust.core.LttngUstEventStrings;
import org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStateProvider;
-import org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStrings;
import org.eclipse.tracecompass.lttng2.control.core.session.SessionConfigStrings;
import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement;
public static final @NonNull String ID = "org.eclipse.linuxtools.lttng2.ust.analysis.memory"; //$NON-NLS-1$
private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of(
- UstMemoryStrings.MALLOC,
- UstMemoryStrings.FREE,
- UstMemoryStrings.CALLOC,
- UstMemoryStrings.REALLOC,
- UstMemoryStrings.MEMALIGN,
- UstMemoryStrings.POSIX_MEMALIGN
+ LttngUstEventStrings.MALLOC,
+ LttngUstEventStrings.FREE,
+ LttngUstEventStrings.CALLOC,
+ LttngUstEventStrings.REALLOC,
+ LttngUstEventStrings.MEMALIGN,
+ LttngUstEventStrings.POSIX_MEMALIGN
);
/** The requirements as an immutable set */