summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/strbuf.c
diff options
context:
space:
mode:
authorChris Phlipot <cphlipot0@gmail.com>2016-05-07 02:16:59 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-05-09 18:40:03 -0300
commit9c7b37cd63d0d910c531233209286f169993cbd9 (patch)
treea6eaac012eb8b9049b0d233eb9454118fc061a1d /tools/perf/util/strbuf.c
parent0a241ef4a27a00807fefdf913da104a4534c606a (diff)
downloadlinux-9c7b37cd63d0d910c531233209286f169993cbd9.tar.gz
linux-9c7b37cd63d0d910c531233209286f169993cbd9.tar.bz2
linux-9c7b37cd63d0d910c531233209286f169993cbd9.zip
perf symbols: Fix handling of zero-length symbols.
This change introduces a fix to symbols__find, so that it is able to find symbols of length zero (where start == end). The current code has the following problem: - The current implementation of symbols__find is unable to find any symbols of length zero. - The db-export framework explicitly creates zero length symbols at locations where no symbol currently exists. The combination of the two above behaviors results in behavior similar to the example below. 1. addr_location is created for a sample, but symbol is unable to be resolved. 2. db export creates an "unknown" symbol of length zero at that address and inserts it into the dso. 3. A new sample comes in at the same address, but symbol__find is unable to find the zero length symbol, so it is still unresolved. 4. db export sees the symbol is unresolved, and allocated a duplicate symbol, even though it already did this in step 2. This behavior continues every time an address without symbol information is seen, which causes a very large number of these symbols to be allocated. The effect of this fix can be observed by looking at the contents of an exported database before/after the fix (generated with scripts/python/export-to-postgresql.py) Ex. BEFORE THE CHANGE: example_db=# select count(*) from symbols; count -------- 900213 (1 row) example_db=# select count(*) from symbols where symbols.name='unknown'; count -------- 897355 (1 row) example_db=# select count(*) from symbols where symbols.name!='unknown'; count ------- 2858 (1 row) AFTER THE CHANGE: example_db=# select count(*) from symbols; count ------- 25217 (1 row) example_db=# select count(*) from symbols where name='unknown'; count ------- 22359 (1 row) example_db=# select count(*) from symbols where name!='unknown'; count ------- 2858 (1 row) Signed-off-by: Chris Phlipot <cphlipot0@gmail.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1462612620-25008-1-git-send-email-cphlipot0@gmail.com [ Moved the test to later in the rb_tree tests, as this not the likely case ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/strbuf.c')
0 files changed, 0 insertions, 0 deletions