aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-05-02 12:30:44 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-21 09:31:55 -0400
commitf1c5fd4d0bb944da2138338dd361e06ce6c8385e (patch)
tree0f3831b4bab01090118fa1e25e9a4db0214836fd /tools/perf
parent5a1a99cd2e4e15571a74f65facf05f806d5303fd (diff)
perf c2c report: Add TUI cacheline browser
Adding simple TUI cacheline browser. It triggers when you press 'd' in the main browser on the specific cacheline. It allows to navigate through cacheline's offsets and display callchains (implemented in following patches). Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Joe Mario <jmario@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/n/tip-fovjwgyusv3rz5qxk3hnahtl@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-c2c.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 34da2a3975b0..1415640c4aca 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -1829,6 +1829,84 @@ static void c2c_browser__update_nr_entries(struct hist_browser *hb)
1829 hb->nr_non_filtered_entries = nr_entries; 1829 hb->nr_non_filtered_entries = nr_entries;
1830} 1830}
1831 1831
1832struct c2c_cacheline_browser {
1833 struct hist_browser hb;
1834 struct hist_entry *he;
1835};
1836
1837static int
1838perf_c2c_cacheline_browser__title(struct hist_browser *browser,
1839 char *bf, size_t size)
1840{
1841 struct c2c_cacheline_browser *cl_browser;
1842 struct hist_entry *he;
1843 uint64_t addr = 0;
1844
1845 cl_browser = container_of(browser, struct c2c_cacheline_browser, hb);
1846 he = cl_browser->he;
1847
1848 if (he->mem_info)
1849 addr = cl_address(he->mem_info->daddr.addr);
1850
1851 scnprintf(bf, size, "Cacheline 0x%lx", addr);
1852 return 0;
1853}
1854
1855static struct c2c_cacheline_browser*
1856c2c_cacheline_browser__new(struct hists *hists, struct hist_entry *he)
1857{
1858 struct c2c_cacheline_browser *browser;
1859
1860 browser = zalloc(sizeof(*browser));
1861 if (browser) {
1862 hist_browser__init(&browser->hb, hists);
1863 browser->hb.c2c_filter = true;
1864 browser->hb.title = perf_c2c_cacheline_browser__title;
1865 browser->he = he;
1866 }
1867
1868 return browser;
1869}
1870
1871static int perf_c2c__browse_cacheline(struct hist_entry *he)
1872{
1873 struct c2c_hist_entry *c2c_he;
1874 struct c2c_hists *c2c_hists;
1875 struct c2c_cacheline_browser *cl_browser;
1876 struct hist_browser *browser;
1877 int key = -1;
1878
1879 c2c_he = container_of(he, struct c2c_hist_entry, he);
1880 c2c_hists = c2c_he->hists;
1881
1882 cl_browser = c2c_cacheline_browser__new(&c2c_hists->hists, he);
1883 if (cl_browser == NULL)
1884 return -1;
1885
1886 browser = &cl_browser->hb;
1887
1888 /* reset abort key so that it can get Ctrl-C as a key */
1889 SLang_reset_tty();
1890 SLang_init_tty(0, 0, 0);
1891
1892 c2c_browser__update_nr_entries(browser);
1893
1894 while (1) {
1895 key = hist_browser__run(browser, "help");
1896
1897 switch (key) {
1898 case 'q':
1899 goto out;
1900 default:
1901 break;
1902 }
1903 }
1904
1905out:
1906 free(cl_browser);
1907 return 0;
1908}
1909
1832static int perf_c2c_browser__title(struct hist_browser *browser, 1910static int perf_c2c_browser__title(struct hist_browser *browser,
1833 char *bf, size_t size) 1911 char *bf, size_t size)
1834{ 1912{
@@ -1872,6 +1950,9 @@ static int perf_c2c__hists_browse(struct hists *hists)
1872 switch (key) { 1950 switch (key) {
1873 case 'q': 1951 case 'q':
1874 goto out; 1952 goto out;
1953 case 'd':
1954 perf_c2c__browse_cacheline(browser->he_selection);
1955 break;
1875 default: 1956 default:
1876 break; 1957 break;
1877 } 1958 }