[Numpy-discussion] profiling line by line

Robert Cimrman cimrman3@ntc.zcu...
Fri Sep 19 03:33:33 CDT 2008

Robert Kern wrote:
> On Thu, Sep 18, 2008 at 06:01, Robert Cimrman <cimrman3@ntc.zcu.cz> wrote:
>> Hi Robert,
>> Robert Kern wrote:
>>> On Mon, Sep 15, 2008 at 11:13, Arnar Flatberg <arnar.flatberg@gmail.com> wrote:
>>>> That would make me an extremely happy user, I've been looking for this for
>>>> years!
>>>> I can't imagine I'm the only one who profiles some hundred lines of code and
>>>> ends up with 90% of total time in the dot-function
>>> For the time being, you can grab it here:
>>> http://www.enthought.com/~rkern/cgi-bin/hgwebdir.cgi/line_profiler/
>>> It requires Cython and a C compiler to build. I'm still debating
>>> myself about the desired workflow for using it, but for now, it only
>>> profiles functions which you have registered with it. I have made the
>>> profiler work as a decorator to make this easy. E.g.,
>> many thanks for this! I have wanted to try out the profiler but failed
>> to build it (changeset 6 0de294aa75bf):
>> $ python setup.py install --root=/home/share/software/
>> running install
>> running build
>> running build_py
>> creating build
>> creating build/lib.linux-i686-2.4
>> copying line_profiler.py -> build/lib.linux-i686-2.4
>> running build_ext
>> cythoning _line_profiler.pyx to _line_profiler.c
>> building '_line_profiler' extension
>> creating build/temp.linux-i686-2.4
>> i486-pc-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -fPIC
>> -I/usr/include/python2.4 -c -I/usr/include/python2.4 -c _line_profiler.c
>> -o build/temp.linux-i686-2.4/_line_profiler.o
>> _line_profiler.c:1614: error: 'T_LONGLONG' undeclared here (not in a
>> function)
>> error: command 'i486-pc-linux-gnu-gcc' failed with exit status 1
>> I have cython- and GCC 4.1.2, 32-bit machine.
> It uses the #define'd macro PY_LONG_LONG. Go through your Python
> headers to see what this gets expanded to.

I have Python 2.4.4

in "pyconfig.h"

#define HAVE_LONG_LONG 1

in "pyport.h":

#ifndef PY_LONG_LONG
#define PY_LONG_LONG long long
#endif /* HAVE_LONG_LONG */

so it seems compatible with 'ctypedef long long PY_LONG_LONG'


More information about the Numpy-discussion mailing list