X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=draft%2Fman3%2Fclock.3;h=f626c5a51338ae973d86a81e32004836147d9cd7;hb=40274b7d79d419993de4a745e3ae86ca6d0f417f;hp=2198a42a72f5419ddddb52105cca5b2b86dbd990;hpb=633a2252e0be3c867dce264a180a89ce8181d36f;p=linuxjm%2FLDP_man-pages.git diff --git a/draft/man3/clock.3 b/draft/man3/clock.3 index 2198a42a..f626c5a5 100644 --- a/draft/man3/clock.3 +++ b/draft/man3/clock.3 @@ -1,5 +1,6 @@ .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" +.\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. @@ -19,125 +20,59 @@ .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. -.\" License. +.\" %%%LICENSE_END +.\" .\" Modified Sat Jul 24 21:27:01 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified 14 Jun 2002, Michael Kerrisk -.\" Added notes on differences from other Unix systems with respect to +.\" Added notes on differences from other UNIX systems with respect to .\" waited-for children. +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1996 Hiroaki Nagoya .\" all rights reserved. -.\" Tranlated Mon Feb 3 15:35:19 JST 1997 +.\" Translated Mon Feb 3 15:35:19 JST 1997 .\" by Hiroaki Nagoya .\" Updated Fri Sep 27 JST 2002 by Kentaro Shirakata .\" Updated 2007-05-28, Akihiro MOTOKI , LDP v2.48 .\" -.\"WORD: processor time ¥×¥í¥»¥Ã¥µ»þ´Ö -.\"WORD: CPU time CPU»þ´Ö -.\" -.TH CLOCK 3 2008-08-28 "GNU" "Linux Programmer's Manual" -.\"O .SH NAME -.SH ̾Á° -.\"O clock \- Determine processor time -clock \- ¥×¥í¥»¥Ã¥µ»þ´Ö¤Î¼èÆÀ -.\"O .SH SYNOPSIS -.SH ½ñ¼° +.TH CLOCK 3 2008\-08\-28 GNU "Linux Programmer's Manual" +.SH 名前 +clock \- プロセッサ時間の取得 +.SH 書式 .nf -.B #include +\fB#include \fP .sp -.B clock_t clock(void); +\fBclock_t clock(void);\fP .fi -.\"O .SH DESCRIPTION -.SH ÀâÌÀ -.\"O The -.\"O .BR clock () -.\"O function returns an approximation of processor time used by the program. -.BR clock () -¤Ï¥×¥í¥°¥é¥à¤Î»ÈÍѤ·¤¿¥×¥í¥»¥Ã¥µ»þ´Ö¤Î¶á»÷ÃͤòÊÖ¤¹¡£ -.\"O .SH "RETURN VALUE" -.SH ÊÖ¤êÃÍ -.\"O The value returned is the CPU time used so far as a -.\"O .IR clock_t ; -.\"O to get the number of seconds used, divide by -.\"O .BR CLOCKS_PER_SEC . -.\"O If the processor time used is not available or its value cannot -.\"O be represented, the function returns the value -.\"O .IR (clock_t)\ \-1 . -ÊÖ¤êÃÍ¤Ï -.I clock_t -ñ°Ì¤Ç¤Î CPU »þ´Ö¤Ç¤¢¤ë¡£ -ÉÃñ°Ì¤Ç¤ÎÃͤòÆÀ¤ë¤¿¤á¤Ë¤Ï -.B CLOCKS_PER_SEC -¤Ç³ä¤ì¤Ð¤è¤¤¡£ -»ÈÍѤ·¤¿¥×¥í¥»¥Ã¥µ»þ´Ö¤¬ÆÀ¤é¤ì¤Ê¤¤¾ì¹ç¤ä¡¢¤½¤ÎÃͤòɽ¸½¤Ç¤­¤Ê¤¤¾ì¹ç¡¢ -¤³¤Î´Ø¿ô¤Ï -.I (clock_t)\ \-1 -¤òÊÖ¤¹¡£ -.\"O .SH "CONFORMING TO" -.SH ½àµò -.\"O C89, C99, POSIX.1-2001. -.\"O POSIX requires that -.\"O .B CLOCKS_PER_SEC -.\"O equals 1000000 independent -.\"O of the actual resolution. -C89, C99, POSIX.1-2001. -POSIX ¤Ï¼ÂºÝ¤ÎÀºÅ٤ˤϤè¤é¤º -.B CLOCKS_PER_SEC -¤¬ 1000000 ¤Ç¤¢¤ë¤³¤È¤òÍ׵ᤷ¤Æ¤¤¤ë¡£ -.\"O .SH NOTES -.SH Ãí°Õ -.\"O The C standard allows for arbitrary values at the start of the program; -.\"O subtract the value returned from a call to -.\"O .BR clock () -.\"O at the start of the program to get maximum portability. -C ¤Îɸ½àµ¬³Ê¤Ç¤Ï¥×¥í¥°¥é¥à¤Î³«»Ï¤Î»þÅÀ¤Ç¤Ï¤É¤ó¤ÊÃͤ¬Ê֤äƤ­¤Æ¤â -¤«¤Þ¤ï¤Ê¤¤¡£ -°Ü¿¢À­¤òºÇÂç¸Â³ÎÊݤ¹¤ë¤¿¤á¤Ë¤Ï¡¢¥×¥í¥°¥é¥à¤Î³«»Ï»þ¤Ë -.BR clock () -¤ò¸Æ¤Ó½Ð¤·¤Æ¤½¤ÎÃͤòº¹¤·°ú¤¯¤³¤È¡£ +.SH 説明 +\fBclock\fP() はプログラムの使用したプロセッサ時間の近似値を返す。 +.SH 返り値 +返り値は \fIclock_t\fP 単位での CPU 時間である。 秒単位での値を得るためには \fBCLOCKS_PER_SEC\fP で割ればよい。 +使用したプロセッサ時間が得られない場合や、その値を表現できない場合、 この関数は \fI(clock_t)\ \-1\fP を返す。 +.SH 準拠 +C89, C99, POSIX.1\-2001. POSIX は実際の精度にはよらず \fBCLOCKS_PER_SEC\fP が 1000000 +であることを要求している。 +.SH 注意 +C の標準規格ではプログラムの開始の時点ではどんな値が返ってきても かまわない。 移植性を最大限確保するためには、プログラムの開始時に +\fBclock\fP() を呼び出してその値を差し引くこと。 .PP -.\"O Note that the time can wrap around. -.\"O On a 32-bit system where -.\"O .B CLOCKS_PER_SEC -.\"O equals 1000000 this function will return the same -.\"O value approximately every 72 minutes. -»þ¹ï¤Ï·å¤¢¤Õ¤ì¤¹¤ë²ÄǽÀ­¤¬¤¢¤ëÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£ -.B CLOCKS_PER_SEC -¤¬ 1000000 ¤Ç¤¢¤ë 32 ¥Ó¥Ã¥È¥·¥¹¥Æ¥à¤Ç¤Ï¡¢ -¤³¤Î´Ø¿ô¤ÏÌó 72 ʬËè¤ËƱ¤¸ÃͤòÊÖ¤¹¤³¤È¤Ë¤Ê¤ë¡£ +時刻は桁あふれする可能性がある点に注意すること。 \fBCLOCKS_PER_SEC\fP が 1000000 である 32 ビットシステムでは、 +この関数は約 72 分毎に同じ値を返すことになる。 .PP -.\"O On several other implementations, -.\"O the value returned by -.\"O .BR clock () -.\"O also includes the times of any children whose status has been -.\"O collected via -.\"O .BR wait (2) -.\"O (or another wait-type call). -¼ÂÁõ¤Ë¤è¤Ã¤Æ¤Ï¡¢ -.BR clock () -¤ÇÊÖ¤µ¤ì¤ëÃÍ¤Ë -.BR wait (2) -(¤¢¤ë¤¤¤Ï¤½¤Î¾¤Î wait ¤Î¤è¤¦¤Ê´Ø¿ô) ¤Ç¼ý½¸¤µ¤ì¤¿ -»Ò¥×¥í¥»¥¹¤Î»þ´Ö¤¬´Þ¤Þ¤ì¤ë¾ì¹ç¤â¤¢¤ë¡£ -.\"O Linux does not include the times of waited-for children in the -.\"O value returned by -.\"O .BR clock (). -Linux ¤Ç¤Ï¡¢ -.BR clock () -¤¬ÊÖ¤¹ÃÍ¤Ë¤Ï wait ¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Î»þ´Ö¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£ .\" I have seen this behavior on Irix 6.3, and the OSF/1, HP/UX, and .\" Solaris manual pages say that clock() also does this on those systems. .\" POSIX.1-2001 doesn't explicitly allow this, nor is there an .\" explicit prohibition. -- MTK -.\"O The -.\"O .BR times (2) -.\"O function, which explicitly returns (separate) information about the -.\"O caller and its children, may be preferable. -.BR times (2) -´Ø¿ô¤Ï¸Æ¤Ó½Ð¤·¸µ¤È¤½¤Î»Ò¥×¥í¥»¥¹¤Ë´Ø¤¹¤ë¾ðÊó¤ò -(ÊÌ¡¹¤Ë) ÌÀ¼¨Åª¤ËÊÖ¤¹¤Î¤Ç¡¢¤è¤ê¹¥¤Þ¤·¤¤¤À¤í¤¦¡£ -.\"O .SH "SEE ALSO" -.SH ´ØÏ¢¹àÌÜ -.BR clock_gettime (2), -.BR getrusage (2), -.BR times (2) +実装によっては、 \fBclock\fP() で返される値に \fBwait\fP(2) (あるいはその他の wait のような関数) で収集された +子プロセスの時間が含まれる場合もある。 Linux では、 \fBclock\fP() が返す値には wait された子プロセスの時間は含まれない。 +\fBtimes\fP(2) 関数は呼び出し元とその子プロセスに関する情報を (別々に) 明示的に返すので、より好ましいだろう。 +.SH 関連項目 +\fBclock_gettime\fP(2), \fBgetrusage\fP(2), \fBtimes\fP(2) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。