[luatex] Lua Profiler

Reinhard Kotucha reinhard.kotucha at web.de
Mon May 16 15:07:02 CEST 2011


On 2011-05-16 at 08:18:16 +0200, Taco Hoekwater wrote:

 > On 05/16/2011 03:48 AM, Reinhard Kotucha wrote:
 > > Hi,
 > > I compiled the Lua profiler from
 > >
 > >    http://luaprofiler.luaforge.net
 > >
 > > and installed the shared library in $SELFAUTOLOC/lib .
 > >
 > > It works fine, except that the function profiler.start() ignores its
 > > argument (the name of the output file).  It always creates a file
 > > lprof_<random number>.
 > 
 > I think this is because luatex already includes luaprofiler,

Hi Taco,
sorry, I missed that.

 > and an older version of it, that ignores the argument everywhere
 > except on win32.

I just copied the *.{h,c} files from luaprofiler-2.0.2/src to
branches/0.70.x/source/texk/web2c/luatexdir/luaprofiler and compiled
luatex again.

However, I had to apply the patch below because the script
summary.lua, which is shipped with luaprofiler, doesn't support
concatenated output files.  It obviously expects the header only at
the beginning of the file:  

$ texlua summary.lua -v profile
summary.lua:54: attempt to perform arithmetic on global 'local_time' (a string value)

IMO it doesn't make sense to concatenate output files because this
doesn't circumvent the limitation that times are multiples of 10ms.
And in most cases one changes the code of the evaluated script between
consecutive runs in order to compare the differences.

However, now it works as expected here and creates a file with the
name specified in profiler.start(), which can be processed with
summary.lua.

Regards,
  Reinhard


--- core_profiler.c--	2008-05-19 20:36:23.000000000 +0200
+++ core_profiler.c	2011-05-16 14:29:10.000000000 +0200
@@ -140,7 +140,7 @@
     randstr[strlen(randstr)-1]='\0';
 
   sprintf(auxs, out_filename, randstr);
-  outf = fopen(auxs, "a");
+  outf = fopen(auxs, "w");
   if (!outf) {
     return 0;
   }



-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


More information about the luatex mailing list