[Intel-gfx] [PATCH i-g-t] scripts/trace.pl: Optimize event parsing and processing

Chris Wilson chris at chris-wilson.co.uk
Tue Dec 19 15:02:24 UTC 2017


Quoting Tvrtko Ursulin (2017-12-19 11:15:39)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> A couple of small optimizations which altogether bring around 30%
> improvement in my testing.
> 
> 1. Do less string processing on tracepoints names and push more of the
>    check into the if-ladder.
> 
> 2. Pull out common db key and ctx processing and cache common values in
>    local vars.
> 
> 3. Key value pair parsing is faster with a regexp.
> 
> 4. Avoid sorting the db hash multiple times if possible.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: John Harrison <John.C.Harrison at intel.com>
> ---
>  scripts/trace.pl | 114 ++++++++++++++++++++++++-------------------------------
>  1 file changed, 49 insertions(+), 65 deletions(-)
> ---
> John please check if this helps with your monster traces before we decide
> if it is worth putting this in. Well, there isn't much of a downside
> except touching something which works and risking breaking it.

Could you run the same trace and do something like
	time trace1 < input > output1.html
	time trace2 < input > output2.html
	cmp output1.html output2.html
?
-Chris


More information about the Intel-gfx mailing list