Module with C functions. No precise purpose yet.
Project description
cpyquickhelper: python + C++ in different ways
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
Release history Release notifications | RSS feed
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 hashes)
Built Distributions
Close
Hashes for cpyquickhelper-0.3.398-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b77653b945d3e3d2561721f06edac44e10b8e89610dec69fb55e0f1be340348 |
|
MD5 | a0d33a83515aa1b1460001a2f7b90e87 |
|
BLAKE2b-256 | 03d45d6ab1a460b63e6a9fc2fc00da827b5c231d24529138e809f9294b3ca54c |
Close
Hashes for cpyquickhelper-0.3.398-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e8ba24b4e7812df3d63513a4d7c16953cc601e8e86542fa664d86d29c8a01d0 |
|
MD5 | 07cbbd7a1830cce521f05d8787f84f1f |
|
BLAKE2b-256 | b8de5714220ee8a744b515b2778ddfb7ee32b105598ec10330368c9cb5aef041 |
Close
Hashes for cpyquickhelper-0.3.398-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 722e474d05e4b87d94f683318da57a43ee29862774a1ddcc81547162b30cb851 |
|
MD5 | 3b63e0c35b45e03699ae8a39272722f1 |
|
BLAKE2b-256 | 9d0dab4c26914138340bf23cb8e4683ba9ceaafc81582477368915cf4bc8bb08 |
Close
Hashes for cpyquickhelper-0.3.398-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 422ef63afed4f6d4bade05c81bae0960389d9adc1812e3364b48f200f0dd0d4f |
|
MD5 | f2d8df5926df0a99004bd6fb737b192b |
|
BLAKE2b-256 | 0ab4adbef18e41edc44853b7ac4318cc4d12123910f0b97e5931524df10fe26d |
Close
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 |
Close
Hashes for cpyquickhelper-0.3.398-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92abb3dd3c093a0244ecee5a1f6f6182fcfbcb5af3afa92928bbf69148cbfdd0 |
|
MD5 | 8c6f60674a95b4da0cc0945b3527d4f8 |
|
BLAKE2b-256 | 8ed7805a7044cd59df8f3838c7ccc617487ea86cc4c667c7fd99480455029c6b |
Close
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 |
Close
Hashes for cpyquickhelper-0.3.398-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c20e99998d4306b5766daf3e71d04d2df58d9012ebfdb0390d84c5ced174f0be |
|
MD5 | aaffc1803d05aa28db99a48ae8a66b42 |
|
BLAKE2b-256 | 4da70d28cb963a7ca22faac3fbdb8b86abba8a2800f38df1e101c030b83777e7 |