filter out tfstreamz plane when generate trace events.

PiperOrigin-RevId: 310029769
Change-Id: I2de5ad241da6eb3ebcee651e01beac16275a1acd
This commit is contained in:
A. Unique TensorFlower 2020-05-05 15:08:36 -07:00 committed by TensorFlower Gardener
parent 8e29dc7714
commit 30559f13a1

View File

@ -249,10 +249,17 @@ void SortXSpace(XSpace* space) {
for (XPlane& plane : *space->mutable_planes()) SortXPlane(&plane);
}
// Normalize the line's timestamp in this XPlane.
// NOTE: This can be called multiple times on the same plane. Only the first
// call will do the normalization, subsequent calls will do nothing.
// The assumption is that both line's timestamp_ns and start_time_ns are
// nano-seconds from epoch time, the different of these values is much
// smaller than these value.
void NormalizeTimestamps(XPlane* plane, uint64 start_time_ns) {
for (XLine& line : *plane->mutable_lines()) {
DCHECK_GE(line.timestamp_ns(), start_time_ns);
line.set_timestamp_ns(line.timestamp_ns() - start_time_ns);
if (line.timestamp_ns() >= start_time_ns) {
line.set_timestamp_ns(line.timestamp_ns() - start_time_ns);
}
}
}