Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ctf.core: Implement parsing of clock fragments
Add logic to parse CTF2 clock fragments and therefore allow for timestamp readings in CTF2. This implementation can be tested with a modified version of [1] that will be shared (updated to include CTF2-SPECRC-7.0 terminology) and can be compared with the equivalent CTF1 trace [2]. Babeltrace has yet to share tests that include clock origins, so those cannot be tested yet. An additional change was made to remove the datastream TODO that was left over from a previous patch. [1]https://review.lttng.org/plugins/gitiles/babeltrace/+/refs/heads/ctf2/tests/data/ctf-traces/2/succeed/barectf-event-before-packet/ [2]https://review.lttng.org/plugins/gitiles/babeltrace/+/refs/heads/ctf2/tests/data/ctf-traces/1/succeed/barectf-event-before-packet/ Change-Id: I46c2de5305b72ce8e4ef4834708b5887bd811bfc Signed-off-by: Sehr Moosabhoy <sehr.moosabhoy@ericsson.com> Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/203658 Tested-by: Marco Miller <marco.miller@ericsson.com> Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org> Reviewed-by: Marco Miller <marco.miller@ericsson.com>
- Loading branch information
1 parent
d92746e
commit 112e72d
Showing
6 changed files
with
333 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...rg/eclipse/tracecompass/internal/ctf/core/event/metadata/JsonClockOriginMetadataNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Ericsson | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 which | ||
* accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Sehr Moosabhoy - Initial implementation | ||
*******************************************************************************/ | ||
package org.eclipse.tracecompass.internal.ctf.core.event.metadata; | ||
|
||
import org.eclipse.tracecompass.internal.ctf.core.event.types.ICTFMetadataNode; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* Node to store the clock origin object for CTF2 traces | ||
* | ||
* @author Sehr Moosabhoy | ||
*/ | ||
public class JsonClockOriginMetadataNode extends CTFJsonMetadataNode { | ||
|
||
@SerializedName("namespace") | ||
private String fNamespace; | ||
@SerializedName("name") | ||
private final String fName; | ||
@SerializedName("uid") | ||
private final String fUid; | ||
|
||
/** | ||
* Constructor for a JsonClockOriginMetadataNode | ||
* | ||
* @param parent | ||
* the parent of this node | ||
* @param type | ||
* the type of this node | ||
* @param value | ||
* the value of this node | ||
* @param name | ||
* the name of the clock origin described in this node | ||
* @param uid | ||
* the uid of the clock origin described in this node | ||
*/ | ||
public JsonClockOriginMetadataNode(ICTFMetadataNode parent, String type, String value, String name, String uid) { | ||
super(parent, type, value); | ||
fName = name; | ||
fUid = uid; | ||
} | ||
|
||
/** | ||
* Get the namespace of the node | ||
* | ||
* @return the namespace | ||
*/ | ||
public String getNamespace() { | ||
return fNamespace; | ||
} | ||
|
||
/** | ||
* Get the name of the node | ||
* | ||
* @return the name | ||
*/ | ||
public String getName() { | ||
return fName; | ||
} | ||
|
||
/** | ||
* Get the uid of the node | ||
* | ||
* @return the uid | ||
*/ | ||
public String getUid() { | ||
return fUid; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj instanceof JsonClockOriginMetadataNode) { | ||
JsonClockOriginMetadataNode clock = (JsonClockOriginMetadataNode) obj; | ||
if (fName.equals(clock.getName()) && fNamespace.equals(clock.getNamespace()) && fUid.equals(clock.getUid())) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return super.hashCode(); | ||
} | ||
} |
Oops, something went wrong.