Le 05/07/2016 à 16:28, Richard Heck a écrit :
Can you give a receipe for producing them? I'm ignorant about profiling.
(In my case, this would be on Linux.)
Actually, the patch is already instrumented (see below). So all you need
to do is produce a build without run-time debugging. A good way to do
that with autoconf is to configure with --enable-build-type=prof.
The rune LyX, move around the document or do whatever leads to a slow
display and when you quit LyX, you will see the result on console.
As for the "how is it done" part, it uses the poor man's profiler in our
source. The relevant code looks like:
+#include "support/pmprof.h"
+bool GuiFontMetrics::breakAt(docstring & s, int & x, bool const rtl,
bool const force) const
+{
+ PROFILE_THIS_BLOCK(breakAt)
[...]
+ if (pp)
This is the cache hit branch
+ tie(len, newx) = *pp;
+ else {
This is the cache miss branch
+ PROFILE_CACHE_MISS(breakAt)
+ tie(len, newx) = breakAt_helper(s, x, rtl, force);
+ breakat_cache_.insert(qba, new pair<int, int>(len,
newx), qba.size());
+ }
[...]
The first macro PROFILE_THIS_BLOCK (with an arbitrary identifier) will
give profiling results for the function. If additionally you have some
PROFILE_CACHE_MISS calls, then the system will turn into "cache
profiling" mode and output further information in terms of cache hit/miss.
You should not trust the numbers too much, but it is a very convenient
way to assess a speedup.
JMarc