Skip to main content

Module with C functions. No precise purpose yet.

Project description

https://github.com/sdpython/cpyquickhelper/blob/master/_doc/sphinxdoc/source/phdoc_static/project_ico.png?raw=true

cpyquickhelper: python + C++ in different ways

Build status Build Status Windows https://circleci.com/gh/sdpython/cpyquickhelper/tree/master.svg?style=svg https://dev.azure.com/xavierdupre3/cpyquickhelper/_apis/build/status/sdpython.cpyquickhelper https://badge.fury.io/py/cpyquickhelper.svg MIT License https://codecov.io/github/sdpython/cpyquickhelper/coverage.svg?branch=master GitHub Issues Notebook Coverage Downloads size Forks Stars

cpyquickhelper is a template to create a module with C functions in different ways. It implements function measure_time:

from cpyquickhelper.numbers import measure_time
from math import cos

res = measure_time("cos(x)", context=dict(cos=cos, x=5.))
print(res)
{'average': 3.909366205334663e-06, 'deviation': 6.238702219064397e-07,
 'min_exec': 3.635883331298828e-06, 'max_exec': 5.776062607765198e-06,
 'repeat': 10, 'number': 50, 'context_size': 240}

It also implements an event profiler: it logs the timestamp for every event such as functions call or returns, memory allocations.

import io
import numpy
from cpyquickhelper.profiling import EventProfiler

def custom_array(N):
    a = numpy.zeros((N, N))
    a[:, 0] = 1
    a[0, :] = 1
    return a

ev = EventProfiler(impl='c')
ev.start()

custom_array(3)

ev.stop()

df = ev.retrieve_results()  # DataFrame
st = io.StringIO()
df.to_csv(st, index=False)
print(st.getvalue().replace("\r", ""))
time,value1,value2,event,name,mod,lineno,from_name,from_mod,from_line
822467345556400,0,0,return,_setup_profiler,cpyquickhelper/profiling/event_profiler.py,153,start,cpyquickhelper/profiling/event_profiler.py,126
822467345566700,0,0,c_call,_profiling_register_pyinstance,cpyquickhelper.profiling._event_profiler_c,109,_profiling_register_pyinstance,k.py,19
822467345569000,0,0,c_return,_profiling_register_pyinstance,cpyquickhelper.profiling._event_profiler_c,109,_profiling_register_pyinstance,k.py,19
822467345569700,0,0,return,start,cpyquickhelper/profiling/event_profiler.py,109,<module>,k.py,19
822467345575100,0,0,call,custom_array,k.py,5,<module>,k.py,19
822467345579600,0,0,c_call,zeros,numpy,5,zeros,k.py,19
822467345584300,2698130437280,32,malloc,start,cpyquickhelper/profiling/event_profiler.py,109,<module>,k.py,19
822467345590500,0,0,c_return,zeros,numpy,5,zeros,k.py,19
822467345598200,0,0,free,start,cpyquickhelper/profiling/event_profiler.py,109,<module>,k.py,19
822467345600400,0,0,free,start,cpyquickhelper/profiling/event_profiler.py,109,<module>,k.py,19
822467345600900,0,0,return,ndarray,numpy,5,ndarray,k.py,19
822467345603200,0,0,call,stop,cpyquickhelper/profiling/event_profiler.py,128,<module>,k.py,19
822467345604900,0,0,call,_restore_profiler,cpyquickhelper/profiling/event_profiler.py,168,stop,cpyquickhelper/profiling/event_profiler.py,151
822467345605600,0,0,c_call,setprofile,sys,168,setprofile,cpyquickhelper/profiling/event_profiler.py,151

Links:

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

cpyquickhelper-0.3.398.tar.gz (162.9 kB view details)

Uploaded Source

Built Distributions

