Skip to content

Commit

Permalink
tmf: Add TIME_RANGE to the DataType enum for data providers
Browse files Browse the repository at this point in the history
[Added] TIME_RANGE to the DataType enum for data providers

Change-Id: I3a5923e58ad322f49740ab7401d977815163f14b
Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/199991
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
  • Loading branch information
bhufmann committed Mar 14, 2023
1 parent e379f32 commit 4c7be9d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2020 École Polytechnique de Montréal
* Copyright (c) 2020, 2023 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand Down Expand Up @@ -37,6 +37,11 @@ public enum DataType {
/**
* Data is textual data
*/
STRING;

STRING,
/**
* Data representing a time range of string: [start,end],
* where `start` and `end` are timestamps in nanoseconds
* @since 8.3
*/
TIME_RANGE;
}
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2020 École Polytechnique de Montréal
* Copyright (c) 2020, 2023 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand Down Expand Up @@ -96,10 +96,25 @@ public static Format getFormat(DataType type, String units) {
return SubSecondTimeWithUnitFormat.getInstance();
case STRING:
return OTHER_FORMAT;
case TIME_RANGE:
return OTHER_FORMAT;
default:
// Return the default format
return OTHER_FORMAT;
}
}

/**
* Converts a time range (start, end) in a DataType string.
*
* @param start
* The start time
* @param end
* The end time
* @return A standard Time Range string
* @since 8.3
*/
public static String toRangeString(long start, long end) {
return "[" + start + "," + end + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}

0 comments on commit 4c7be9d

Please sign in to comment.