[luatex] Lua Profiler

Reinhard Kotucha reinhard.kotucha at web.de
Mon May 16 14:21:40 CEST 2011


On 2011-05-16 at 11:01:28 +0200, Philipp Stephani wrote:

 > 
 > Am 16.05.2011 um 03:48 schrieb Reinhard Kotucha:
 > 
 > > 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>.
 > > 
 > > However, when I use the same shared library with stock Lua, I get
 > > 
 > > Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
 > >> require('profiler')
 > >> profiler.start('foo')
 > >> print('hello')
 > > hello
 > >> profiler.stop()
 > >> os.exit()
 > > Segmentation fault (core dumped)
 > > 
 > > Despite the segmentation fault, it creates a file
 > > 
 > > -rw-r--r-- 1 reinhard users     333 May 16 02:57 foo
 > > 
 > > at least.
 > > 
 > > Did anybody encounter similar problems?
 > 
 > Hello,
 > 
 > how did you compile and install the profiler library? Does your
 > process differ in some way from the steps taken by LuaRocks? I'm
 > asking this because segmentation faults are typical on Unix-like
 > systems when an extension module is linked to a Lua library; so you
 > shouldn't link with e.g. -llua. If you installed the library via
 > LuaRocks and it crashes with stock Lua, then there's definitely a
 > bug somewhere in the library.

Hi Philipp,
I simply ran make -f Makefile.linux.  It complained that I have to
compile with -fPIC, so I added this to CFLAGS in config.linux and
compiled again.  Then I copied bin/profiler.so to $SELFAUTOLOC/lib and
later to /usr/lib64/lua.

I didn't use LuaRocks because, according to its documentation, it
tries to detect an installed Lua but I wanted to use the profiler with
texlua anyway.

Now I installed again with LuaRocks (nice tool) and don't get the
segfault anymore.

When Taco said that luaprofiler is already compiled into texlua, I ran
my script in strace and now I see that the external module isn't
loaded indeed.

BTW, did anybody try base64 encoding with the luatex mime module?
The created base64 string is lacking the last two bytes, but maybe I
did something wrong.  However, *de*coding base64 strings works fine.

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
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