#include <stdio.h>
#include "../libslang.h"
#include <stdlib.h>
#include <string.h>
#include <newt.h>
#include <linux/rbtree.h>
#include "../../util/evsel.h"
#include "../../util/evlist.h"
#include "../../util/hist.h"
#include "../../util/pstack.h"
#include "../../util/sort.h"
#include "../../util/util.h"
#include "../browser.h"
#include "../helpline.h"
#include "../util.h"
#include "../ui.h"
#include "map.h"
struct hist_browser {
struct ui_browser b;
struct hists *hists;
struct hist_entry *he_selection;
struct map_symbol *selection;
bool has_symbols;
};
static int hists__browser_title(struct hists *hists, char *bf, size_t size,
const char *ev_name);
static void hist_browser__refresh_dimensions(struct hist_browser *browser)
{
/* 3 == +/- toggle symbol before actual hist_entry rendering */
browser->b.width = 3 + (hists__sort_list_width(browser->hists) +
sizeof("[k]"));
}
static void hist_browser__reset(struct hist_browser *browser)
{
browser->b.nr_entries = browser->hists->nr_entries;
hist_browser__refresh_dimensions(browser);
ui_browser__reset_index(&browser->b);
}
static char tree__folded_sign(bool unfolded)
{
return unfolded ? '-' : '+';
}
static char map_symbol__folded(const struct map_symbol *ms)
{
return ms->has_children ? tree__folded_sign(ms->unfolded) : ' ';
}
static char hist_entry__folded(const struct hist_entry *he)
{
return map_symbol__folded(&he->ms);
}
static char callchain_list__folded(const struct callchain_list *cl)
{
return map_symbol__folded(&cl->ms);
}
static void map_symbol__set_folding(struct map_symbol *ms, bool unfold)
{
ms->unfolded = unfold ? ms->has_children : false