Add some precision back to timestamps when using --trace
Optimizations to JSON size (%f -> %g) changed the meaning of the digits argument, causing these timestamps to become severely truncated. Traces have been fairly useless as a result (too many events starting/stopping at the same time). This adds enough digits back that things are better. Change-Id: I3f2d2a3dd064daf8449ac34ab5440f95e339a392 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221346 Commit-Queue: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
90507286cc
commit
b500ef7a76
@ -220,10 +220,10 @@ static void trace_event_to_json(SkJSONWriter* writer,
|
||||
// (standard time unit for tracing JSON files).
|
||||
uint64_t relativeTimestamp =
|
||||
static_cast<int64_t>(traceEvent->fClockBegin - serializationState->fClockOffset);
|
||||
writer->appendDoubleDigits("ts", static_cast<double>(relativeTimestamp) * 1E-3, 3);
|
||||
writer->appendDouble("ts", static_cast<double>(relativeTimestamp) * 1E-3);
|
||||
if (0 != traceEvent->fClockEnd) {
|
||||
double dur = static_cast<double>(traceEvent->fClockEnd - traceEvent->fClockBegin) * 1E-3;
|
||||
writer->appendDoubleDigits("dur", dur, 3);
|
||||
writer->appendDouble("dur", dur);
|
||||
}
|
||||
|
||||
writer->appendS64("tid", serializationState->getShortThreadID(traceEvent->fThreadID));
|
||||
|
Loading…
Reference in New Issue
Block a user