From 78e03d80edfd7db7ac130d49cc44a7073c249dc2 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Mon, 7 Aug 2023 02:02:48 +0800 Subject: [PATCH 1/3] translate `howto/perf_profiling.po` --- howto/perf_profiling.po | 67 +++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 75a9a97b75..92a40878cb 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -1,17 +1,17 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2023, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # -#, fuzzy +# Translators: +# Matt Wang , 2023 msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-11-16 00:03+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2023-12-09 17:39+0800\n" +"Last-Translator: Matt Wang \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,15 +19,15 @@ msgstr "" #: ../../howto/perf_profiling.rst:7 msgid "Python support for the Linux ``perf`` profiler" -msgstr "" +msgstr "Python 對 Linux ``perf`` 分析器的支援" #: ../../howto/perf_profiling.rst:0 msgid "author" -msgstr "" +msgstr "作者" #: ../../howto/perf_profiling.rst:9 msgid "Pablo Galindo" -msgstr "" +msgstr "Pablo Galindo" #: ../../howto/perf_profiling.rst:11 msgid "" @@ -36,6 +36,9 @@ msgid "" "of your application. ``perf`` also has a very vibrant ecosystem of tools " "that aid with the analysis of the data that it produces." msgstr "" +"`Linux 性能分析器 (Linux perf profiler) `_ 是一" +"個非常強大的工具,可讓你分析並獲取應用程式相關的性能資訊。``perf`` 還擁有一個" +"非常活躍的工具生態系統,有助於分析其生成的資料。" #: ../../howto/perf_profiling.rst:17 msgid "" @@ -45,6 +48,9 @@ msgid "" "and file names of Python functions in your code will not appear in the " "output of ``perf``." msgstr "" +"在 Python 應用程式中使用 ``perf`` 分析器的主要問題是 ``perf`` 僅獲取有關原生" +"符號的資訊,即為用 C 編寫的函式和程序的名稱。這意味著程式碼中的 Python 函式名" +"稱和檔案名稱不會出現在 ``perf`` 的輸出中。" #: ../../howto/perf_profiling.rst:22 msgid "" @@ -55,6 +61,10 @@ msgid "" "will teach ``perf`` the relationship between this piece of code and the " "associated Python function using :doc:`perf map files <../c-api/perfmaps>`." msgstr "" +"從 Python 3.12 開始,直譯器可以在特殊模式下運行,該模式允許 Python 函式出現" +"在 ``perf`` 分析器的輸出中。啟用此模式後,直譯器將在執行每個 Python 函式之前" +"插入 (interpose) 一小段動態編譯的程式碼,並使用 :doc:`perf map 檔案 <../c-" +"api/perfmaps>`\\ 來教導 ``perf`` 這段程式碼與相關聯的 Python 函式間的關係。" #: ../../howto/perf_profiling.rst:31 msgid "" @@ -63,18 +73,21 @@ msgid "" "check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE`` to " "see if your system is supported." msgstr "" +"目前,對 ``perf`` 分析器的支援僅適用於 Linux 的特定架構上。檢查 " +"``configure`` 建構步驟的輸出或檢查 ``python -m sysconfig | grep " +"HAVE_PERF_TRAMPOLINE`` 的輸出來查看你的系統是否支援。" #: ../../howto/perf_profiling.rst:36 msgid "For example, consider the following script:" -msgstr "" +msgstr "例如,參考以下腳本:" #: ../../howto/perf_profiling.rst:55 msgid "We can run ``perf`` to sample CPU stack traces at 9999 hertz::" -msgstr "" +msgstr "我們可以運行 ``perf`` 以 9999 赫茲採樣 CPU 堆疊追蹤 (stack trace): ::" #: ../../howto/perf_profiling.rst:59 msgid "Then we can use ``perf report`` to analyze the data:" -msgstr "" +msgstr "然後我們可以使用 ``perf report`` 來分析資料:" #: ../../howto/perf_profiling.rst:100 msgid "" @@ -84,15 +97,20 @@ msgid "" "functions use the same C function to evaluate bytecode so we cannot know " "which Python function corresponds to which bytecode-evaluating function." msgstr "" +"如你所見,Python 函式未顯示在輸出中,僅顯示 ``_Py_Eval_EvalFrameDefault`` " +"(計算 Python 位元組碼 (bytecode) 的函式)。不幸的是,這不是很有用,因為所有 " +"Python 函式都使用相同的 C 函式來計算位元組碼,因此我們無法知道哪個 Python 函" +"式是對應於哪個位元組碼計算函式。" #: ../../howto/perf_profiling.rst:105 msgid "" "Instead, if we run the same experiment with ``perf`` support enabled we get:" msgstr "" +"相反地,如果我們在啟用 ``perf`` 支援的情況下運行相同的實驗,我們會得到:" #: ../../howto/perf_profiling.rst:152 msgid "How to enable ``perf`` profiling support" -msgstr "" +msgstr "如何啟用 ``perf`` 分析支援" #: ../../howto/perf_profiling.rst:154 msgid "" @@ -101,32 +119,37 @@ msgid "" "X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :" "func:`sys.deactivate_stack_trampoline`." msgstr "" +"要啟用 ``perf`` 分析支援,可以在一開始就使用環境變數 :envvar:" +"`PYTHONPERFSUPPORT` 或使用 :option:`-X perf <-X>` 選項,也可以使用 :func:" +"`sys.activate_stack_trampoline` 和 :func:`sys.deactivate_stack_trampoline` 來" +"動態啟用。" #: ../../howto/perf_profiling.rst:160 msgid "" "The :mod:`!sys` functions take precedence over the :option:`!-X` option, " "the :option:`!-X` option takes precedence over the environment variable." msgstr "" +":mod:`!sys` 函式優先於 :option:`!-X` 選項、:option:`!-X` 選項優先於環境變數。" #: ../../howto/perf_profiling.rst:163 msgid "Example, using the environment variable::" -msgstr "" +msgstr "例如,使用環境變數: ::" #: ../../howto/perf_profiling.rst:168 msgid "Example, using the :option:`!-X` option::" -msgstr "" +msgstr "例如,使用 :option:`!-X` 選項: ::" #: ../../howto/perf_profiling.rst:173 msgid "Example, using the :mod:`sys` APIs in file :file:`example.py`:" -msgstr "" +msgstr "例如,在 :file:`example.py` 檔案中使用 :mod:`sys` API:" #: ../../howto/perf_profiling.rst:185 msgid "...then::" -msgstr "" +msgstr "...然後: ::" #: ../../howto/perf_profiling.rst:192 msgid "How to obtain the best results" -msgstr "" +msgstr "如何獲得最佳結果" #: ../../howto/perf_profiling.rst:194 msgid "" @@ -137,11 +160,15 @@ msgid "" "dynamically generated it doesn't have any DWARF debugging information " "available." msgstr "" +"為了獲得最佳結果,應使用 ``CFLAGS=\"-fno-omit-frame-pointer -mno-omit-leaf-" +"frame-pointer\"`` 來進行 Python 編譯,因為這能允許分析器僅使用 frame 指標而不" +"是在 DWARF 上展開除錯資訊。這是因為,由於插入以允許 ``perf`` 支援的程式碼是動" +"態生成的,因此它沒有任何可用的 DWARF 除錯資訊。" #: ../../howto/perf_profiling.rst:201 msgid "" "You can check if your system has been compiled with this flag by running::" -msgstr "" +msgstr "你可以透過運行以下指令來檢查你的系統是否已使用此旗標進行編譯: ::" #: ../../howto/perf_profiling.rst:205 msgid "" @@ -149,3 +176,5 @@ msgid "" "compiled with frame pointers and therefore it may not be able to show Python " "functions in the output of ``perf``." msgstr "" +"如果你沒有看到任何輸出,則意味著你的直譯器尚未使用 frame 指標進行編譯,因此它" +"可能無法在 ``perf`` 的輸出中顯示 Python 函式。" From 9a821bed92cde586e29d2a239bbcb681ce3bc2ac Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Sun, 10 Dec 2023 22:39:43 +0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: mindihx --- howto/perf_profiling.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 92a40878cb..7eeab3e171 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -37,7 +37,7 @@ msgid "" "that aid with the analysis of the data that it produces." msgstr "" "`Linux 性能分析器 (Linux perf profiler) `_ 是一" -"個非常強大的工具,可讓你分析並獲取應用程式相關的性能資訊。``perf`` 還擁有一個" +"個非常強大的工具,可讓你分析並獲取有關應用程式的性能資訊。``perf`` 還擁有一個" "非常活躍的工具生態系統,有助於分析其生成的資料。" #: ../../howto/perf_profiling.rst:17 @@ -49,7 +49,7 @@ msgid "" "output of ``perf``." msgstr "" "在 Python 應用程式中使用 ``perf`` 分析器的主要問題是 ``perf`` 僅獲取有關原生" -"符號的資訊,即為用 C 編寫的函式和程序的名稱。這意味著程式碼中的 Python 函式名" +"符號的資訊,即用 C 編寫的函式和程式的名稱。這表示程式碼中的 Python 函式名" "稱和檔案名稱不會出現在 ``perf`` 的輸出中。" #: ../../howto/perf_profiling.rst:22 @@ -64,7 +64,7 @@ msgstr "" "從 Python 3.12 開始,直譯器可以在特殊模式下運行,該模式允許 Python 函式出現" "在 ``perf`` 分析器的輸出中。啟用此模式後,直譯器將在執行每個 Python 函式之前" "插入 (interpose) 一小段動態編譯的程式碼,並使用 :doc:`perf map 檔案 <../c-" -"api/perfmaps>`\\ 來教導 ``perf`` 這段程式碼與相關聯的 Python 函式間的關係。" +"api/perfmaps>`\\ 來告訴 ``perf`` 這段程式碼與相關聯的 Python 函式間的關係。" #: ../../howto/perf_profiling.rst:31 msgid "" @@ -73,7 +73,7 @@ msgid "" "check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE`` to " "see if your system is supported." msgstr "" -"目前,對 ``perf`` 分析器的支援僅適用於 Linux 的特定架構上。檢查 " +"目前對 ``perf`` 分析器的支援僅適用於 Linux 的特定架構上。檢查 " "``configure`` 建構步驟的輸出或檢查 ``python -m sysconfig | grep " "HAVE_PERF_TRAMPOLINE`` 的輸出來查看你的系統是否支援。" @@ -83,7 +83,7 @@ msgstr "例如,參考以下腳本:" #: ../../howto/perf_profiling.rst:55 msgid "We can run ``perf`` to sample CPU stack traces at 9999 hertz::" -msgstr "我們可以運行 ``perf`` 以 9999 赫茲採樣 CPU 堆疊追蹤 (stack trace): ::" +msgstr "我們可以執行 ``perf`` 以 9999 赫茲採樣 CPU 堆疊追蹤 (stack trace): ::" #: ../../howto/perf_profiling.rst:59 msgid "Then we can use ``perf report`` to analyze the data:" @@ -106,7 +106,7 @@ msgstr "" msgid "" "Instead, if we run the same experiment with ``perf`` support enabled we get:" msgstr "" -"相反地,如果我們在啟用 ``perf`` 支援的情況下運行相同的實驗,我們會得到:" +"作為替代,如果我們在啟用 ``perf`` 支援的情況下執行相同的實驗,我們會得到:" #: ../../howto/perf_profiling.rst:152 msgid "How to enable ``perf`` profiling support" @@ -162,13 +162,13 @@ msgid "" msgstr "" "為了獲得最佳結果,應使用 ``CFLAGS=\"-fno-omit-frame-pointer -mno-omit-leaf-" "frame-pointer\"`` 來進行 Python 編譯,因為這能允許分析器僅使用 frame 指標而不" -"是在 DWARF 上展開除錯資訊。這是因為,由於插入以允許 ``perf`` 支援的程式碼是動" +"是 DWARF 除錯資訊來解析 (unwind)。這是因為,由於插入以允許 ``perf`` 支援的程式碼是動" "態生成的,因此它沒有任何可用的 DWARF 除錯資訊。" #: ../../howto/perf_profiling.rst:201 msgid "" "You can check if your system has been compiled with this flag by running::" -msgstr "你可以透過運行以下指令來檢查你的系統是否已使用此旗標進行編譯: ::" +msgstr "你可以透過執行以下指令來檢查你的系統是否已使用此旗標進行編譯: ::" #: ../../howto/perf_profiling.rst:205 msgid "" From 5ff5f50de1f8325994daccbd4206eac1ebd81e82 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Wed, 13 Dec 2023 13:56:15 +0800 Subject: [PATCH 3/3] Apply suggestions from code review --- howto/perf_profiling.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 7eeab3e171..014a299da8 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -61,7 +61,7 @@ msgid "" "will teach ``perf`` the relationship between this piece of code and the " "associated Python function using :doc:`perf map files <../c-api/perfmaps>`." msgstr "" -"從 Python 3.12 開始,直譯器可以在特殊模式下運行,該模式允許 Python 函式出現" +"從 Python 3.12 開始,直譯器可以在特殊模式下執行,該模式允許 Python 函式出現" "在 ``perf`` 分析器的輸出中。啟用此模式後,直譯器將在執行每個 Python 函式之前" "插入 (interpose) 一小段動態編譯的程式碼,並使用 :doc:`perf map 檔案 <../c-" "api/perfmaps>`\\ 來告訴 ``perf`` 這段程式碼與相關聯的 Python 函式間的關係。" @@ -98,8 +98,8 @@ msgid "" "which Python function corresponds to which bytecode-evaluating function." msgstr "" "如你所見,Python 函式未顯示在輸出中,僅顯示 ``_Py_Eval_EvalFrameDefault`` " -"(計算 Python 位元組碼 (bytecode) 的函式)。不幸的是,這不是很有用,因為所有 " -"Python 函式都使用相同的 C 函式來計算位元組碼,因此我們無法知道哪個 Python 函" +"(為 Python 位元組碼 (bytecode) 求值的函式)。不幸的是,這不是很有用,因為所有 " +"Python 函式都使用相同的 C 函式來替位元組碼求值,因此我們無法知道哪個 Python 函" "式是對應於哪個位元組碼計算函式。" #: ../../howto/perf_profiling.rst:105 @@ -176,5 +176,5 @@ msgid "" "compiled with frame pointers and therefore it may not be able to show Python " "functions in the output of ``perf``." msgstr "" -"如果你沒有看到任何輸出,則意味著你的直譯器尚未使用 frame 指標進行編譯,因此它" +"如果你沒有看到任何輸出,則表示你的直譯器尚未使用 frame 指標進行編譯,因此它" "可能無法在 ``perf`` 的輸出中顯示 Python 函式。"