Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Khouzam2014-08-21 14:52:16 +0000
committerMatthew Khouzam2014-09-15 14:55:02 +0000
commit67420e3f501d5368f953a7ab32361dbfef0ba845 (patch)
treef0c97bb2514975731b9dc5024268ae6fe8d3d7e0
parent107852ad9b594a6843475953acb1885ae6db862d (diff)
downloadorg.eclipse.linuxtools-67420e3f501d5368f953a7ab32361dbfef0ba845.tar.gz
org.eclipse.linuxtools-67420e3f501d5368f953a7ab32361dbfef0ba845.tar.xz
org.eclipse.linuxtools-67420e3f501d5368f953a7ab32361dbfef0ba845.zip
tmf/ctf: lower memory usage of events with fixed length strings
Change-Id: I87149b8cb1c94e8fea8a90801cd254d9c3dc02ea Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/32075 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Hudson CI
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventField.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventField.java b/lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventField.java
index 34e1ae9548..0f2496f29f 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventField.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventField.java
@@ -132,20 +132,26 @@ public abstract class CtfTmfEventField extends TmfEventField {
Collection<Definition> definitions = arrayDef.getDefinitions();
elemType = arrDecl.getElementType();
if (elemType instanceof IntegerDeclaration) {
- /* Array of integers => CTFIntegerArrayField */
+ /* Array of integers => CTFIntegerArrayField, unless it's a CTFStringField */
IntegerDeclaration elemIntType = (IntegerDeclaration) elemType;
- long[] values = new long[arrayDef.getLength()];
- for (int i = 0; i < arrayDef.getLength(); i++) {
- IDefinition elem = arrayDef.getDefinitions().get(i);
- if (elem == null) {
- break;
+ /* Are the integers characters and encoded? */
+ if (elemIntType.isCharacter()) {
+ /* it's a CTFStringField */
+ field = new CTFStringField(fieldName, arrayDef.toString());
+ } else {
+ /* it's a CTFIntegerArrayField */
+ long[] values = new long[arrayDef.getLength()];
+ for (int i = 0; i < arrayDef.getLength(); i++) {
+ IDefinition elem = arrayDef.getDefinitions().get(i);
+ if (elem == null) {
+ break;
+ }
+ values[i] = ((IntegerDefinition) elem).getValue();
}
- values[i] = ((IntegerDefinition) elem).getValue();
+ field = new CTFIntegerArrayField(fieldName, values,
+ elemIntType.getBase(),
+ elemIntType.isSigned());
}
- field = new CTFIntegerArrayField(fieldName, values,
- elemIntType.getBase(),
- elemIntType.isSigned());
-
} else {
/* Arrays of elements of any other type */
CtfTmfEventField[] elements = new CtfTmfEventField[arrayDef.getLength()];

Back to the top