summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/stackcollapse.py
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2024-11-08 17:28:40 -0800
committerChristian Brauner <brauner@kernel.org>2024-12-02 11:21:07 +0100
commit680e029fd62f7d9d8373788635f52c3de358d18d (patch)
tree83582f667f34ab44c67e7f67003a606bc7c73273 /tools/perf/scripts/python/stackcollapse.py
parentc9136fad4c08288be26aaff3e63d634545b32a85 (diff)
proc/kcore: don't walk list on every read
We maintain a list of memory ranges for /proc/kcore, which usually has 10-20 entries. Currently, every single read from /proc/kcore walks the entire list in order to count the number of entries and compute some offsets. These values only change when the list of memory ranges changes, which is very rare (only when memory is hot(un)plugged). We can cache the values when the list is populated to avoid these redundant walks. In my benchmark, this reduces the time per read by another 20 nanoseconds on top of the previous change, from 215 nanoseconds per read to 195. Link: https://github.com/osandov/drgn/issues/106 Signed-off-by: Omar Sandoval <osandov@fb.com> Link: https://lore.kernel.org/r/8d945558b9c9efe74103a34b7780f1cd90d9ce7f.1731115587.git.osandov@fb.com Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions