跳转到主要内容

包含C函数的模块。目前尚无明确用途。

项目描述

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

cpyquickhelper: 以不同方式创建具有C函数的模块

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 是一个模板,用于以不同方式创建具有C函数的模块。它实现了 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}

它还实现了一个事件分析器:它记录每个事件的时间戳,如函数调用或返回、内存分配。

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

链接

项目详情


下载文件

下载适合您平台文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码发行版

cpyquickhelper-0.3.412.tar.gz (213.6 kB 查看哈希值)

上传时间: 源代码

构建发行版

cpyquickhelper-0.3.412-cp310-cp310-win_amd64.whl (811.8 kB 查看哈希值)

上传于 CPython 3.10 Windows x86-64

cpyquickhelper-0.3.412-cp310-cp310-manylinux_2_24_x86_64.whl (10.2 MB 查看哈希值)

上传于 CPython 3.10 manylinux: glibc 2.24+ x86-64

cpyquickhelper-0.3.412-cp310-cp310-macosx_10_9_x86_64.whl (1.2 MB 查看哈希值)

上传于 CPython 3.10 macOS 10.9+ x86-64

cpyquickhelper-0.3.412-cp39-cp39-win_amd64.whl (802.8 kB 查看哈希值)

上传于 CPython 3.9 Windows x86-64

cpyquickhelper-0.3.412-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.6 MB 查看哈希值)

上传于 CPython 3.9 manylinux: glibc 2.17+ x86-64

cpyquickhelper-0.3.412-cp39-cp39-macosx_10_9_x86_64.whl (1.4 MB 查看哈希值)

上传于 CPython 3.9 macOS 10.9+ x86-64

cpyquickhelper-0.3.412-cp38-cp38-win_amd64.whl (811.7 kB 查看哈希值)

上传于 CPython 3.8 Windows x86-64

cpyquickhelper-0.3.412-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.6 MB 查看哈希值)

上传于 CPython 3.8 manylinux: glibc 2.17+ x86-64

cpyquickhelper-0.3.412-cp38-cp38-macosx_10_9_x86_64.whl (1.2 MB 查看哈希值)

上传于 CPython 3.8 macOS 10.9+ x86-64

cpyquickhelper-0.3.412-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.8 MB 查看哈希值)

上传于 CPython 3.7m manylinux: glibc 2.17+ x86-64

cpyquickhelper-0.3.412-cp37-cp37m-macosx_10_9_x86_64.whl (1.2 MB 查看哈希值)

上传于 CPython 3.7m macOS 10.9+ x86-64

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面