cProfile.py not found.

R

Rahul

I need to profile a slow-running code. The problem is I cannot seem to find
cProfile.py.

Where can I get it? Is it not included in the normal distro? I tried
googling it up and theres tons of info on how to use it but no links for
where to download it from.

I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10).

I am aware this is kind of dated but some of our legacy codes insist on
using that exact version.
 
R

Robert Kern

I need to profile a slow-running code. The problem is I cannot seem to find
cProfile.py.

Where can I get it? Is it not included in the normal distro? I tried
googling it up and theres tons of info on how to use it but no links for
where to download it from.

I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10).

I am aware this is kind of dated but some of our legacy codes insist on
using that exact version.

What system are you on? Some Linux distributions put it into a separate package,
like python-profile. The python.org Windows and Mac binaries should have it, though.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
J

John Yeung

I believe cProfile was added in 2.5. Your best bet on 2.4 is probably
the profile module. That is what the docs recommend.

John
 
R

Rahul

What system are you on? Some Linux distributions put it into a
separate package, like python-profile. The python.org Windows and Mac
binaries should have it, though.

THanks Robert. I'm on RHEL.

Tried yum search python-profile. No hits. Also tried a locate on
cProfile. No hits again.

Did a yum search python. Huge list but nothing promising. Yet, I
reproduce it below just in case its hidden somewhere in the list. What
options do I have now?

python-sqlite2.i386 : DB-API 2.0 interface for SQLite 3.x
tix.i386 : A set of extension widgets for Tk
tix-devel.i386 : Tk Interface eXtension development files
tix-doc.i386 : Tk Interface eXtension documentation
vim-enhanced.i386 : A version of the VIM editor which includes recent
: enhancements.
Django.noarch : A high-level Python Web framework
Django-doc.noarch : Documentation for Django
MySQL-python.i386 : An interface to MySQL
OpenIPMI-python.i386 : OpenIPMI Python language bindings
PyQt.i386 : Python bindings for Qt
PyQt-examples.i386 : Examples for PyQt
PyXML.i386 : XML libraries for python.
PyYAML.noarch : YAML parser and emitter for Python
Pyrex.noarch : A compiler/language for writing Python extension modules.
PythonCard.noarch : PythonCard GUI construction toolkit
R2spec.noarch : Python script to generate R spec file
SOAPpy.noarch : Full-featured SOAP library for Python
TurboGears.noarch : Back-to-front web development in Python
ant-scripts.i386 : Additional scripts for ant
archivemail.noarch : A tool for archiving and compressing old email in
mailboxes
audit-libs-python.i386 : Python bindings for libaudit
babel.noarch : Tools for internationalizing Python applications
beecrypt-python.i386 : Files needed for python applications using
beecrypt.
booty.noarch : simple python bootloader config lib
bsf.i386 : Bean Scripting Framework
cobbler.noarch : Boot server configurator
ctopy.noarch : C to Python translator
cvs2svn.noarch : CVS to Subversion Repository Converter
db4.i386 : The Berkeley DB database library (version 4) for C.
dbus-python.i386 : D-Bus Python Bindings
ddd.i386 : GUI for several command-line debuggers
deluge.i386 : Graphical BitTorrent client with support for DHT, UPnP, and
PEX
denyhosts.noarch : A script to help thwart ssh server attacks
epydoc.noarch : Edward Loper's Python API documentation generation tool
exaile.i386 : A music player
flumotion.i386 : Flumotion - the Fluendo Streaming Server
fuzzyclock.noarch : Generates fuzzy clock output
gamin-python.i386 : Python bindings for the gamin library
gdal.i386 : Geospatial Data Abstraction Library
gdal-python.i386 : Python modules for the GDAL file format library
getmail.noarch : POP3 mail retriever with reliable Maildir delivery
glade2.i386 : A GTK+ GUI builder.
gnome-menus.i386 : A menu system for the GNOME project
gnome-python2.i386 : The sources for the PyGNOME Python extension module
gnome-python2-applet.i386 : Python bindings for GNOME Panel applets.
gnome-python2-bonobo.i386 : Python bindings for interacting with bonobo.
gnome-python2-canvas.i386 : Python bindings for the GNOME Canvas.
gnome-python2-desktop.i386 : The sources for additional PyGNOME Python
extension
: modules for the GNOME desktop
gnome-python2-extras.i386 : The sources for additional. PyGNOME Python
extension
: modules.
gnome-python2-gconf.i386 : Python bindings for interacting with GConf
gnome-python2-gnomedesktop.i386 : Python bindings for interacting with
gnome-
: desktop
gnome-python2-gnomekeyring.i386 : Python bindings for interacting with
gnome-
: keyring
gnome-python2-gnomeprint.i386 : Python bindings for interacting with
: libgnomeprint
gnome-python2-gnomevfs.i386 : Python bindings for interacting with gnome-
vfs
gnome-python2-gtkhtml2.i386 : Python bindings for interacting with
gtkhtml2

