⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profile-limits.html

📁 一本很好的python的说明书,适合对python感兴趣的人
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>10.6 Limitations </title>
<META NAME="description" CONTENT="10.6 Limitations ">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="next" href="profile-calibration.html" tppabs="http://www.python.org/doc/current/lib/profile-calibration.html">
<LINK REL="previous" href="module-profile.html" tppabs="http://www.python.org/doc/current/lib/module-profile.html">
<LINK REL="up" href="profile.html" tppabs="http://www.python.org/doc/current/lib/profile.html">
<LINK REL="next" href="profile-calibration.html" tppabs="http://www.python.org/doc/current/lib/profile-calibration.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="profile-stats.html" tppabs="http://www.python.org/doc/current/lib/profile-stats.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="profile.html" tppabs="http://www.python.org/doc/current/lib/profile.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="profile-calibration.html" tppabs="http://www.python.org/doc/current/lib/profile-calibration.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="profile-stats.html" tppabs="http://www.python.org/doc/current/lib/profile-stats.html">10.5.1 The Stats Class</A>
<b class="navlabel">Up:</b> <a class="sectref" href="profile.html" tppabs="http://www.python.org/doc/current/lib/profile.html">10. The Python Profiler</A>
<b class="navlabel">Next:</b> <a class="sectref" href="profile-calibration.html" tppabs="http://www.python.org/doc/current/lib/profile-calibration.html">10.7 Calibration</A>
<br><hr></DIV>
<!--End of Navigation Panel-->

<H1>
<BR>
10.6 Limitations 
</H1>

<P>
There are two fundamental limitations on this profiler.  The first is
that it relies on the Python interpreter to dispatch <i class="dfn">call</i>,
<i class="dfn">return</i>, and <i class="dfn">exception</i> events.  Compiled C code does not
get interpreted, and hence is ``invisible'' to the profiler.  All time
spent in C code (including built-in functions) will be charged to the
Python function that invoked the C code.  If the C code calls out
to some native Python code, then those calls will be profiled
properly.

<P>
The second limitation has to do with accuracy of timing information.
There is a fundamental problem with deterministic profilers involving
accuracy.  The most obvious restriction is that the underlying ``clock''
is only ticking at a rate (typically) of about .001 seconds.  Hence no
measurements will be more accurate that that underlying clock.  If
enough measurements are taken, then the ``error'' will tend to average
out. Unfortunately, removing this first error induces a second source
of error...

<P>
The second problem is that it ``takes a while'' from when an event is
dispatched until the profiler's call to get the time actually
<i>gets</i> the state of the clock.  Similarly, there is a certain lag
when exiting the profiler event handler from the time that the clock's
value was obtained (and then squirreled away), until the user's code
is once again executing.  As a result, functions that are called many
times, or call many functions, will typically accumulate this error.
The error that accumulates in this fashion is typically less than the
accuracy of the clock (i.e., less than one clock tick), but it
<i>can</i> accumulate and become very significant.  This profiler
provides a means of calibrating itself for a given platform so that
this error can be probabilistically (i.e., on the average) removed.
After the profiler is calibrated, it will be more accurate (in a least
square sense), but it will sometimes produce negative numbers (when
call counts are exceptionally low, and the gods of probability work
against you :-). )  Do <i>not</i> be alarmed by negative numbers in
the profile.  They should <i>only</i> appear if you have calibrated
your profiler, and the results are actually better than without
calibration.

<P>

<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="profile-stats.html" tppabs="http://www.python.org/doc/current/lib/profile-stats.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="profile.html" tppabs="http://www.python.org/doc/current/lib/profile.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="profile-calibration.html" tppabs="http://www.python.org/doc/current/lib/profile-calibration.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="profile-stats.html" tppabs="http://www.python.org/doc/current/lib/profile-stats.html">10.5.1 The Stats Class</A>
<b class="navlabel">Up:</b> <a class="sectref" href="profile.html" tppabs="http://www.python.org/doc/current/lib/profile.html">10. The Python Profiler</A>
<b class="navlabel">Next:</b> <a class="sectref" href="profile-calibration.html" tppabs="http://www.python.org/doc/current/lib/profile-calibration.html">10.7 Calibration</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -