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ÐźÅ.
Ïà¹ØÎĵµ£º
ÔÎĵØÖ·£ºhttp://lhsblog01.blog.163.com/blog/static/1020045192010221104237126/
GPIOÊÇÓëÓ²¼þÌåϵÃÜÇÐÏà¹ØµÄ£¬linuxÌṩһ¸öÄ£ÐÍÀ´ÈÃÇý¶¯Í³Ò»´¦ÀíGPIO£¬¼´¸÷¸ö°å¿¨¶¼ÓÐʵÏÖ×Ô¼ºµÄgpio_chip¿ØÖÆÄ£¿é£ºrequest, free, input,output, get,set,i ......
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±ÈÎ ......
½ñÌì·¢ÏÖµçÄÔ³öÏÖĪÃûÆæÃîµÄÎÊÌ⣬ÈÎÎñÀ¸µÄͼ±ê¶¼ÎÞ·¨Ê¹ÓÃÁË¡£¶øÇÒ×¢²á±íÒ²ÎÞ·¨Ê¹Óá£
´¦Àí·½·¨£º
Ò»¡¢ÏȽâËø×¢²á±í¡£´Ë²½Öèºó¿ÉÒÔÕý³£·ÃÎÊÐÞ¸Ä×¢²á±í¡£
http://zhidao.baidu.com/question/8109053.html?fr=ala0
×¢²á±í±»¹ÜÀíԱͣÓã¬
1¡¢Ð½¨Ò»¸öÎı¾Îļþ£¬ÔÚÆäÖÐÊäÈëÒÔÏÂÄÚÈÝ¡£
[HKEY_CURRENT_USER/Software/Micro ......