From: Adrian Hunter Date: Wed, 21 Aug 2019 08:32:11 +0000 (+0300) Subject: perf scripts python: exported-sql-viewer.py: Add LookupModel() X-Git-Tag: v5.5-rc1~152^2~29^2~60 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=181ea40a24af9a60c2ee75d4f271980f6453f585;p=linux.git perf scripts python: exported-sql-viewer.py: Add LookupModel() Add LookupModel() to find a model in the model cache without creating it. Signed-off-by: Adrian Hunter Cc: Jiri Olsa Link: http://lore.kernel.org/lkml/20190821083216.1340-2-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py index 61b3911d91e6..18ad04654adc 100755 --- a/tools/perf/scripts/python/exported-sql-viewer.py +++ b/tools/perf/scripts/python/exported-sql-viewer.py @@ -341,6 +341,15 @@ def LookupCreateModel(model_name, create_fn): model_cache_lock.release() return model +def LookupModel(model_name): + model_cache_lock.acquire() + try: + model = model_cache[model_name] + except: + model = None + model_cache_lock.release() + return model + # Find bar class FindBar():