times(2) Linux man page
Name
times - get process times
Synopsis
#include <sys/times.h>
clock_t times(struct tms *buf);
Description
times() stores the current process times in the
struct tms that buf points to. The struct tms is as defined
in <sys/times.h>
:
struct tms {
clock_t tms_utime; /* user time */
clock_t tms_stime; /* system time */
clock_t tms_cutime; /* user time of children */
clock_t tms_cstime; /* system time of children */
};
The tms_utime field contains the CPU time spent executing
instructions of the calling process. The tms_stime field contains the CPU
time spent in the system while executing tasks on behalf of the calling process.
The tms_cutime field contains the sum of the tms_utime and
tms_cutime values for all waited-for terminated children. The
tms_cstime field contains the sum of the tms_stime and
tms_cstime values for all waited-for terminated children.
Times for terminated children (and their descendants) is added in at the
moment wait(2) or waitpid(2) returns their process ID. In particular,
times of grandchildren that the children did not wait for are never seen.
All times reported are in clock ticks.
Return Value
times() returns the number of
clock ticks that have elapsed since an arbitrary point in the past. For Linux
2.4 and earlier this point is the moment the system was booted. Since Linux 2.6,
this point is (2^32/HZ) - 300 (i.e., about 429 million) seconds before
system boot time. The return value may overflow the possible range of type
clock_t. On error, (clock_t) -1 is returned, and errno is
set appropriately.
Notes
The number of clock ticks per second can be obtained using
sysconf(_SC_CLK_TCK);
In POSIX-1996 the symbol CLK_TCK
(defined in <time.h>) is
mentioned as obsolescent. It is obsolete now.
In Linux kernel versions before 2.6.9, if the disposition of SIGCHLD
is set to SIG_IGN then the times of terminated children are automatically
included in the tms_cstime
Ïà¹ØÎĵµ£º
ѧ¶«Î÷£¬ÍùÍùʵÀý²ÅÊÇ×îÈÃÈ˸ÐÐËȤµÄ£¬ÀÏÊÇѧ»ù´¡ÀíÂÛ£¬²»¶¯ÊÖ£¬¸Ð¾õûÓгɾ͸У¬ºÇºÇ¡£
ÏÂÃæÏÈÀ´Ò»¸öʵÀý¡£ÎÒÃÇͨ¹ý´´½¨Á½¸öÏß³ÌÀ´ÊµÏÖ¶ÔÒ»¸öÊýµÄµÝ¼Ó¡£
»òÐíÕâ¸öʵÀýûÓÐʵ¼ÊÔËÓõļÛÖµ£¬µ«ÊÇÉÔ΢¸Ä¶¯Ò»Ï£¬ÎÒÃǾͿÉÒÔÓõ½ÆäËûµØ·½È¥À¡£
ÏÂÃæÊÇÎÒÃǵĴúÂ룺
/*thread_example.c : c multiple thread p ......
ϵͳÖеĽ©Ê¬½ø³Ì¶¼ÒªÓÉwaitϵͳµ÷ÓÃÀ´»ØÊÕ£¬ÏÂÃæ¾Íͨ¹ýʵս¿´Ò»¿´waitµÄ¾ßÌåÓ÷¨£º
waitµÄº¯ÊýÔÐÍÊÇ£º
#include <sys/types.h> /* ÌṩÀàÐÍpid_tµÄ¶¨Òå */
#include <sys/wait.h>
pid_t wait(int *status);
½ø³ÌÒ»µ©µ÷ÓÃÁËwait£¬¾ÍÁ¢¼´×èÈû×Ô¼º£¬ÓÉwait×Ô¶¯·ÖÎöÊÇ·ñµ±Ç°½ø³ÌµÄij¸ö×Ó½ø³ÌÒѾÍ˳ö£¬Èç¹ûÈ ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
A:link { so-language: zxx }
-->
´ó¼ÒÖªµÀ£¬
MeeGo
×ÀÃæµÄ×î´óÌØµãÊÇʹÓÃ×ÔÓÉ£¨
free
use
£©£¬²»ÂÛÄãÔÚʲôµØ·½£¨Ê²Ã´¹ú¼Ò£©£¬Ò²²»ÂÛÄãÏëÓÃËü¸ÉʲôÊÂÇé¡£ÄÇô£¬
MeeGo
ÊDz»ÊÇÀ¬»ø´úÂëÄØ£¿µ±È»²»ÊÇ¡£ ......
·ÖÏíÒ»ÏÂÎÒÔÚÍøÉÏ¿´µ½µÄÓ²Å̰²×°Linux 9.0µÄÏà¹Ø²Ù×÷£º
ÏÂÃæÓÐÁ½ÖÖ°²×°·½·¨.
<A>´Ódos°²×°.Õâ·½·¨¿ÉÒÔ²»ÓÃÈíÅÌ,±È½Ï·½±ã.
<A.1> µÃµ½dosutilsĿ¼
Õâ¸öĿ¼ÀïÓдÓdos°²×°ºÍÈíÅ̰²×°µÄ¹¤¾ß.Ò»°ã¶¼ÔÚµÚÒ»¸öisoÎļþÀï.
ÔÚlinuxÏ¿ÉÒÔÕâÑù×°ÔØisoÎļþ.
mount -o loop valhalla-i386-disc1.iso /mnt/cdro ......
¹ØÓÚlinuxÄÚºËÖеÄ"__attribute__ ((packed))"
À´Ô´£º
http://jimmy-lee.blog.hexun.com/8001013_d.html
__attrubte__ ((packed)) µÄ×÷ÓþÍÊǸæËß±àÒëÆ÷È¡Ïû½á¹¹ÔÚ±àÒë¹ý³ÌÖеÄÓÅ»¯¶ÔÆë,°´ÕÕʵ¼ÊÕ¼ÓÃ×Ö½ÚÊý½øÐÐ¶ÔÆë¡£
#define __u8 unsigned char
#define __u16 unsigned short
......