perf hists browser: Put hist_entry folding logic into single function
It will be used in following patch to expand or collapse only the current browser entry. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1484904032-11040-2-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
9343e45bf6
commit
b33f922651
@ -501,7 +501,7 @@ static int hierarchy_set_folding(struct hist_browser *hb, struct hist_entry *he,
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hist_entry__set_folding(struct hist_entry *he,
|
static void __hist_entry__set_folding(struct hist_entry *he,
|
||||||
struct hist_browser *hb, bool unfold)
|
struct hist_browser *hb, bool unfold)
|
||||||
{
|
{
|
||||||
hist_entry__init_have_children(he);
|
hist_entry__init_have_children(he);
|
||||||
@ -520,25 +520,16 @@ static void hist_entry__set_folding(struct hist_entry *he,
|
|||||||
he->nr_rows = 0;
|
he->nr_rows = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void hist_entry__set_folding(struct hist_entry *he,
|
||||||
__hist_browser__set_folding(struct hist_browser *browser, bool unfold)
|
struct hist_browser *browser, bool unfold)
|
||||||
{
|
{
|
||||||
struct rb_node *nd;
|
|
||||||
struct hist_entry *he;
|
|
||||||
double percent;
|
double percent;
|
||||||
|
|
||||||
nd = rb_first(&browser->hists->entries);
|
|
||||||
while (nd) {
|
|
||||||
he = rb_entry(nd, struct hist_entry, rb_node);
|
|
||||||
|
|
||||||
/* set folding state even if it's currently folded */
|
|
||||||
nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD);
|
|
||||||
|
|
||||||
hist_entry__set_folding(he, browser, unfold);
|
|
||||||
|
|
||||||
percent = hist_entry__get_percent_limit(he);
|
percent = hist_entry__get_percent_limit(he);
|
||||||
if (he->filtered || percent < browser->min_pcnt)
|
if (he->filtered || percent < browser->min_pcnt)
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
|
__hist_entry__set_folding(he, browser, unfold);
|
||||||
|
|
||||||
if (!he->depth || unfold)
|
if (!he->depth || unfold)
|
||||||
browser->nr_hierarchy_entries++;
|
browser->nr_hierarchy_entries++;
|
||||||
@ -550,6 +541,22 @@ __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
|
|||||||
he->nr_rows = 1;
|
he->nr_rows = 1;
|
||||||
} else
|
} else
|
||||||
he->has_no_entry = false;
|
he->has_no_entry = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
__hist_browser__set_folding(struct hist_browser *browser, bool unfold)
|
||||||
|
{
|
||||||
|
struct rb_node *nd;
|
||||||
|
struct hist_entry *he;
|
||||||
|
|
||||||
|
nd = rb_first(&browser->hists->entries);
|
||||||
|
while (nd) {
|
||||||
|
he = rb_entry(nd, struct hist_entry, rb_node);
|
||||||
|
|
||||||
|
/* set folding state even if it's currently folded */
|
||||||
|
nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD);
|
||||||
|
|
||||||
|
hist_entry__set_folding(he, browser, unfold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user