python-twisted-names.i386 : A Twisted DNS implementation
python-twisted-web.i386 : Twisted web server, programmable in Python
python-twisted-web2.i386 : Twisted web server, programmable in Python
python-twisted-words.i386 : Twisted Words contains Instant Messaging
implementations
python-twitter.noarch : A python wrapper around the Twitter API
python-tz.noarch : World Timezone Definitions for Python
python-urlgrabber.noarch : High-level cross-protocol url-grabber
python-urljr.noarch : Common interface to urllib2 and curl for making
HTTP requests
python-urwid.noarch : Console UI Library for Python
python-urwid.i386 : Console UI Library for Python
python-utmp.i386 : Python module for working with utmp
python-vcpx.noarch : Version Control Patch eXchanger
python-virtinst.noarch : Python modules for starting Xen guest
installations
python-vorbis.i386 : Python bindings for libvorbis
python-webob.noarch : WSGI request and response object
python-which.noarch : Small which replacement that can be used as a
Python module
python-wifi.noarch : Python binding for the wireless (wifi) extensions
python-xattr.i386 : Extended attributes for python
python-xdg.noarch : Python library to access freedesktop.org standards
python-xlib.i386 : Complete X11R6 client-side implementation
python-xlrd.noarch : Library to extract data from Microsoft Excel (tm)
spreadsheet files
python-yadis.noarch : Relying party support for the Yadis service
discovery protocol
python-yaml.noarch : Python package implementing YAML parser and emitter
python-yenc.i386 : yEnc Module for Python
python-zope-interface.i386 : Zope 3 Interface Infrastructure
pytone.i386 : Music Jukebox with a Curses Based GUI
pytraffic.i386 : Rush Hour game
pytz.noarch : World Timezone Definitions for Python
pywebdav.noarch : WebDAV library
pyxattr.i386 : Extended attributes library wrapper for Python
pyxdg.noarch : Python library to access freedesktop.org standards
pyxf86config.i386 : Python wrappers for libxf86config
pyzor.noarch : Pyzor collaborative spam filtering system
rdiff-backup.i386 : Convenient and transparent local/remote incremental
mirror/backup
rhnlib.noarch : Python libraries for the RHN project
rhpl.i386 : Library of python code used by programs in Red Hat Linux
rhpxl.i386 : Python library for configuring and running X.
rpm-python.i386 : Python bindings for apps which will manipulate RPM
packages.
rrdtool-python.i386 : Python RRDtool bindings
sagator.noarch : SAGATOR - antivir/antispam gateway for smtp server
scapy.noarch : Interactive packet manipulation tool and network scanner
scipy.i386 : Scipy: Scientific Tools for Python
scons.noarch : An Open Source software construction tool
sip.i386 : SIP - Python/C++ Bindings Generator
sip-devel.i386 : Files needed to generate Python bindings for any C++
class library
solarwolf.noarch : Python SDL game where you have to collect energy cubes
spacepong.noarch : An innovative Python SDL game that is controlled with
the mouse
stgit.noarch : StGIT provides similar functionality to Quilt on top of
GIT
sulk.i386 : Sulk, the hackable Space Hulk
supybot.noarch : Cross-platform IRC bot written in Python
swig.i386 : Simplified Wrapper and Interface Generator
sympy.noarch : A Python library for symbolic mathematics
system-config-bind.noarch : The Red Hat BIND DNS Configuration Tool.
tkinter.i386 : A graphical user interface for the Python scripting
language.
trytond.noarch : Server for the Tryton application framework
txt2tags.noarch : Converts text files to HTML, XHTML, sgml, LaTeX, man...
wxPython.i386 : GUI toolkit for the Python programming language
wxPython-devel.i386 : Development files for wxPython add-on modules
yum-protect-packages.noarch : Yum plugin to prevents Yum from removing
itself and other protected packages
zope.i386 : Web application server for flexible content management
applications
 
R

Robert Kern

I believe cProfile was added in 2.5. Your best bet on 2.4 is probably
the profile module. That is what the docs recommend.

Oops, I missed that piece of information. Alternately, the OP can install
lsprof, which was cProfile's third-party incarnation before it got integrated
into the stdlib:

http://codespeak.net/svn/user/arigo/hack/misc/lsprof/

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
J

John Machin

I need to profile a slow-running code. The problem is I cannot seem to find  
cProfile.py.

Where can I get it? Is it not included in the normal distro? I tried
googling it up and theres tons of info on how to use it but no links for
where to download it from.

I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10).

Read the fantastic manual:

http://docs.python.org/library/profile.html

Note: this is the *first* hit when you google either "cprofile" or
"cProfile.py".

"""
The Python standard library provides three different profilers:

1.

cProfile is recommended for most users; it’s a C extension with
reasonable overhead that makes it suitable for profiling long-running
programs. Based on lsprof, contributed by Brett Rosen and Ted Czotter.

New in version 2.5.
"""
 
R

Rahul

I believe cProfile was added in 2.5. Your best bet on 2.4 is probably
the profile module. That is what the docs recommend.

Thanks John. That works. I'll use "profile" instead.
 
R

Rahul

Read the fantastic manual:

http://docs.python.org/library/profile.html [snip]
cProfile is recommended for most users; it's a C extension with
reasonable overhead that makes it suitable for profiling long-running
programs. Based on lsprof, contributed by Brett Rosen and Ted Czotter.

New in version 2.5.

Thanks John; I did read the manual which is why I decided to use cProfile
as it was "recommended for most users". I missed the last bit about "New
in version 2.5."
 
J

John Machin

(e-mail address removed):


Read the fantastic manual:
 [snip]
      cProfile is recommended for most users; it's a C extension with
reasonable overhead that makes it suitable for profiling long-running
programs. Based on lsprof, contributed by Brett Rosen and Ted Czotter.
      New in version 2.5.

Thanks John; I did read the manual which is why I decided to use cProfile
as it was "recommended for most users".  I missed the last bit about "New
in version 2.5."

Looks like our definitions of "read" differ :)
 
R

Rahul

Looks like our definitions of "read" differ :)

Sorry. I ought to have said "skimmed" :)

I guess I am one of those guilty lazy-bums that the manual refers to under
<<<users that “don’t want to read the manual.” >>>
 
S

skip

Rahul> I need to profile a slow-running code. The problem is I cannot
Rahul> seem to find cProfile.py.

You want cProfile.c (compiled to cProfile.so).

Rahul> I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10).

cProfile was new in 2.5, but the code backports with no problem to 2.4.
Just grab it from a 2.5 distro and build/install it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top