pt: Add a instruction decoding cache
On large decodes decoding instructions can dominate.
This patch adds a cache for instruction decoding.
It caches stretches of "super blocks" that are defined
just by unconditional branches and do not trigger
the sampling period.
The answers are similar but not exactly the same
as the sampling period now may jitter more
due to the caching effects (essentially
the period jumps). So far the results seem
to be close enough.
The cache uses various heuristics and a LRU
to avoid polluting the hash table with blocks
that are not likely to be reused.
I see large wins from the cache, improvements
between 30 and 60% in some traces. In many cases
the cache has a >95% hit rate. In rare cases
it causes a slight slow down.
Opens:
- It would be good to share the cache between queues.
Right now it is per queue.
- Characterize the worst case period mismatch error
caused by the caching.
- The magic numbers work for me, but may not be
the best ones.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
1 file changed