# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # Rafael Fontenelle , 2025 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-25 16:03+0000\n" "PO-Revision-Date: 2025-07-18 19:57+0000\n" "Last-Translator: Rafael Fontenelle , 2025\n" "Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../c-api/perfmaps.rst:6 msgid "Support for Perf Maps" msgstr "对 Perf Maps 的支持" #: ../../c-api/perfmaps.rst:8 msgid "" "On supported platforms (as of this writing, only Linux), the runtime can " "take advantage of *perf map files* to make Python functions visible to an " "external profiling tool (such as `perf " "`_). A running process may" " create a file in the ``/tmp`` directory, which contains entries that can " "map a section of executable code to a name. This interface is described in " "the `documentation of the Linux Perf tool " "`_." msgstr "" "在受支持的平台上(在撰写本文档时,只有 Linux),运行时可以利用 *perf map 文件* 来使得 Python " "函数对于外部性能分析工具可见(例如 `perf `_" " 等)。 正在运行的进行可以在 ``/tmp`` 目录中创建一个文件,其中包含可将部分可执行代码映射到特定名称的条目。 本接口的描述参见 `Linux " "Perf 工具文档 `_。" #: ../../c-api/perfmaps.rst:16 msgid "" "In Python, these helper APIs can be used by libraries and features that rely" " on generating machine code on the fly." msgstr "在 Python 中,这些辅助 API 可供依赖于动态生成机器码的库和特性使用。" #: ../../c-api/perfmaps.rst:19 msgid "" "Note that holding the Global Interpreter Lock (GIL) is not required for " "these APIs." msgstr "请注意这些 API 并不要求持有全局解释器锁(GIL)。" #: ../../c-api/perfmaps.rst:23 msgid "" "Open the ``/tmp/perf-$pid.map`` file, unless it's already opened, and create" " a lock to ensure thread-safe writes to the file (provided the writes are " "done through :c:func:`PyUnstable_WritePerfMapEntry`). Normally, there's no " "need to call this explicitly; just use " ":c:func:`PyUnstable_WritePerfMapEntry` and it will initialize the state on " "first call." msgstr "" "打开 ``/tmp/perf-$pid.map`` 文件,除非它已经被打开,并创建一个锁来确保线程安全地写入该文件(如果写入是通过 " ":c:func:`PyUnstable_WritePerfMapEntry` 执行的)。 通常,没有必要显式地调用此函数;只需使用 " ":c:func:`PyUnstable_WritePerfMapEntry` 这样它将在第一次调用时初始化状态。" #: ../../c-api/perfmaps.rst:29 msgid "" "Returns ``0`` on success, ``-1`` on failure to create/open the perf map " "file, or ``-2`` on failure to create a lock. Check ``errno`` for more " "information about the cause of a failure." msgstr "" "成功时返回 ``0``,创建/打开 perf map 文件失败时返回 ``-1``,或者创建锁失败时返回 ``-2``。 可检查 ``errno`` " "获取有关失败原因的更多信息。" #: ../../c-api/perfmaps.rst:35 msgid "" "Write one single entry to the ``/tmp/perf-$pid.map`` file. This function is " "thread safe. Here is what an example entry looks like::" msgstr "向 ``/tmp/perf-$pid.map`` 文件写入一个单独条目。 此函数是线程安全的。 下面显示了一个示例条目::" #: ../../c-api/perfmaps.rst:38 msgid "" "# address size name\n" "7f3529fcf759 b py::bar:/run/t.py" msgstr "" "# 地址 大小 名称\n" "7f3529fcf759 b py::bar:/run/t.py" #: ../../c-api/perfmaps.rst:41 msgid "" "Will call :c:func:`PyUnstable_PerfMapState_Init` before writing the entry, " "if the perf map file is not already opened. Returns ``0`` on success, or the" " same error codes as :c:func:`PyUnstable_PerfMapState_Init` on failure." msgstr "" "将在写入条目之前调用 :c:func:`PyUnstable_PerfMapState_Init`,如果 perf map 文件尚未打开。 成功时返回 " "``0``,或者在失败时返回与 :c:func:`PyUnstable_PerfMapState_Init` 相同的错误代码。" #: ../../c-api/perfmaps.rst:47 msgid "" "Close the perf map file opened by :c:func:`PyUnstable_PerfMapState_Init`. " "This is called by the runtime itself during interpreter shut-down. In " "general, there shouldn't be a reason to explicitly call this, except to " "handle specific scenarios such as forking." msgstr "" "关闭 :c:func:`PyUnstable_PerfMapState_Init` 所打开的 perf map 文件。 " "此函数会在解释器关闭期间由运行时本身调用。 通常,应该没有理由显式地调用此函数,除了处理特殊场景例如分叉操作。"