[Intel-gfx] [igt-dev] [PATCH i-g-t 1/9] trace.pl: Improve time axis labels

John Harrison John.C.Harrison at Intel.com
Thu Jul 12 22:35:37 UTC 2018


On 7/12/2018 5:42 AM, Tvrtko Ursulin wrote:
>
> On 12/07/2018 11:59, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> It is possible to customize the axis display so change it to display
>> timestamps in seconds on the major axis (with six decimal spaces) and
>> relative millisecond offsets on the minor axis.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>> Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
>> Cc: Chris Wilson <chris at chris-wilson.co.uk>
>> Cc: John Harrison <John.C.Harrison at Intel.com>
>> ---
>>   scripts/trace.pl | 32 ++++++++++++++++++++++++++++++++
>>   1 file changed, 32 insertions(+)
>>
>> diff --git a/scripts/trace.pl b/scripts/trace.pl
>> index fc1713e4f9a7..89491125490d 100755
>> --- a/scripts/trace.pl
>> +++ b/scripts/trace.pl
>> @@ -1000,6 +1000,37 @@ $first_ts = ts($first_ts);
>>   print <<ENDHTML;
>>     ]);
>>   +  var last_major_ms;
>> +
>> +  function majorAxis(date, scale, step) {
>> +    var s = date / 1000;
>> +
>> +    last_major_ms = date;
>> +
>> +    if (scale == 'millisecond')
>> +        return s.toFixed(6) + "s";
>> +    else if (scale == 'second')
>> +        return s.toFixed(3) + "s";
>> +    else
>> +        return s.toFixed(0) + "s";
>> +  }
>> +
>> +  function minorAxis(date, scale, step) {
>> +    var ms = date;
>> +
>> +    ms -= last_major_ms;
>
> This logic is unfortunately a bit dodgy. It looked like major label is 
> getting called before the minor ones, so I thought I could calculate 
> the relative offset for the minor for a more readable display. But 
> after scrolling and zooming around timelines some more I can see cases 
> where that doesn't seem to be the case.
>
> Please have a play and if you think it is bad they only option will be 
> to absolute time for minor labels as well.

Something is completely broken for me. I am getting massively out of 
whack timeline values. For example, a log file entry of 761846.983987 is 
being displayed as -59196268.216013s! Even ignoring that, I'm not 
convinced about the relative offset thing. It makes it much harder to 
correlate the graph with the trace file entries, e.g. if trying to work 
out exactly what happened when something went peculiar in a test. Would 
it be possible to make it dynamically switchable between raw absolute 
values and the funky change-as-you-scroll relative ones?

Also, it doesn't seem especially useful to have the values be relative 
to the left most edge of the visible portion of the timeline. That means 
that when you scroll sideways along the timeline, the time-stamp of any 
given point wanders up and down accordingly. That just seems confusing 
to me! Maybe it makes sense for some use cases but I would have thought 
that having the values be relative to the start of the trace would be 
more use. Or even have clickable anchor points so that you can set the 
origin to be whatever exciting event you are interested in? Although 
that might be way too complex to be worth the effort of implementing :).


>
> Regards,
>
> Tvrtko
>
>> +
>> +    if (ms < 0)
>> +        return '';
>> +
>> +    if (scale == 'millisecond')
>> +        return "+" + ms.toFixed(3) + "ms";
>> +    else if (scale == 'second')
>> +        return ms.toFixed(3) + "s";
>> +    else
>> +        return ms.toFixed(0) + "s";
>> +  }
>> +
>>     // Configuration for the Timeline
>>     var options = { groupOrder: 'content',
>>             horizontalScroll: true,
>> @@ -1007,6 +1038,7 @@ print <<ENDHTML;
>>             stackSubgroups: false,
>>             zoomKey: 'ctrlKey',
>>             orientation: 'top',
>> +          format: { majorLabels: majorAxis, minorLabels: minorAxis },
>>             start: '$first_ts',
>>             end: '$end_ts'};
>>



More information about the Intel-gfx mailing list