分析/调试缓慢的Django请求

2024-10-02 08:20:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我在本地的django dev服务器上运行了一个带有django Debug工具栏的页面,它似乎运行得很慢,但我不确定为什么:

Django调试工具栏显示

Resource    Value
User CPU time   1317.854 msec
System CPU time 191.942 msec
Total CPU time  1509.796 msec
Elapsed time    1473.806 msec
Context switches    6 voluntary, 16842 involuntary

SQL—39.80ms内有46个查询

然后运行探查器https://sourcegraph.com/github.com/shaunsephton/django-snippetscream/.PipPackage/django-snippetscream/.def/snippetscream/_186/ProfileMiddleware

我在0.024秒内得到7926个函数调用(7774个原始调用)

为什么总的CPU时间比我的总时间还少?在

那我怎么才能找出造成这种差异的原因呢?在

其次,我应该担心16842个非自愿的上下文切换吗!?在


Tags: djangodevdebug服务器comtimevalue时间

热门问题