am 69386e33: am 81fd50c3: Merge "perfboot.py: ignore tags not listed in /system/etc/event-log-tags"

* commit '69386e33b67eaee721b4e8d7bddbd4263302ff77':
  perfboot.py: ignore tags not listed in /system/etc/event-log-tags
This commit is contained in:
Yusuke Sato 2015-08-04 00:28:56 +00:00 committed by Android Git Automerger
commit 9358ae91c9
1 changed files with 18 additions and 1 deletions

View File

@ -236,6 +236,23 @@ def make_event_tags_re(tags):
'|'.join(tags))
def filter_event_tags(tags, device):
"""Drop unknown tags not listed in device's event-log-tags file."""
device.wait()
supported_tags = set()
for l in device.shell(['cat', '/system/etc/event-log-tags']).splitlines():
tokens = l.split(' ')
if len(tokens) >= 2:
supported_tags.add(tokens[1])
filtered = []
for tag in tags:
if tag in supported_tags:
filtered.append(tag)
else:
logging.warning('Unknown tag \'%s\'. Ignoring...', tag)
return filtered
def get_values(record, tag):
"""Gets values that matches |tag| from |record|."""
keys = [key for key in record.keys() if key[0] == tag]
@ -406,7 +423,7 @@ def main():
check_dm_verity_settings(device)
record_list = []
event_tags = read_event_tags(args.tags)
event_tags = filter_event_tags(read_event_tags(args.tags), device)
init_perf(device, args.output, record_list, event_tags)
interval_adjuster = IntervalAdjuster(args.interval, device)
event_tags_re = make_event_tags_re(event_tags)