tracer: gsttr-stats: add a fast path for tracer-entry matching

Extract the structure name from the string and only parse the full structure,
if we are going to handle it.
This commit is contained in:
Stefan Sauer 2016-12-22 16:23:02 +01:00
parent 3932b3f944
commit 5eeba8c979

View file

@ -77,13 +77,12 @@ class Stats(Analyzer):
if event[Parser.F_FUNCTION]:
return
try:
s = Structure(event[Parser.F_MESSAGE])
except ValueError:
logger.warning("failed to parse: '%s'", event[Parser.F_MESSAGE])
msg = event[Parser.F_MESSAGE]
p = msg.find(',')
if p == -1:
return
entry_name = s.name
entry_name = msg[:p]
if self.classes:
if not any([fnmatch(entry_name, c) for c in self.classes]):
return
@ -92,6 +91,12 @@ class Stats(Analyzer):
if not record:
return
try:
s = Structure(msg)
except ValueError:
logger.warning("failed to parse: '%s'", msg)
return
# aggregate event based on class
for sk,sv in record['scope'].items():
# look up bin by scope (or create new)