Skip to content

Commit 8a9f52d

Browse files
committed
add trace tool to support libva trace process
Signed-off-by: Lindong Wu <[email protected]>
1 parent 11bc130 commit 8a9f52d

30 files changed

+5919
-0
lines changed

tracetool/Manifest/Intel-Media-Open.json

+1,958
Large diffs are not rendered by default.

tracetool/Manifest/libva_trace.man

+612
Large diffs are not rendered by default.

tracetool/Modules/RTLog.py

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os
2+
from util import *
3+
4+
5+
class traceHandler:
6+
compMap = ['Common', 'CP', 'VP', 'Decode', 'Encode']
7+
8+
def __init__(self, core):
9+
self.sharedCtx = core.getContext()
10+
self.fp = None
11+
12+
core.regHandler('Intel-Media', 'MediaRuntimeLog', self.rtLog)
13+
core.regHandler('Intel-Media', 'MediaRuntimeError', self.rtLog)
14+
15+
def writeOutput(self, line):
16+
if self.fp == None:
17+
self.fp = open(self.sharedCtx['Output'] + '_rtlog.txt', 'w')
18+
self.fp.write(line)
19+
20+
def stripField(self, evt):
21+
data = evt['data']
22+
out = []
23+
comp = int(GetEnumVal(data['LogId'])) >> 24
24+
out.append(self.compMap[comp])
25+
id = GetEnumName(data['LogId'])[3:] # remove prefix MT_
26+
out.append(id)
27+
if 'LogLevel' in data:
28+
out.append(GetEnumName(data['LogLevel']))
29+
else:
30+
out.append('Error')
31+
cnt = len(data)//2
32+
for i in range(1, cnt):
33+
n = GetEnumName(data['Id'+str(i)])[3:] # remove prefix MT_
34+
v = GetEnumName(data['Value'+str(i)])
35+
out.append(n+': '+v)
36+
return out
37+
38+
def rtLog(self, evt):
39+
out = self.stripField(evt)
40+
txt = '{:<10d} {:<6} {:<6} {:<6s} {:<30s} {:<8s}'.format(evt['ts'], evt['pid'], evt['tid'], out[0], out[1], out[2])
41+
for i in out[3:]:
42+
txt += ' ' + i
43+
self.writeOutput(txt+'\n')
44+
return -1
45+
46+
def __del__(self):
47+
if self.fp:
48+
self.fp.close()

0 commit comments

Comments
 (0)