Django Debug Toolbar: understanding the time panel

情到浓时终转凉″ 提交于 2019-11-30 10:29:54

问题


I'm running the Django Debug Toolbar to profile my site and try to figure out why certain views are taking so long. It's been immensely valuable with regards to seeing what queries I'm running and how much they're costing me, but I can't understand how to read the time panel.

I've looked around everywhere for some documentation on this but can't seem to find anything. I should mention that I'm a self-taught, relatively new programmer, so these may be terms that are assumed to be familiar to the experienced programmer.

Here is the output:

Resource         Value
User CPU time    3760.000 msec
System CPU time  340.000 msec
Total CPU time   4100.000 msec
Elapsed time     4625.453 msec
Context switches 248 voluntary, 467 involuntary

Can anyone help me figure out how to read this, and what each of the values represents?

Thanks.


回答1:


User CPU time: The time your server-side code ran while processing the request

System CPU time: The time operating system code called by your server-side code ran while processing the request

Total CPU time: total time to fully respond once request was received (user+system)

Elapsed time: Time since request was made.

Context switches: This has to do with threads. Voluntary switches are times when a thread slept of its own accord (usually to wait for some of processing to occur that it needs to continue), whereas involuntary switches are times when the system forced a thread to sleep in order to run some other thread (usually part of asynchronous processes). It's actually pretty low-level system stuff, that I couldn't do justice to here. If you're interested in learning more, just search for "context switching".



来源:https://stackoverflow.com/questions/8232434/django-debug-toolbar-understanding-the-time-panel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!