Debian Codegraph @

po/ru/man3/pthread_getcpuclockid.3.po

raw
1 # Russian translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Alexey, 2016.
5 # Azamat Hackimov <[email protected]>, 2014-2017.
6 # kogamatranslator49 <[email protected]>, 2015.
7 # Darima Kogan <[email protected]>, 2014.
8 # Max Is <[email protected]>, 2016.
9 # Yuri Kozlov <[email protected]>, 2011-2019.
10 # Иван Павлов <[email protected]>, 2017.
11 msgid ""
12 msgstr ""
13 "Project-Id-Version: manpages-l10n\n"
14 "POT-Creation-Date: 2026-06-05 06:38+0200\n"
15 "PO-Revision-Date: 2024-12-21 19:50+0300\n"
16 "Last-Translator: Yuri Kozlov <[email protected]>\n"
17 "Language-Team: Russian <[email protected]>\n"
18 "Language: ru\n"
19 "MIME-Version: 1.0\n"
20 "Content-Type: text/plain; charset=UTF-8\n"
21 "Content-Transfer-Encoding: 8bit\n"
22 "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
23 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
24 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
25 "X-Generator: Lokalize 2.0\n"
26
27 #. type: TH
28 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
29 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
30 #, fuzzy, no-wrap
31 #| msgid "B<pthread_getcpuclockid>()"
32 msgid "pthread_getcpuclockid"
33 msgstr "B<pthread_getcpuclockid>()"
34
35 #. type: TH
36 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
37 #: opensuse-tumbleweed
38 #, no-wrap
39 msgid "2025-08-20"
40 msgstr "20 августа 2025 г."
41
42 #. type: TH
43 #: archlinux debian-unstable
44 #, fuzzy, no-wrap
45 #| msgid "Linux man-pages 6.17"
46 msgid "Linux man-pages 6.18"
47 msgstr "Справочные страницы Linux 6.17"
48
49 #. type: SH
50 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
51 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
52 #, no-wrap
53 msgid "NAME"
54 msgstr "НАИМЕНОВАНИЕ"
55
56 #. type: Plain text
57 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
58 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
59 msgid "pthread_getcpuclockid - retrieve ID of a thread's CPU time clock"
60 msgstr "pthread_getcpuclockid - возвращает ID таймера времени ЦП у нити"
61
62 #. type: SH
63 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
64 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
65 #, no-wrap
66 msgid "LIBRARY"
67 msgstr "БИБЛИОТЕКА"
68
69 #. type: Plain text
70 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
71 #: opensuse-leap-16-1 opensuse-tumbleweed
72 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
73 msgstr "Библиотека потоков POSIX (I<libpthread>,\\ I<-lpthread>)"
74
75 #. type: SH
76 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
77 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
78 #, no-wrap
79 msgid "SYNOPSIS"
80 msgstr "СИНТАКСИС"
81
82 #. type: Plain text
83 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
84 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
85 #, no-wrap
86 msgid ""
87 "B<#include E<lt>pthread.hE<gt>>\n"
88 "B<#include E<lt>time.hE<gt>>\n"
89 msgstr ""
90 "B<#include E<lt>pthread.hE<gt>>\n"
91 "B<#include E<lt>time.hE<gt>>\n"
92
93 #. type: Plain text
94 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
95 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
96 #, fuzzy, no-wrap
97 #| msgid "B<int pthread_getcpuclockid(pthread_t >I<thread>B<, clockid_t *>I<clock_id>B<);>\n"
98 msgid "B<int pthread_getcpuclockid(pthread_t >I<thread>B<, clockid_t *>I<clockid>B<);>\n"
99 msgstr "B<int pthread_getcpuclockid(pthread_t >I<thread>B<, clockid_t *>I<clock_id>B<);>\n"
100
101 #. type: SH
102 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
103 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
104 #, no-wrap
105 msgid "DESCRIPTION"
106 msgstr "ОПИСАНИЕ"
107
108 #. The clockid is constructed as follows:
109 #. *clockid = CLOCK_THREAD_CPUTIME_ID | (pd->tid << CLOCK_IDFIELD_SIZE)
110 #. where CLOCK_IDFIELD_SIZE is 3.
111 #. type: Plain text
112 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
113 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
114 #, fuzzy
115 #| msgid ""
116 #| "The B<pthread_getcpuclockid>() function returns the clock ID for the CPU "
117 #| "time clock of the thread I<thread>."
118 msgid ""
119 "The B<pthread_getcpuclockid>() function obtains the ID of the CPU-time "
120 "clock of the thread whose ID is given in I<thread>, and returns it in the "
121 "location pointed to by I<clockid>."
122 msgstr ""
123 "Функция B<pthread_getcpuclockid>() возвращает ID таймера времени ЦП у нити "
124 "I<thread>."
125
126 #. type: SH
127 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
128 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
129 #, no-wrap
130 msgid "RETURN VALUE"
131 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
132
133 #. type: Plain text
134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
136 msgid ""
137 "On success, this function returns 0; on error, it returns a nonzero error "
138 "number."
139 msgstr ""
140 "При успешном выполнении функция возвращает 0; при ошибке возвращается "
141 "ненулевой номер ошибки."
142
143 #. type: SH
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 #, no-wrap
147 msgid "ERRORS"
148 msgstr "ОШИБКИ"
149
150 #. type: TP
151 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
152 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
153 #, no-wrap
154 msgid "B<ENOENT>"
155 msgstr "B<ENOENT>"
156
157 #. CLOCK_THREAD_CPUTIME_ID not defined
158 #. Looking at nptl/pthread_getcpuclockid.c an ERANGE error would
159 #. be possible if kernel thread IDs took more than 29 bits (which
160 #. they currently cannot).
161 #. type: Plain text
162 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
163 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
164 msgid "Per-thread CPU time clocks are not supported by the system."
165 msgstr ""
166 "В системе не поддерживаются выделенные таймеры времени ЦП для каждой нити."
167
168 #. type: TP
169 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
170 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
171 #, no-wrap
172 msgid "B<ESRCH>"
173 msgstr "B<ESRCH>"
174
175 #. type: Plain text
176 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
177 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
178 msgid "No thread with the ID I<thread> could be found."
179 msgstr "Нить с идентификатором I<thread> не найдена."
180
181 #. type: SH
182 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
183 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
184 #, no-wrap
185 msgid "ATTRIBUTES"
186 msgstr "АТРИБУТЫ"
187
188 #. type: Plain text
189 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
190 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
191 msgid ""
192 "For an explanation of the terms used in this section, see B<attributes>(7)."
193 msgstr "Описание терминов данного раздела смотрите в B<attributes>(7)."
194
195 #. type: tbl table
196 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
197 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
198 #, no-wrap
199 msgid "Interface"
200 msgstr "Интерфейс"
201
202 #. type: tbl table
203 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
204 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
205 #, no-wrap
206 msgid "Attribute"
207 msgstr "Атрибут"
208
209 #. type: tbl table
210 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
211 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
212 #, no-wrap
213 msgid "Value"
214 msgstr "Значение"
215
216 #. type: tbl table
217 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
218 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
219 #, no-wrap
220 msgid ".na\n"
221 msgstr ".na\n"
222
223 #. type: tbl table
224 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
225 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
226 #, no-wrap
227 msgid ".nh\n"
228 msgstr ".nh\n"
229
230 #. type: tbl table
231 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
232 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
233 #, no-wrap
234 msgid "B<pthread_getcpuclockid>()"
235 msgstr "B<pthread_getcpuclockid>()"
236
237 #. type: tbl table
238 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
239 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
240 #, no-wrap
241 msgid "Thread safety"
242 msgstr "Безвредность в нитях"
243
244 #. type: tbl table
245 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
246 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
247 #, no-wrap
248 msgid "MT-Safe"
249 msgstr "MT-Safe"
250
251 #. type: SH
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 #, no-wrap
255 msgid "STANDARDS"
256 msgstr "СТАНДАРТЫ"
257
258 #. type: Plain text
259 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
260 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
261 msgid "POSIX.1-2008."
262 msgstr "POSIX.1-2008."
263
264 #. type: SH
265 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
266 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
267 #, no-wrap
268 msgid "HISTORY"
269 msgstr "ИСТОРИЯ"
270
271 #. type: Plain text
272 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
273 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
274 msgid "glibc 2.2. POSIX.1-2001."
275 msgstr "glibc 2.2. POSIX.1-2001."
276
277 #. type: SH
278 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
279 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
280 #, no-wrap
281 msgid "NOTES"
282 msgstr "ПРИМЕЧАНИЯ"
283
284 #. type: Plain text
285 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
286 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
287 msgid ""
288 "When I<thread> refers to the calling thread, this function returns an "
289 "identifier that refers to the same clock manipulated by B<clock_gettime>(2) "
290 "and B<clock_settime>(2) when given the clock ID B<CLOCK_THREAD_CPUTIME_ID>."
291 msgstr ""
292 "Если I<thread> указывает на вызвавшую нить, то функция возвращает "
293 "идентификатор, указывающий на таймер, управляемый B<clock_gettime>(2) и "
294 "B<clock_settime>(2), если ID таймера равно B<CLOCK_THREAD_CPUTIME_ID>."
295
296 #. type: SH
297 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
298 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
299 #, no-wrap
300 msgid "EXAMPLES"
301 msgstr "ПРИМЕРЫ"
302
303 #. type: Plain text
304 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
305 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
306 msgid ""
307 "The program below creates a thread and then uses B<clock_gettime>(2) to "
308 "retrieve the total process CPU time, and the per-thread CPU time consumed by "
309 "the two threads. The following shell session shows an example run:"
310 msgstr ""
311 "Программа, показанная далее, создаёт нить и используя B<clock_gettime>(2) "
312 "показывает общее время ЦП и время ЦП, затраченное на работу нитей по "
313 "отдельности. Пример сеанса работы:"
314
315 #. type: Plain text
316 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
317 #: opensuse-tumbleweed
318 #, fuzzy, no-wrap
319 #| msgid ""
320 #| "$ B<./a.out>\n"
321 #| "Main thread sleeping\n"
322 #| "Subthread starting infinite loop\n"
323 #| "Main thread consuming some CPU time...\n"
324 #| "Process total CPU time: 1.368\n"
325 #| "Main thread CPU time: 0.376\n"
326 #| "Subthread CPU time: 0.992\n"
327 msgid ""
328 "$B< ./a.out>;\n"
329 "Main thread sleeping\n"
330 "Subthread starting infinite loop\n"
331 "Main thread consuming some CPU time...\n"
332 "Process total CPU time: 1.368\n"
333 "Main thread CPU time: 0.376\n"
334 "Subthread CPU time: 0.992\n"
335 msgstr ""
336 "$ B<./a.out>\n"
337 "Главная нить спит\n"
338 "Вторая нить входит в бесконечный цикл\n"
339 "Главная нить использует немного времени ЦП…\n"
340 "Общее время ЦП для процесса: 1.368\n"
341 "Время ЦП для главной нити: 0.376\n"
342 "Время ЦП для второй нити: 0.992\n"
343
344 #. type: SS
345 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
346 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
347 #, no-wrap
348 msgid "Program source"
349 msgstr "Исходный код программы"
350
351 #. type: Plain text
352 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
353 #: opensuse-tumbleweed
354 #, no-wrap
355 msgid ""
356 "/* Link with \"-lrt\" */\n"
357 "\\&\n"
358 "#include E<lt>err.hE<gt>\n"
359 "#include E<lt>errno.hE<gt>\n"
360 "#include E<lt>pthread.hE<gt>\n"
361 "#include E<lt>stdint.hE<gt>\n"
362 "#include E<lt>stdio.hE<gt>\n"
363 "#include E<lt>stdlib.hE<gt>\n"
364 "#include E<lt>string.hE<gt>\n"
365 "#include E<lt>sys/time.hE<gt>\n"
366 "#include E<lt>time.hE<gt>\n"
367 "#include E<lt>unistd.hE<gt>\n"
368 "\\&\n"
369 "static void *\n"
370 "thread_start(void *arg)\n"
371 "{\n"
372 " printf(\"Subthread starting infinite loop\\[rs]n\");\n"
373 " for (;;)\n"
374 " continue;\n"
375 "}\n"
376 "\\&\n"
377 "static void\n"
378 "pclock(char *msg, clockid_t cid)\n"
379 "{\n"
380 " struct timespec ts;\n"
381 "\\&\n"
382 " printf(\"%s\", msg);\n"
383 " if (clock_gettime(cid, &ts) == -1)\n"
384 " err(EXIT_FAILURE, \"clock_gettime\");\n"
385 " printf(\"%4jd.%03ld\\[rs]n\", (intmax_t) ts.tv_sec, ts.tv_nsec / 1000000);\n"
386 "}\n"
387 "\\&\n"
388 "int\n"
389 "main(void)\n"
390 "{\n"
391 " pthread_t thread;\n"
392 " clockid_t cid;\n"
393 " int s;\n"
394 "\\&\n"
395 " s = pthread_create(&thread, NULL, thread_start, NULL);\n"
396 " if (s != 0)\n"
397 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
398 "\\&\n"
399 " printf(\"Main thread sleeping\\[rs]n\");\n"
400 " sleep(1);\n"
401 "\\&\n"
402 " printf(\"Main thread consuming some CPU time...\\[rs]n\");\n"
403 " for (unsigned int j = 0; j E<lt> 2000000; j++)\n"
404 " getppid();\n"
405 "\\&\n"
406 " pclock(\"Process total CPU time: \", CLOCK_PROCESS_CPUTIME_ID);\n"
407 "\\&\n"
408 " s = pthread_getcpuclockid(pthread_self(), &cid);\n"
409 " if (s != 0)\n"
410 " errc(EXIT_FAILURE, s, \"pthread_getcpuclockid\");\n"
411 " pclock(\"Main thread CPU time: \", cid);\n"
412 "\\&\n"
413 " /* The preceding 4 lines of code could have been replaced by:\n"
414 " pclock(\"Main thread CPU time: \", CLOCK_THREAD_CPUTIME_ID); */\n"
415 "\\&\n"
416 " s = pthread_getcpuclockid(thread, &cid);\n"
417 " if (s != 0)\n"
418 " errc(EXIT_FAILURE, s, \"pthread_getcpuclockid\");\n"
419 " pclock(\"Subthread CPU time: 1 \", cid);\n"
420 "\\&\n"
421 " exit(EXIT_SUCCESS); /* Terminates both threads */\n"
422 "}\n"
423 msgstr ""
424
425 #. SRC END
426 #. type: SH
427 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
428 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
429 #, no-wrap
430 msgid "SEE ALSO"
431 msgstr "СМОТРИТЕ ТАКЖЕ"
432
433 #. type: Plain text
434 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
435 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
436 msgid ""
437 "B<clock_gettime>(2), B<clock_settime>(2), B<timer_create>(2), "
438 "B<clock_getcpuclockid>(3), B<pthread_self>(3), B<pthreads>(7), B<time>(7)"
439 msgstr ""
440 "B<clock_gettime>(2), B<clock_settime>(2), B<timer_create>(2), "
441 "B<clock_getcpuclockid>(3), B<pthread_self>(3), B<pthreads>(7), B<time>(7)"
442
443 #. type: TH
444 #: debian-trixie
445 #, no-wrap
446 msgid "2024-06-15"
447 msgstr "15 июня 2024 г."
448
449 #. type: TH
450 #: debian-trixie
451 #, no-wrap
452 msgid "Linux man-pages 6.9.1"
453 msgstr "Страницы руководства Linux 6.9.1"
454
455 #. type: Plain text
456 #: debian-trixie
457 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
458 msgstr "Библиотека потоков POSIX (I<libpthread>, I<-lpthread>)"
459
460 #. type: Plain text
461 #: debian-trixie fedora-44 fedora-rawhide
462 #, no-wrap
463 msgid ""
464 "$ B<./a.out>\n"
465 "Main thread sleeping\n"
466 "Subthread starting infinite loop\n"
467 "Main thread consuming some CPU time...\n"
468 "Process total CPU time: 1.368\n"
469 "Main thread CPU time: 0.376\n"
470 "Subthread CPU time: 0.992\n"
471 msgstr ""
472 "$ B<./a.out>\n"
473 "Главная нить спит\n"
474 "Вторая нить входит в бесконечный цикл\n"
475 "Главная нить использует немного времени ЦП…\n"
476 "Общее время ЦП для процесса: 1.368\n"
477 "Время ЦП для главной нити: 0.376\n"
478 "Время ЦП для второй нити: 0.992\n"
479
480 #. type: Plain text
481 #: debian-trixie
482 #, no-wrap
483 msgid ""
484 "/* Link with \"-lrt\" */\n"
485 "\\&\n"
486 "#include E<lt>errno.hE<gt>\n"
487 "#include E<lt>pthread.hE<gt>\n"
488 "#include E<lt>stdint.hE<gt>\n"
489 "#include E<lt>stdio.hE<gt>\n"
490 "#include E<lt>stdlib.hE<gt>\n"
491 "#include E<lt>string.hE<gt>\n"
492 "#include E<lt>time.hE<gt>\n"
493 "#include E<lt>unistd.hE<gt>\n"
494 "\\&\n"
495 "#define handle_error(msg) \\[rs]\n"
496 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
497 "\\&\n"
498 "#define handle_error_en(en, msg) \\[rs]\n"
499 " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
500 "\\&\n"
501 "static void *\n"
502 "thread_start(void *arg)\n"
503 "{\n"
504 " printf(\"Subthread starting infinite loop\\[rs]n\");\n"
505 " for (;;)\n"
506 " continue;\n"
507 "}\n"
508 "\\&\n"
509 "static void\n"
510 "pclock(char *msg, clockid_t cid)\n"
511 "{\n"
512 " struct timespec ts;\n"
513 "\\&\n"
514 " printf(\"%s\", msg);\n"
515 " if (clock_gettime(cid, &ts) == -1)\n"
516 " handle_error(\"clock_gettime\");\n"
517 " printf(\"%4jd.%03ld\\[rs]n\", (intmax_t) ts.tv_sec, ts.tv_nsec / 1000000);\n"
518 "}\n"
519 "\\&\n"
520 "int\n"
521 "main(void)\n"
522 "{\n"
523 " pthread_t thread;\n"
524 " clockid_t cid;\n"
525 " int s;\n"
526 "\\&\n"
527 " s = pthread_create(&thread, NULL, thread_start, NULL);\n"
528 " if (s != 0)\n"
529 " handle_error_en(s, \"pthread_create\");\n"
530 "\\&\n"
531 " printf(\"Main thread sleeping\\[rs]n\");\n"
532 " sleep(1);\n"
533 "\\&\n"
534 " printf(\"Main thread consuming some CPU time...\\[rs]n\");\n"
535 " for (unsigned int j = 0; j E<lt> 2000000; j++)\n"
536 " getppid();\n"
537 "\\&\n"
538 " pclock(\"Process total CPU time: \", CLOCK_PROCESS_CPUTIME_ID);\n"
539 "\\&\n"
540 " s = pthread_getcpuclockid(pthread_self(), &cid);\n"
541 " if (s != 0)\n"
542 " handle_error_en(s, \"pthread_getcpuclockid\");\n"
543 " pclock(\"Main thread CPU time: \", cid);\n"
544 "\\&\n"
545 " /* The preceding 4 lines of code could have been replaced by:\n"
546 " pclock(\"Main thread CPU time: \", CLOCK_THREAD_CPUTIME_ID); */\n"
547 "\\&\n"
548 " s = pthread_getcpuclockid(thread, &cid);\n"
549 " if (s != 0)\n"
550 " handle_error_en(s, \"pthread_getcpuclockid\");\n"
551 " pclock(\"Subthread CPU time: 1 \", cid);\n"
552 "\\&\n"
553 " exit(EXIT_SUCCESS); /* Terminates both threads */\n"
554 "}\n"
555 msgstr ""
556
557 #. type: TH
558 #: fedora-44 fedora-rawhide
559 #, no-wrap
560 msgid "2024-11-03"
561 msgstr "3 ноября 2024 г."
562
563 #. type: TH
564 #: fedora-44 fedora-rawhide
565 #, no-wrap
566 msgid "Linux man-pages 6.13"
567 msgstr "Страницы руководства Linux 6.13"
568
569 #. type: Plain text
570 #: fedora-44 fedora-rawhide
571 #, no-wrap
572 msgid ""
573 "/* Link with \"-lrt\" */\n"
574 "\\&\n"
575 "#include E<lt>errno.hE<gt>\n"
576 "#include E<lt>pthread.hE<gt>\n"
577 "#include E<lt>stdint.hE<gt>\n"
578 "#include E<lt>stdio.hE<gt>\n"
579 "#include E<lt>stdlib.hE<gt>\n"
580 "#include E<lt>string.hE<gt>\n"
581 "#include E<lt>sys/time.hE<gt>\n"
582 "#include E<lt>time.hE<gt>\n"
583 "#include E<lt>unistd.hE<gt>\n"
584 "\\&\n"
585 "#define handle_error(msg) \\[rs]\n"
586 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
587 "\\&\n"
588 "#define handle_error_en(en, msg) \\[rs]\n"
589 " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
590 "\\&\n"
591 "static void *\n"
592 "thread_start(void *arg)\n"
593 "{\n"
594 " printf(\"Subthread starting infinite loop\\[rs]n\");\n"
595 " for (;;)\n"
596 " continue;\n"
597 "}\n"
598 "\\&\n"
599 "static void\n"
600 "pclock(char *msg, clockid_t cid)\n"
601 "{\n"
602 " struct timespec ts;\n"
603 "\\&\n"
604 " printf(\"%s\", msg);\n"
605 " if (clock_gettime(cid, &ts) == -1)\n"
606 " handle_error(\"clock_gettime\");\n"
607 " printf(\"%4jd.%03ld\\[rs]n\", (intmax_t) ts.tv_sec, ts.tv_nsec / 1000000);\n"
608 "}\n"
609 "\\&\n"
610 "int\n"
611 "main(void)\n"
612 "{\n"
613 " pthread_t thread;\n"
614 " clockid_t cid;\n"
615 " int s;\n"
616 "\\&\n"
617 " s = pthread_create(&thread, NULL, thread_start, NULL);\n"
618 " if (s != 0)\n"
619 " handle_error_en(s, \"pthread_create\");\n"
620 "\\&\n"
621 " printf(\"Main thread sleeping\\[rs]n\");\n"
622 " sleep(1);\n"
623 "\\&\n"
624 " printf(\"Main thread consuming some CPU time...\\[rs]n\");\n"
625 " for (unsigned int j = 0; j E<lt> 2000000; j++)\n"
626 " getppid();\n"
627 "\\&\n"
628 " pclock(\"Process total CPU time: \", CLOCK_PROCESS_CPUTIME_ID);\n"
629 "\\&\n"
630 " s = pthread_getcpuclockid(pthread_self(), &cid);\n"
631 " if (s != 0)\n"
632 " handle_error_en(s, \"pthread_getcpuclockid\");\n"
633 " pclock(\"Main thread CPU time: \", cid);\n"
634 "\\&\n"
635 " /* The preceding 4 lines of code could have been replaced by:\n"
636 " pclock(\"Main thread CPU time: \", CLOCK_THREAD_CPUTIME_ID); */\n"
637 "\\&\n"
638 " s = pthread_getcpuclockid(thread, &cid);\n"
639 " if (s != 0)\n"
640 " handle_error_en(s, \"pthread_getcpuclockid\");\n"
641 " pclock(\"Subthread CPU time: 1 \", cid);\n"
642 "\\&\n"
643 " exit(EXIT_SUCCESS); /* Terminates both threads */\n"
644 "}\n"
645 msgstr ""
646
647 #. type: TH
648 #: mageia-cauldron
649 #, no-wrap
650 msgid "Linux man-pages 6.17"
651 msgstr "Страницы руководства Linux 6.17"
652
653 #. type: TH
654 #: opensuse-leap-16-1 opensuse-tumbleweed
655 #, no-wrap
656 msgid "Linux man-pages (unreleased)"
657 msgstr "Страницы руководства Linux (не выпущены)"