Palanteer instrumentation library
Project description
Look into Palanteer and get an omniscient view of your program
Palanteer is a set of lean and efficient tools to improve the quality of software for Python programs (and C++).
Simple code instrumentation, mostly automatic in Python, delivers powerful features:
- Collection of meaningful atomic events on timings, memory, locks wait and usage, context switches, data values..
- Visual and interactive observation of records: hierarchical logs, timeline, plot, histogram, flame graph...
- Remote command call and events observation can be scripted in Python: deep testing has never been simpler
Execution of unmodified Python programs can be analyzed directly with a syntax similar to the one of cProfile
:
- Functions enter/leave
- Interpreter memory allocations
- All raised exceptions
- Garbage collection runs
- Support of multithread, coroutines, asyncio/gevent
The collected events can either be processed automatically by an online script, or analyzed with the separate viewer (see last section):
Palanteer is an efficient, lean and comprehensive solution for better and enjoyable software development!
Usage
Profiling and monitoring can be done:
-
With unmodified code:
python -m palanteer [options] <your script>
This syntax is similar to the
cProfile
usage and no script modification is required.
By default, it tries to connect to a Palanteer server. With options, offline profiling can be selected.
Launchpython -m palanteer
for help or refer to the documentation. -
With code instrumentation:
Please refer to the documentation for details.
Manual instrumentation can provide additional valuable information compared to just the automatic function profiling, like data, locks, ...
The manual instrumentation may also include remotely callable commands (Command Line Interface, aka CLI), useful for configuration and testing.
Here is a working example:
#! /usr/bin/env python3
import sys
import random
from palanteer import *
globalMinValue, globalMaxValue = 0, 10
# Handler (=implementation) of the example CLI, which sets the range
def setBoundsCliHandler(minValue, maxValue): # 2 parameters (both integer) as declared
global globalMinValue, globalMaxValue
if minValue>maxValue: # Case where the CLI execution fails (non null status). The text answer contains some information about it
return 1, "Minimum value (%d) shall be lower than the maximum value (%d)" % (minValue, maxValue)
# Modify the state of the program
globalMinValue, globalMaxValue = minValue, maxValue
# CLI execution was successful (null status)
return 0, ""
def main(argv):
global globalMinValue, globalMaxValue
plInitAndStart("example") # Start the instrumentation
plDeclareThread("Main") # Declare the current thread as "Main", so that it can be identified more easily in the script
plRegisterCli(setBoundsCliHandler, "config:setRange", "min=int max=int", "Sets the value bounds of the random generator") # Declare the CLI
plFreezePoint() # Add a freeze point here to be able to configure the program at a controlled moment
plBegin("Generate some random values")
for i in range(100000):
value = int(globalMinValue + random.random()*(globalMaxValue+1-globalMinValue))
plData("random data", value) # Here are the "useful" values
plEnd("") # Shortcut for plEnd("Generate some random values")
plStopAndUninit() # Stop and uninitialize the instrumentation
# Bootstrap
if __name__ == "__main__":
main(sys.argv)
Installation of the instrumentation module
Latest official release directly from the PyPI storage (from sources on Linux, binary on Windows)
pip install palanteer
Directly from GitHub sources (top of tree, may be unstable)
pip install "git+https://github.com/dfeneyrou/palanteer#egg=palanteer&subdirectory=python"
From locally retrieved sources
This method ensures that the viewer and scripting module are consistent with the intrumentation libraries.
Get the sources:
git clone https://github.com/dfeneyrou/palanteer
cd palanteer
mkdir build
cd build
Build on Linux:
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc) install
Build on Windows:
(vcvarsall.bat
or equivalent shall be called beforehand, so that the MSVC compiler is accessible)
cmake .. -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
nmake install
Important!
To be useful, this module requires at least a "server side":
- the graphical viewer
- for visual analysis (online or offline) of the collected events
- the Python scripting module
palanteer_scripting
- for automated remote usage of the collected events: KPI extraction, tests, monitoring...
NOTE 1: Installing from local sources provide all components: instrumentation module, scripting module, graphical viewer, test examples and documentation.
NOTE 2: It is strongly recommended to have matching versions between the server and the instrumentation sides
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file palanteer-0.7.1.tar.gz
.
File metadata
- Download URL: palanteer-0.7.1.tar.gz
- Upload date:
- Size: 80.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0801222f38f965dd785e335df55f4ab3071bf7c02643e63de39c8df4fcbceeb0 |
|
MD5 | 3372212ef01da74e278915b1a998a4b5 |
|
BLAKE2b-256 | 99e9b2843156a0187469eb0c9448ba2bb2d6b8c266e375675407d12f03863c3d |
File details
Details for the file palanteer-0.7.1-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: palanteer-0.7.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 63.4 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7178c861a635841de30cd6837e8fa6a2e525746d89c025cce4ab2805da1c10b4 |
|
MD5 | c018ab0ffc466c785376835fe16a6865 |
|
BLAKE2b-256 | 9bc6303527d57a5988957697831586e1f58bcf2f519e4b99b4403b20ef4b9687 |
File details
Details for the file palanteer-0.7.1-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: palanteer-0.7.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 63.3 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06ef50d4d9be51a08ebde888fd04107c30ec3876fc90bc69345da34c34f35141 |
|
MD5 | fc4964c8a124e75eb0dc2ac9821de13b |
|
BLAKE2b-256 | ff244c256233327e327ac2445a0da10d82d9960ff3ca8bb57911945422a3fa7e |
File details
Details for the file palanteer-0.7.1-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: palanteer-0.7.1-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 63.3 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e4c7921476d24b910a271b446d15c04c80212a51d9f96896b00f31da5bdc869 |
|
MD5 | 8e2650434a1df0540cb17336ccc566df |
|
BLAKE2b-256 | 9c2ce64f741bc2f318f12a83adefaf693a8c911aa527355127e02d30a042af1b |
File details
Details for the file palanteer-0.7.1-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: palanteer-0.7.1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 63.2 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10fa19a3f8b87e6398c7c1e17939c1979d927cae3f3165944699890bfba9f469 |
|
MD5 | c1466f9b804d928714c884a4edb27724 |
|
BLAKE2b-256 | c402e209eae513b085718e25bde9c28b0e7b1c3596d88011bd5b81861434eb92 |
File details
Details for the file palanteer-0.7.1-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: palanteer-0.7.1-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 63.2 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6821f05602c884759b54302249f8aad8cf7e8254fc80a448fd93217729398695 |
|
MD5 | 57a3e384e5cd26c799c407b67bdd0c3d |
|
BLAKE2b-256 | 4c1b1ccfce2650d7462a72ab3f073073ecc51d2062078e9a6c59c9303e71a938 |