LINUX C ʱ¼ä²Ù×÷
1.ʱ¼ä±íʾ
ÔÚ³ÌÐòµ±ÖÐ,ÎÒÃǾ³£ÒªÊä³öϵͳµ±Ç°µÄʱ¼ä,±ÈÈçÎÒÃÇʹÓÃdateÃüÁîµÄÊä³ö½á¹û.Õâ¸öʱºòÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæÁ½¸öº¯Êý:
#include <sys/time.h>
time_t time(time_t *tloc);
char *ctime(const time_t *clock);
timeº¯Êý·µ»Ø´Ó1970Äê1ÔÂ1ÈÕ0µãÒÔÀ´µÄÃëÊý.´æ´¢ÔÚtime_t½á¹¹Ö®ÖÐ.²»¹ýÕâ¸öº¯ÊýµÄ·µ»ØÖµ¶ÔÓÚÎÒÃÇÀ´ËµÃ»ÓÐʲôʵ¼ÊÒâÒå.Õâ¸öʱºòÎÒÃÇʹÓõڶþ¸öº¯Êý½«ÃëÊýת»¯Îª×Ö·û´®. Õâ¸öº¯ÊýµÄ·µ»ØÀàÐÍÊǹ̶¨µÄ:Ò»¸ö¿ÉÄÜֵΪ.Thu Dec7 14:58:59 2000 Õâ¸ö×Ö·û´®µÄ³¤¶ÈÊǹ̶¨µÄΪ26.
2.ʱ¼äµÄ²âÁ¿
ÓÐʱºòÎÒÃÇÒª¼ÆËã³ÌÐòÖ´ÐеÄʱ¼ä.±ÈÈçÎÒÃÇÒª¶ÔËã·¨½øÐÐʱ¼ä·ÖÎö.Õâ¸öʱºò¿ÉÒÔʹÓÃÏÂÃæÕâ¸öº¯Êý.
#include <sys/time.h>
int gettimeofday(struct timeval *tv,struct timezone *tz);
strut timeval {
long tv_sec; /* ÃëÊý */
long tv_usec; /* ΢ÃëÊý */
};
gettimeofday½«Ê±¼ä±£´æÔڽṹtvÖ®ÖÐ.tzÒ»°ãÎÒÃÇʹÓÃNULLÀ´´úÌæ.
#include #include #include
void function()
{
unsigned int i,j;
double y;
for(i=0;i<1000;i++)
for(j=0;j<1000;j++)
y=sin((double)i);
}
main()
{
struct timeval tpstart,tpend;
float timeuse;
gettimeofday(&tpstart,NULL);
function();
gettimeofday(&tpend,NULL);
timeuse=1000000*(tpend.tv_sec-tpstart.tv_sec)+
tpend.tv_usec-tpstart.tv_usec;
timeuse/=1000000;
printf("Used Time:%f\n",timeuse);
exit(0);
}
Õâ¸ö³ÌÐòÊä³öº¯ÊýµÄÖ´ÐÐʱ¼ä,ÎÒÃÇ¿ÉÒÔʹÓÃÕâ¸öÀ´½øÐÐϵͳÐÔÄܵIJâÊÔ,»òÕßÊǺ¯ÊýËã·¨µÄЧÂÊ·ÖÎö.ÔÚÎÒ»úÆ÷ÉϵÄÒ»¸öÊä³ö½á¹ûÊÇ: Used Time:0.556070
3.¼ÆʱÆ÷µÄʹÓÃ
Linux²Ù×÷ϵͳΪÿһ¸ö½ø³ÌÌṩÁË3¸öÄÚ²¿¼ä¸ô¼ÆʱÆ÷.
ITIMER_REAL:¼õÉÙʵ¼Êʱ¼ä.µ½Ê±µÄʱºò·¢³öSIGALRMÐźÅ.
ITIMER_VIRTUAL:¼õÉÙÓÐЧʱ¼ä(½ø³ÌÖ´ÐеÄʱ¼ä).²úÉúSIGVTALRMÐźÅ.
ITIMER_PROF:¼õÉÙ½ø³ÌµÄÓÐЧʱ¼äºÍϵͳʱ¼ä(Ϊ½ø³Ìµ÷¶ÈÓõÄʱ¼ä).Õâ¸ö¾³£ºÍÉÏÃæÒ»¸öʹÓÃÓÃÀ´¼ÆËãϵͳÄÚºËʱ¼äºÍÓû§Ê±¼ä.²úÉúSIGPROFÐźÅ.
Ïà¹ØÎĵµ£º
»¨ÁË°ëÌìÅäÖúÃÁËcygwinµÄ½çÃ棬 ÏÂÃæ×öÒ»¼Í¼£¬ÒÔ±¸Ï´βéÔÄ
1. ¹ØÓÚtermµÄÎÊÌ⣬ Èç¹ûÏÓ°²×°µÄterm²»¹»pp£¬¿ÉÒÔʹÓÃputty£¬ÄǾÍÐèÒª°²×°openssh°ü£¬ÒÔ±ã¿ÉÒÔʹÓÃputty£¬
opensshµÄ°²×°¹ý³Ì²ÎÔÄhttp://pigtail.net/LRP/printsrv/cygwin-sshd.html ÀïÃæ½éÉܵĺÜÏêϸ¡£ÏÂÃæÌô¼¸¸ö¹Ø¼üµã¼Ç¼ÈçÏ£º
(2b) Download ......
wine Ò»¸ö1.1°æ±¾µÄËѹ·ä¯ÀÀÆ÷£º
$ ln -s
Îļþ¼Ð·¾¶/SogouExplorer/ .wine/drive_c/Program\ Files/SogouExplorer
$ wine "C:\Program
Files\SogouExplorer\SogouExplorer.exe" -proxy
PID:8
PORT:8081
CPORT:8082
PAC:http://127.0.0.1:8082/proxy.pac?t=1349
RET:SUCCESS
¼´
¿ÉÔÚ Fi ......
Covtool
ÊÇÒ»¸öÓöÔ
C++
´úÂë½øÐÐÔËÐÐʱ¸²¸ÇÂʼì²éµÄ¹¤¾ß£¬¿ÉÒÔÒÔÐÐΪµ¥Î»¼ì²é³öÄÇЩ´úÂëÔÚÔËÐÐÖб»Ê¹Óã¬ÄÇЩûÓÐʹÓá£
1.
°²×°
make
make tests
make install
½«
/usr/local/covtool
Ìí¼Óµ½
PATH
½«
/usr/local/covtools
Ìí¼Óµ½
MANPATH£¨´Ë²½ºÜÖØÒª£¬ËüµÄman±ÈÎ ......
2010Äê05ÔÂ1ºÅ |
23:15·ÖÀࣺ¹ÜÀíά»¤
, Õï¶Ï°¸Àý
| ±à¼
| ±êÇ©£º11g
¡¢dbca
¡¢netca
| 13
views
±¾Îijö×Ô “inthirties£¨ÄÐ
ÈËÈýÊ®£©
”²©¿Í£¬×ªÔØÇëÎñ±Ø×¢Ã÷×÷Õߺͱ£Áô³ö´¦¡£
¿Í»§×°ºÃÁËOracle£¬°²×°³É¹¦ÁË£ ......