Skip to content

Commit

Permalink
perf scripts python: exported-sql-viewer.py: Add LookupModel()
Browse files Browse the repository at this point in the history
Add LookupModel() to find a model in the model cache without creating it.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20190821083216.1340-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Oct 7, 2019
1 parent 8bd436b commit 181ea40
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/perf/scripts/python/exported-sql-viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 181ea40

Please sign in to comment.