cpyquickhelper-0.3.398-cp39-cp39-win_amd64.whl (675.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

cpyquickhelper-0.3.398-cp39-cp39-manylinux_2_24_x86_64.whl (8.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

cpyquickhelper-0.3.398-cp39-cp39-macosx_10_9_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

cpyquickhelper-0.3.398-cp38-cp38-win_amd64.whl (682.3 kB view details)

Uploaded CPython 3.8 Windows x86-64

cpyquickhelper-0.3.398-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

cpyquickhelper-0.3.398-cp38-cp38-macosx_10_9_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

cpyquickhelper-0.3.398-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.4 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

cpyquickhelper-0.3.398-cp37-cp37m-macosx_10_9_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file cpyquickhelper-0.3.398.tar.gz.

File metadata

  • Download URL: cpyquickhelper-0.3.398.tar.gz
  • Upload date:
  • Size: 162.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for cpyquickhelper-0.3.398.tar.gz
Algorithm Hash digest
SHA256 18068b4b26d7c88803f05d3a898e092ef7cd201e56acc34c17cf627d9b1666ea
MD5 08befec8f3b21fc75116d21c7b3d7beb
BLAKE2b-256 bce7c5e4b653ad665d2b2b837b09dbda65ed0eb44102395ebd15f5f742a6e071

See more details on using hashes here.

File details

Details for the file cpyquickhelper-0.3.398-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: cpyquickhelper-0.3.398-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 675.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for cpyquickhelper-0.3.398-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0b77653b945d3e3d2561721f06edac44e10b8e89610dec69fb55e0f1be340348
MD5 a0d33a83515aa1b1460001a2f7b90e87
BLAKE2b-256 03d45d6ab1a460b63e6a9fc2fc00da827b5c231d24529138e809f9294b3ca54c

See more details on using hashes here.

File details

Details for the file cpyquickhelper-0.3.398-cp39-cp39-manylinux_2_24_x86_64.whl.

File metadata

  • Download URL: cpyquickhelper-0.3.398-cp39-cp39-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 8.9 MB
  • Tags: CPython 3.9, manylinux: glibc 2.24+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for cpyquickhelper-0.3.398-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 5e8ba24b4e7812df3d63513a4d7c16953cc601e8e86542fa664d86d29c8a01d0
MD5 07cbbd7a1830cce521f05d8787f84f1f
BLAKE2b-256 b8de5714220ee8a744b515b2778ddfb7ee32b105598ec10330368c9cb5aef041

See more details on using hashes here.

File details

Details for the file cpyquickhelper-0.3.398-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cpyquickhelper-0.3.398-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for cpyquickhelper-0.3.398-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 722e474d05e4b87d94f683318da57a43ee29862774a1ddcc81547162b30cb851
MD5 3b63e0c35b45e03699ae8a39272722f1
BLAKE2b-256 9d0dab4c26914138340bf23cb8e4683ba9ceaafc81582477368915cf4bc8bb08

See more details on using hashes here.

File details

Details for the file cpyquickhelper-0.3.398-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: cpyquickhelper-0.3.398-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 682.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for cpyquickhelper-0.3.398-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 422ef63afed4f6d4bade05c81bae0960389d9adc1812e3364b48f200f0dd0d4f
MD5 f2d8df5926df0a99004bd6fb737b192b
BLAKE2b-256 0ab4adbef18e41edc44853b7ac4318cc4d12123910f0b97e5931524df10fe26d

See more details on using hashes here.

File details

Details for the file cpyquickhelper-0.3.398-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cpyquickhelper-0.3.398-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eda48e3c93bfe31f2a555587b4fdc6544ac16de0fe9eb1289aa20a1f756a416e
MD5 0bb7220d5fd44fc515862d61f10aee49
BLAKE2b-256 c227f92a7d151df0a5bc2e1c754a7edd8d1594da826ed49b7913e5bedcc4f6ff

See more details on using hashes here.

File details

Details for the file cpyquickhelper-0.3.398-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cpyquickhelper-0.3.398-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for cpyquickhelper-0.3.398-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 92abb3dd3c093a0244ecee5a1f6f6182fcfbcb5af3afa92928bbf69148cbfdd0
MD5 8c6f60674a95b4da0cc0945b3527d4f8
BLAKE2b-256 8ed7805a7044cd59df8f3838c7ccc617487ea86cc4c667c7fd99480455029c6b

See more details on using hashes here.

File details

Details for the file cpyquickhelper-0.3.398-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cpyquickhelper-0.3.398-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 140fb559df4bdfedcc27deb68b93bace2bf683ec135926a9ce5199fdabd615f2
MD5 71c82200959062690dbcc47006adff2b
BLAKE2b-256 0bfa62aa36a2b4ffad740abb2814847a8fb0f558268683b2aab1df4fd6d8eaad

See more details on using hashes here.

File details

Details for the file cpyquickhelper-0.3.398-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cpyquickhelper-0.3.398-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for cpyquickhelper-0.3.398-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c20e99998d4306b5766daf3e71d04d2df58d9012ebfdb0390d84c5ced174f0be
MD5 aaffc1803d05aa28db99a48ae8a66b42
BLAKE2b-256 4da70d28cb963a7ca22faac3fbdb8b86abba8a2800f38df1e101c030b83777e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page