Commit 9489b66e authored by Ell's avatar Ell

tools: a few improvements in performance-log-viewer.py

In sample-search predicates, remove the "exclusive" parameter of
the "function()" function, and replace it with optional "id" and
"state" parameters, which limit the match to the call-stacks of
matching threads, as per the "thread()" function.

Sort the backtrace thread-list by thread ID.

(cherry picked from commit 0b2d41635ab7b2c158925fa11a6537fdfb4af046)
parent 3fdb5b32
......@@ -726,23 +726,22 @@ class FindSamplesPopover (Gtk.Popover):
for i in range (len (samples)):
try:
def thread (id, state = None):
for thread in samples[i].backtrace or []:
if (type (id) == int and id == thread.id) or \
(type (id) == str and thread.name and \
re.fullmatch (id, thread.name)):
if state is None or \
re.fullmatch (state, str (thread.state)):
return True
def match_thread (thread, id, state = None):
return (type (id) == int and \
id == thread.id) or \
(type (id) == str and \
thread.name and \
re.fullmatch (id, thread.name)) and \
(state is None or \
re.fullmatch (state, str (thread.state)))
return False
def thread (id, state = None):
return any (match_thread (thread, id, state)
for thread in samples[i].backtrace or [])
def function (name, exclusive = False):
def function (name, id = None, state = None):
for thread in samples[i].backtrace or []:
if exclusive:
if re.fullmatch (name, thread.frames[0].info.name):
return True
else:
if match_thread (thread, id, state):
for frame in thread.frames:
if re.fullmatch (name, frame.info.name):
return True
......@@ -1887,6 +1886,7 @@ class BacktraceViewer (Gtk.Box):
store = self.ThreadStore ()
self.thread_store = store
store.set_sort_column_id (store.ID, Gtk.SortType.ASCENDING)
tree = Gtk.TreeView (model = store)
self.thread_tree = tree
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment