@@ -438,6 +438,8 @@ msgid ""
438438" during the called command/function execution) no profiling results will be "
439439"printed."
440440msgstr ""
441+ "请注意性能分析只有在被调用的命令/函数确实能返回时才可用。 如果解释器被终结(例如在被调用的命令/函数执行期间通过 :func:`sys.exit` "
442+ "调用)则将不会打印性能分析结果。"
441443
442444#: ../../library/profile.rst:324
443445msgid "The :class:`Stats` Class"
@@ -447,14 +449,16 @@ msgstr ":class:`Stats` 类"
447449msgid ""
448450"Analysis of the profiler data is done using the :class:`~pstats.Stats` "
449451"class."
450- msgstr ""
452+ msgstr "性能数据的分析是使用 :class:`~pstats.Stats` 类来完成的。 "
451453
452454#: ../../library/profile.rst:333
453455msgid ""
454456"This class constructor creates an instance of a \" statistics object\" from a"
455457" *filename* (or list of filenames) or from a :class:`Profile` instance. "
456458"Output will be printed to the stream specified by *stream*."
457459msgstr ""
460+ "这个类构造器会基于 *filename* (或文件名列表) 或者 :class:`Profile` 实例创建一个“统计对象”。 输出将被打印到由 "
461+ "*stream* 所指定的流。"
458462
459463#: ../../library/profile.rst:337
460464msgid ""
@@ -469,12 +473,18 @@ msgid ""
469473"an existing :class:`~pstats.Stats` object, the :meth:`~pstats.Stats.add` "
470474"method can be used."
471475msgstr ""
476+ "上述构造器所选择的文件必须由相应版本的 :mod:`profile` 或 :mod:`cProfile` 来创建。 具体来说,*不会* "
477+ "保证文件与此性能分析器的未来版本兼容,也不会保证与其他性能分析器,或运行于不同操作系统的同一性能分析器所产生的文件兼容。 "
478+ "如果提供了几个文件,则相同函数的所有统计数据将被聚合在一起,这样就可以在单个报告中同时考虑几个进程的总体情况。 如果额外的文件需要与现有 "
479+ ":class:`~pstats.Stats` 对象中的数据相结合,则可以使用 :meth:`~pstats.Stats.add` 方法。"
472480
473481#: ../../library/profile.rst:348
474482msgid ""
475483"Instead of reading the profile data from a file, a :class:`cProfile.Profile`"
476484" or :class:`profile.Profile` object can be used as the profile data source."
477485msgstr ""
486+ "作为从一个文件读取性能分析数据的替代,可以使用 :class:`cProfile.Profile` 或 :class:`profile.Profile`"
487+ " 对象作为性能分析数据源。"
478488
479489#: ../../library/profile.rst:351
480490msgid ":class:`Stats` objects have the following methods:"
@@ -493,6 +503,10 @@ msgid ""
493503"the same function name), then the statistics for these two entries are "
494504"accumulated into a single entry."
495505msgstr ""
506+ "这个用于 :class:`Stats` 类的方法会从文件名中去除所有前导路径信息。 它对于减少打印输出的大小以适应(接近) 80 列限制。 "
507+ "这个方法会修改对象,被去除的信息将会丢失。 在执行去除操作后,可以认为对象拥有的条目将使用“随机”顺序,就像它刚在对象初始化并加载之后一样。 如果 "
508+ ":meth:`~pstats.Stats.strip_dirs` "
509+ "导致两个函数名变得无法区分(它们位于相同文件名的相同行,并且具有相同的函数名),那么这两个条目的统计数据将被累积到单个条目中。"
496510
497511#: ../../library/profile.rst:369
498512msgid ""
@@ -503,6 +517,9 @@ msgid ""
503517"name) functions are automatically accumulated into single function "
504518"statistics."
505519msgstr ""
520+ ":class:`Stats` 类的这个方法会将额外的性能分析信息累积到当前的性能分析对象中。 它的参数应当指向由相应版本的 "
521+ ":func:`profile.run` 或 :func:`cProfile.run` 所创建的文件名。 相同名称(包括 file, line, "
522+ "name)函数的统计信息会自动累积到单个函数的统计信息。"
506523
507524#: ../../library/profile.rst:379
508525msgid ""
0 commit comments