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(lambda: cos(0.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:
Release files for cpyquickhelper 0.3.412
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cpyquickhelper-0.3.412.tar.gz | 213.6 kB | Details |
Built distributions (wheels)
Total release size: 50.0 MB
Release files / cpyquickhelper-0.3.412.tar.gz
| Download URL | cpyquickhelper-0.3.412.tar.gz |
|---|---|
| Size | 213.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d03b3547f31c5753af82e12222537d92caee0241285b60fe5cc4468a9cbb749
|
|
BLAKE2b-256 checksum How to use checksums |
2c9fd9f65165cc8a273e5a6e8cc0e838f601988fe1c84ef00a7cf9f43187fa46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp310-cp310-win_amd64.whl
| Download URL | cpyquickhelper-0.3.412-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 811.8 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0c990acbdb2027d5aa548e4a2ed5490932c2829d31bed4e52126dd5eb3045a0a
|
|
BLAKE2b-256 checksum How to use checksums |
d2e3a8e5ee7b0196302da3da0a562336238d7091a6f1fcd0a559c37119aee24f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp310-cp310-manylinux_2_24_x86_64.whl
| Download URL | cpyquickhelper-0.3.412-cp310-cp310-manylinux_2_24_x86_64.whl |
|---|---|
| Size | 10.2 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 |
|
SHA-256 checksum How to use checksums |
2d9951a1f773c45a55a1b01066e94c78f39d7da8ac6e6d171e1b08c8501fc637
|
|
BLAKE2b-256 checksum How to use checksums |
7370ae1a42f4b24f0c99da4667c02fc0abf11257be1654da6d662c8aa06a9979
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | cpyquickhelper-0.3.412-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
83099d5d6ea782588a05ff9803e703230a4065481ed36368e2fda45fa852b86c
|
|
BLAKE2b-256 checksum How to use checksums |
e284a1d2e374d3ea6f1b3bb6009e1f84b35d4e12a91a23276ab6761b53a55eb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp39-cp39-win_amd64.whl
| Download URL | cpyquickhelper-0.3.412-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 802.8 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ae1f122b720889cca09d742495a121f594fbe3d8d58394e0942c8ef718d87608
|
|
BLAKE2b-256 checksum How to use checksums |
adec81d3b7f171bb57150265b6cfa0801e7f6ea3f8b7aff1a6ea08b0f4be136e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cpyquickhelper-0.3.412-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 10.6 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
f126af31e4359985571255fc0c90bc4f26f7432c0fd41248738ef5de91255635
|
|
BLAKE2b-256 checksum How to use checksums |
d89288a2baef0530915961ce3d7e6e505a7283f327c5d2e51418d32a1fa0860d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | cpyquickhelper-0.3.412-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
e1d11238e7ace92d03c3394b20998e30efd24361c9f53feb52457d0ac38e74ea
|
|
BLAKE2b-256 checksum How to use checksums |
e7a7d2d30cce1fd49efec586f3caf364752e657dfa1b7338aa8f5c8b4a84e062
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp38-cp38-win_amd64.whl
| Download URL | cpyquickhelper-0.3.412-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 811.7 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
519eb6c433566440f49489bf76029a2e5156b55de8b3b5667cc41e6f32e945db
|
|
BLAKE2b-256 checksum How to use checksums |
c6c32dda44fd5161acb7760d4417b5f5d57254338189b7b9b71112dbdb1d727b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cpyquickhelper-0.3.412-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 10.6 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
c8e0907f6d503b204cd50b97003e449d7b1e0231b6f9e8d52dd30daada83fdb3
|
|
BLAKE2b-256 checksum How to use checksums |
655c47aa0c0dc7bcfa34b0692426c6af14dda115f95957ae0be71e3a4f5b19a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp38-cp38-macosx_10_9_x86_64.whl
| Download URL | cpyquickhelper-0.3.412-cp38-cp38-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.8 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
735b345f15fe7c90905d9adbc9491881328eb380c4895144e47e4c645d6cf73e
|
|
BLAKE2b-256 checksum How to use checksums |
f30e52f9da1123e672f8fed99ebd8df3e4146a51e231a3e51be0bedc457f3b4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cpyquickhelper-0.3.412-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 10.8 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
eaf9967f07b624f8e661b1669f40a155c868b82576c9c2127adb3a554c35ed83
|
|
BLAKE2b-256 checksum How to use checksums |
97a25681a0fd5b7a8d3f133084098f13b992f0376b914eeba6f70a96b48af0db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / cpyquickhelper-0.3.412-cp37-cp37m-macosx_10_9_x86_64.whl
| Download URL | cpyquickhelper-0.3.412-cp37-cp37m-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
3e182acd932d4413928e2f65acaf90e4bf4810925255e27ee316dc9e64e3568b
|
|
BLAKE2b-256 checksum How to use checksums |
42b12040dffdc22e04e8165d6f24b0dee89d4395d1ebc47c3159bf3a06dd82d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|