-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathprofiling.po
More file actions
344 lines (298 loc) · 15.6 KB
/
profiling.po
File metadata and controls
344 lines (298 loc) · 15.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# 99 <wh2099@pm.me>, 2026
# python-doc bot, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-04-27 15:43+0000\n"
"PO-Revision-Date: 2026-02-25 14:46+0000\n"
"Last-Translator: python-doc bot, 2026\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/profiling.rst:6
msgid "Profiling and tracing"
msgstr ""
#: ../../c-api/profiling.rst:8
msgid ""
"The Python interpreter provides some low-level support for attaching "
"profiling and execution tracing facilities. These are used for profiling, "
"debugging, and coverage analysis tools."
msgstr "Python 解释器为附加的性能分析和执行跟踪工具提供了一些低层级的支持。它们可被用于性能分析、调试和覆盖分析工具。"
#: ../../c-api/profiling.rst:12
msgid ""
"This C interface allows the profiling or tracing code to avoid the overhead "
"of calling through Python-level callable objects, making a direct C function"
" call instead. The essential attributes of the facility have not changed; "
"the interface allows trace functions to be installed per-thread, and the "
"basic events reported to the trace function are the same as had been "
"reported to the Python-level trace functions in previous versions."
msgstr ""
"这个 C 接口允许性能分析或跟踪代码避免调用 Python 层级的可调用对象带来的开销,它能直接执行 C 函数调用。 "
"此工具的基本属性没有变化;这个接口允许针对每个线程安装跟踪函数,并且向跟踪函数报告的基本事件与之前版本中向 Python 层级跟踪函数报告的事件相同。"
#: ../../c-api/profiling.rst:22
msgid ""
"The type of the trace function registered using :c:func:`PyEval_SetProfile` "
"and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to "
"the registration function as *obj*, *frame* is the frame object to which the"
" event pertains, *what* is one of the constants :c:data:`PyTrace_CALL`, "
":c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, "
":c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, "
":c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`, or "
":c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:"
msgstr ""
"使用 :c:func:`PyEval_SetProfile` 和 :c:func:`PyEval_SetTrace` 注册的跟踪函数的类型。 "
"第一个形参是作为 *obj* 传递给注册函数的对象,*frame* 是与事件相关的帧对象,*what* 是常量 "
":c:data:`PyTrace_CALL`, :c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`,"
" :c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, "
":c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN` 或 "
":c:data:`PyTrace_OPCODE` 中的一个,而 *arg* 将依赖于 *what* 的值:"
#: ../../c-api/profiling.rst:31
msgid "Value of *what*"
msgstr "*what* 的值"
#: ../../c-api/profiling.rst:31
msgid "Meaning of *arg*"
msgstr "*arg* 的含义"
#: ../../c-api/profiling.rst:33
msgid ":c:data:`PyTrace_CALL`"
msgstr ":c:data:`PyTrace_CALL`"
#: ../../c-api/profiling.rst:33 ../../c-api/profiling.rst:38
#: ../../c-api/profiling.rst:49
msgid "Always :c:data:`Py_None`."
msgstr "总是 :c:data:`Py_None`."
#: ../../c-api/profiling.rst:35
msgid ":c:data:`PyTrace_EXCEPTION`"
msgstr ":c:data:`PyTrace_EXCEPTION`"
#: ../../c-api/profiling.rst:35
msgid "Exception information as returned by :func:`sys.exc_info`."
msgstr ":func:`sys.exc_info` 返回的异常信息。"
#: ../../c-api/profiling.rst:38
msgid ":c:data:`PyTrace_LINE`"
msgstr ":c:data:`PyTrace_LINE`"
#: ../../c-api/profiling.rst:40
msgid ":c:data:`PyTrace_RETURN`"
msgstr ":c:data:`PyTrace_RETURN`"
#: ../../c-api/profiling.rst:40
msgid ""
"Value being returned to the caller, or ``NULL`` if caused by an exception."
msgstr "返回给调用方的值,或者如果是由异常导致的则返回 ``NULL``。"
#: ../../c-api/profiling.rst:43
msgid ":c:data:`PyTrace_C_CALL`"
msgstr ":c:data:`PyTrace_C_CALL`"
#: ../../c-api/profiling.rst:43 ../../c-api/profiling.rst:45
#: ../../c-api/profiling.rst:47
msgid "Function object being called."
msgstr "正在调用函数对象。"
#: ../../c-api/profiling.rst:45
msgid ":c:data:`PyTrace_C_EXCEPTION`"
msgstr ":c:data:`PyTrace_C_EXCEPTION`"
#: ../../c-api/profiling.rst:47
msgid ":c:data:`PyTrace_C_RETURN`"
msgstr ":c:data:`PyTrace_C_RETURN`"
#: ../../c-api/profiling.rst:49
msgid ":c:data:`PyTrace_OPCODE`"
msgstr ":c:data:`PyTrace_OPCODE`"
#: ../../c-api/profiling.rst:54
msgid ""
"The value of the *what* parameter to a :c:type:`Py_tracefunc` function when "
"a new call to a function or method is being reported, or a new entry into a "
"generator. Note that the creation of the iterator for a generator function "
"is not reported as there is no control transfer to the Python bytecode in "
"the corresponding frame."
msgstr ""
"当对一个函数或方法的新调用被报告,或是向一个生成器增加新条目时传给 :c:type:`Py_tracefunc` 函数的 *what* 形参的值。 "
"请注意针对生成器函数的迭代器的创建情况不会被报告因为在相应的帧中没有向 Python 字节码转移控制权。"
#: ../../c-api/profiling.rst:63
msgid ""
"The value of the *what* parameter to a :c:type:`Py_tracefunc` function when "
"an exception has been raised. The callback function is called with this "
"value for *what* when after any bytecode is processed after which the "
"exception becomes set within the frame being executed. The effect of this "
"is that as exception propagation causes the Python stack to unwind, the "
"callback is called upon return to each frame as the exception propagates. "
"Only trace functions receive these events; they are not needed by the "
"profiler."
msgstr ""
#: ../../c-api/profiling.rst:74
msgid ""
"The value passed as the *what* parameter to a :c:type:`Py_tracefunc` "
"function (but not a profiling function) when a line-number event is being "
"reported. It may be disabled for a frame by setting "
":attr:`~frame.f_trace_lines` to *0* on that frame."
msgstr ""
"当一个行编号事件被报告时传给 :c:type:`Py_tracefunc` 函数 (但不会传给性能分析函数) 的 *what* 形参的值。它可以通过将 "
":attr:`~frame.f_trace_lines` 设为 *0* 在某个帧中被禁用。"
#: ../../c-api/profiling.rst:82
msgid ""
"The value for the *what* parameter to :c:type:`Py_tracefunc` functions when "
"a call is about to return."
msgstr "当一个调用即将返回时传给 :c:type:`Py_tracefunc` 函数的 *what* 形参的值。"
#: ../../c-api/profiling.rst:88
msgid ""
"The value for the *what* parameter to :c:type:`Py_tracefunc` functions when "
"a C function is about to be called."
msgstr "当一个 C 函数即将被调用时传给 :c:type:`Py_tracefunc` 函数的 *what* 形参的值。"
#: ../../c-api/profiling.rst:94
msgid ""
"The value for the *what* parameter to :c:type:`Py_tracefunc` functions when "
"a C function has raised an exception."
msgstr "当一个 C 函数引发异常时传给 :c:type:`Py_tracefunc` 函数的 *what* 形参的值。"
#: ../../c-api/profiling.rst:100
msgid ""
"The value for the *what* parameter to :c:type:`Py_tracefunc` functions when "
"a C function has returned."
msgstr "当一个 C 函数返回时传给 :c:type:`Py_tracefunc` 函数的 *what* 形参的值。"
#: ../../c-api/profiling.rst:106
msgid ""
"The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but "
"not profiling functions) when a new opcode is about to be executed. This "
"event is not emitted by default: it must be explicitly requested by setting "
":attr:`~frame.f_trace_opcodes` to *1* on the frame."
msgstr ""
"当一个新操作码即将被执行时传给 :c:type:`Py_tracefunc` 函数 (但不会传给性能分析函数) 的 *what* 形参的值。 "
"在默认情况下此事件不会被发送:它必须通过在某个帧上将 :attr:`~frame.f_trace_opcodes` 设为 *1* 来显式地请求。"
#: ../../c-api/profiling.rst:114
msgid ""
"Set the profiler function to *func*. The *obj* parameter is passed to the "
"function as its first parameter, and may be any Python object, or ``NULL``."
" If the profile function needs to maintain state, using a different value "
"for *obj* for each thread provides a convenient and thread-safe place to "
"store it. The profile function is called for all monitored events except "
":c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and "
":c:data:`PyTrace_EXCEPTION`."
msgstr ""
"将性能分析器函数设为 *func*。 *obj* 形参将作为第一个形参传给该函数,它可以是任意 Python 对象或为 ``NULL``。 "
"如果性能分析函数需要维护状态,则为每个线程的 *obj* 使用不同的值将提供一个方便而线程安全的存储位置。这个性能分析函数将针对除 "
":c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` 和 "
":c:data:`PyTrace_EXCEPTION` 以外的所有被监控事件进行调用。"
#: ../../c-api/profiling.rst:121
msgid "See also the :func:`sys.setprofile` function."
msgstr "另请参阅 :func:`sys.setprofile` 函数。"
#: ../../c-api/profiling.rst:123 ../../c-api/profiling.rst:131
#: ../../c-api/profiling.rst:150 ../../c-api/profiling.rst:158
msgid "The caller must have an :term:`attached thread state`."
msgstr "调用方必须有已附加的线程状态 :term:`attached thread state`。"
#: ../../c-api/profiling.rst:128
msgid ""
"Like :c:func:`PyEval_SetProfile` but sets the profile function in all "
"running threads belonging to the current interpreter instead of the setting "
"it only on the current thread."
msgstr ""
"类似于 :c:func:`PyEval_SetProfile` 但会在属于当前解释器的所有在运行线程中设置性能分析函数而不是仅在当前线程上设置。"
#: ../../c-api/profiling.rst:133
msgid ""
"As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised "
"while setting the profile functions in all threads."
msgstr "与 :c:func:`PyEval_SetProfile` 一样,该函数会忽略任何被引发的异常同时在所有线程中设置性能分析函数。"
#: ../../c-api/profiling.rst:141
msgid ""
"Set the tracing function to *func*. This is similar to "
":c:func:`PyEval_SetProfile`, except the tracing function does receive line-"
"number events and per-opcode events, but does not receive any event related "
"to C function objects being called. Any trace function registered using "
":c:func:`PyEval_SetTrace` will not receive :c:data:`PyTrace_C_CALL`, "
":c:data:`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for "
"the *what* parameter."
msgstr ""
"将跟踪函数设为 *func*。这类似于 "
":c:func:`PyEval_SetProfile`,区别在于跟踪函数会接收行编号事件和操作码级事件,但不会接收与被调用的 C "
"函数对象相关的任何事件。使用 :c:func:`PyEval_SetTrace` 注册的任何跟踪函数将不会接收 "
":c:data:`PyTrace_C_CALL`、:c:data:`PyTrace_C_EXCEPTION` 或 "
":c:data:`PyTrace_C_RETURN` 作为 *what* 形参的值。"
#: ../../c-api/profiling.rst:148
msgid "See also the :func:`sys.settrace` function."
msgstr "另请参阅 :func:`sys.settrace` 函数。"
#: ../../c-api/profiling.rst:155
msgid ""
"Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running "
"threads belonging to the current interpreter instead of the setting it only "
"on the current thread."
msgstr "类似于 :c:func:`PyEval_SetTrace` 但会在属于当前解释器的所有在运行线程中设置跟踪函数而不是仅在当前线程上设置。"
#: ../../c-api/profiling.rst:160
msgid ""
"As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised "
"while setting the trace functions in all threads."
msgstr "与 :c:func:`PyEval_SetTrace` 一样,该函数会忽略任何被引发的异常同时在所有线程中设置跟踪函数。"
#: ../../c-api/profiling.rst:167
msgid "Reference tracing"
msgstr "引用追踪"
#: ../../c-api/profiling.rst:174
msgid ""
"The type of the trace function registered using "
":c:func:`PyRefTracer_SetTracer`. The first parameter is a Python object that"
" has been just created (when **event** is set to "
":c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is "
"set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque "
"pointer that was provided when :c:func:`PyRefTracer_SetTracer` was called."
msgstr ""
"使用 :c:func:`PyRefTracer_SetTracer` 注册的追踪函数的类型。第一个形参是刚创建(当 **event** 被设为 "
":c:data:`PyRefTracer_CREATE` 时)或将销毁(当 **event** 被设为 "
":c:data:`PyRefTracer_DESTROY` 时)的 Python 对象。 **data** 参数是当 "
":c:func:`PyRefTracer_SetTracer` 被调用时所提供的不透明指针。"
#: ../../c-api/profiling.rst:180
msgid ""
"If a new tracing function is registered replacing the current one, a call to"
" the trace function will be made with the object set to **NULL** and "
"**event** set to :c:data:`PyRefTracer_TRACKER_REMOVED`. This will happen "
"just before the new function is registered."
msgstr ""
#: ../../c-api/profiling.rst:190
msgid ""
"The value for the *event* parameter to :c:type:`PyRefTracer` functions when "
"a Python object has been created."
msgstr "当一个 Python 对象被创建时传给 :c:type:`PyRefTracer` 函数的 *event* 形参。"
#: ../../c-api/profiling.rst:196
msgid ""
"The value for the *event* parameter to :c:type:`PyRefTracer` functions when "
"a Python object has been destroyed."
msgstr "当一个 Python 对象被销毁时传给 :c:type:`PyRefTracer` 函数的 *event* 形参。"
#: ../../c-api/profiling.rst:202
msgid ""
"The value for the *event* parameter to :c:type:`PyRefTracer` functions when "
"the current tracer is about to be replaced by a new one."
msgstr ""
#: ../../c-api/profiling.rst:210
msgid ""
"Register a reference tracer function. The function will be called when a new"
" Python object has been created or when an object is going to be destroyed. "
"If **data** is provided it must be an opaque pointer that will be provided "
"when the tracer function is called. Return ``0`` on success. Set an "
"exception and return ``-1`` on error."
msgstr ""
#: ../../c-api/profiling.rst:216
msgid ""
"Note that tracer functions **must not** create Python objects inside or "
"otherwise the call will be re-entrant. The tracer also **must not** clear "
"any existing exception or set an exception. A :term:`thread state` will be "
"active every time the tracer function is called."
msgstr ""
#: ../../c-api/profiling.rst:221 ../../c-api/profiling.rst:237
msgid ""
"There must be an :term:`attached thread state` when calling this function."
msgstr "当调用此函数时必须有一个 :term:`attached thread state`。"
#: ../../c-api/profiling.rst:223
msgid ""
"If another tracer function was already registered, the old function will be "
"called with **event** set to :c:data:`PyRefTracer_TRACKER_REMOVED` just "
"before the new function is registered."
msgstr ""
#: ../../c-api/profiling.rst:232
msgid ""
"Get the registered reference tracer function and the value of the opaque "
"data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was "
"called. If no tracer was registered this function will return NULL and will "
"set the **data** pointer to NULL."
msgstr ""
"获取已注册的引用追踪函数以及当 :c:func:`PyRefTracer_SetTracer` 被调用时所注册的不透明数据指针的值。 "
"如果未注册任何追踪器则此函数将返回 NULL 并将 **data** 指针设为 NULL。"