Location:
Search - GetTickCount
Search list
Description: delphi 高精度计时函数调用,比gettickcount要精确-delphi precision timing function call, to be accurate than gettickcount
Platform: |
Size: 6412 |
Author: 新市民 |
Hits:
Description: 精确定位Windows里的时间,不仅仅是定位到毫秒级的时间,可能对于精度高的编程才用到。
Platform: |
Size: 173329 |
Author: wanglingwei |
Hits:
Description: 从串口读取数据,有两种方法,1、每接收一个EV_RXCHAR,就用ReadFile读一次,这样我觉得太恐怖了。2、接收到一个EV_RXCHAR后,等一定数据量的CPU周期(GetTickCount),再一次性读取缓冲区里的数据。这样做,一般情况下不会有问题,但是,如果数据很多,过了“一定数据量的CPU周期”,还没收完数据怎么办?就会少读数据了。 我用三个线程序来完成串口数据的接收,其实就是第一种方法的变种: 一个侦听EV_RXCHAR,一个对EV_RXCHAR进行分析,其实就是超时判断。如果接收到一个消息后,一段时间没收到下一个EV_RXCHAR,就认为是一个数据包的结束。这个线程就会通知数据接收线程,进行数据接收。一般同一包数据,两个字符之间的时间间隔,应该很小了吧,而两个数据包之间的间隔,应该不会太小吧!(这个地方我不清楚,猜的:( :) )最后一个线程,是接收数据的。-read data from the serial port, there are two methods, one, each receiving a EV_RXCHAR, on the ReadFile read, I think this vote. 2, received a EV_RXCHAR after a certain volume of data, such as CPU cycles (GetTickCount), and the one-time reader, the data buffer. To do so, under normal circumstances there is no problem, but if many of the data, and after a "certain amount of data the CPU cycles," also confiscated End Data how do? Few will read the data. I used three lines to complete serial data reception, the first method is a variant : an interception EV_RXCHAR, one pair of EV_RXCHAR analysis is, in fact, overtime judgment. If a receiver to the news, some time had not received a EV_RXCHAR, it is a data packet to an end. This thread will receive notification of data threads for da
Platform: |
Size: 46411 |
Author: 刘云鹏 |
Hits:
Description: 从串口读取数据,有两种方法, 1、每接收一个EV_RXCHAR,就用ReadFile读一次,这样我觉得太恐怖了。 2、接收到一个EV_RXCHAR后,等一定数据量的CPU周期(GetTickCount),再一次性读取缓冲区里的数据。这样做,一般情况下不会有问题,但是,如果数据很多,过了“一定数据量的CPU周期”,还没收完数据怎么办?就会少读数据了。 我用三个线程序来完成串口数据的-read data from the serial port, there are two methods, one, each receiving a EV_RXCHAR, on the ReadFile read, I think this vote. 2, received a EV_RXCHAR after a certain volume of data, such as CPU cycles (GetTickCount), and the one-time reader, the data buffer. To do so, under normal circumstances there is no problem, but if many of the data, and after a "certain amount of data the CPU cycles," also confiscated End Data how do? Few will read the data. I used three lines to complete serial data
Platform: |
Size: 49061 |
Author: 张权 |
Hits:
Description: 一个判断远程主机存活程序代码(ping)
#include
#include
#include
#include
#include "winsock.h"
#pragma comment(lib,"Ws2_32");
#define SEND_SIZE 32
#define PACKET_SIZE 4096
#define ICMP_ECHO 8
#define ICMP_ECHOREPLY 0
struct icmp
{
unsigned char icmp_type;
unsigned char icmp_code;
unsigned short icmp_cksum;
unsigned short icmp_id;
unsigned short icmp_seq;
unsigned long icmp_data;
};
struct ip
{
unsigned char ip_hl:4;
unsigned char ip_v:4;
unsigned char ip_tos;
unsigned short ip_len;
unsigned short ip_id;
unsigned short ip_off;
unsigned char ip_ttl;
unsigned char ip_p;
unsigned short ip_sum;
unsigned long ip_src;
unsigned long ip_dst;
};
unsigned char sendpacket[PACKET_SIZE];
unsigned char recvpacket[PACKET_SIZE];
struct sockaddr_in dest_addr;
struct sockaddr_in from_addr;
int sockfd;
int pid;
unsigned short cal_chksum(unsigned short *addr,int len);
int pack(int pack_no);
int unpack(unsigned char *buf,int len);
void send_packet(void);
void recv_packet(void);
void main(int argc,char *argv[])
{
struct hostent *host;
struct protoent *protocol;
WSADATA wsaData;
int timeout=1000;
int SEND_COUNT=4;
int i;
char *par_host;
par_host=argv[argc-1]; //IP赋值
switch(argc)
{
case 2: break;
case 3: if(strcmp(argv[1],"-t")==0)
{
SEND_COUNT=10000;
break;
}
//fall through
default:
printf("usage: %s [-t] Host name or IP address\n",argv[0]);
exit(1);
}
if(WSAStartup(0x1010,&wsaData)!=0)
{
printf("wsastartup error\n");
exit(1);
}
if( (protocol=getprotobyname("icmp") )==NULL)
{
printf("getprotobyname error\n");
exit(1);
}
/*
printf("%s\n",protocol->p_name);
printf("%s\n",protocol->p_aliases);
printf("%d\n",protocol->p_proto);
system("pause");
*/
if( (sockfd=socket(AF_INET,SOCK_RAW,protocol->p_proto) )<0)
{
printf("socket error\n");
exit(1);
}
if(setsockopt(sockfd,SOL_SOCKET,SO_RCVTIMEO,(char*)&timeout,sizeof(timeout))h_length);
//resolve address to hostname
if(host=gethostbyaddr(host->h_addr,4,PF_INET))
par_host=host->h_name;
//
//printf("%s\n",par_host);
//
}
else if( dest_addr.sin_addr.s_addr=inet_addr(par_host)==INADDR_NONE)
{
printf("Unkown host %s\n",par_host);
exit(1);
}
pid=getpid();
/*
printf("%d\n",pid);
system("pause");
*/
printf("Pinging %s [%s]: with %d bytes of data:\n\n",par_host,inet_ntoa(dest_addr.sin_addr),SEND_SIZE);
for(i=0;i1)
{ sum+=*w++;
nleft-=2;
}
if( nleft==1)
{ *(unsigned char *)(&answer)=*(unsigned char *)w;
sum+=answer;
}
sum=(sum>>16)+(sum&0xffff);
sum+=(sum>>16);
answer=~sum;
return answer;
}
//打包
int pack(int pack_no)
{
int packsize;
struct icmp *icmp;
packsize=8+SEND_SIZE;
icmp=(struct icmp*)sendpacket;
icmp->icmp_type=ICMP_ECHO;
icmp->icmp_code=0;
icmp->icmp_cksum=0;
icmp->icmp_seq=pack_no;
icmp->icmp_id=pid;
icmp->icmp_data=GetTickCount();
icmp->icmp_cksum=cal_chksum( (unsigned short *)icmp,packsize); /*校验算法*/
return packsize;
}
//解包
int unpack(unsigned char *buf,int len)
{
struct ip *ip;
struct icmp *icmp;
double rtt;
int iphdrlen;
ip=(struct ip *)buf;
iphdrlen=ip->ip_hl*4;
icmp=(struct icmp *)(buf+iphdrlen);
if( (icmp->icmp_type==ICMP_ECHOREPLY) && (icmp->icmp_id==pid) )
{
len=len-iphdrlen-8;
rtt=GetTickCount()-icmp->icmp_data;
printf("Reply from %s: bytes=%d time=%.0fms TTL=%d icmp_seq=%u\n",
inet_ntoa(from_addr.sin_addr),
len,
rtt,
ip->ip_ttl,
icmp->icmp_seq);
return 1;
}
return 0;
}
//发送
void send_packet()
{
int packetsize;
static int pack_no=0;
packetsize=pack(pack_no++);
if( sendto(sockfd,(char *)sendpacket,packetsize,0,(struct sockaddr *)&dest_addr,sizeof(dest_addr) )=0)
success=unpack(recvpacket,n);
else if (WSAGetLastError() == WSAETIMEDOUT)
{
printf("Request timed out.\n");
return;
}
}while(!success);
}
UID5380 帖子239 精华0 积分1289 阅读权限40 来自软件学院 在线时间81 小时 注册时间2006-5-22 最后登录2007-2-24 查看详细资料
TOP
Platform: |
Size: 5881 |
Author: shuiyuan313 |
Hits:
Description: 从串口读取数据,有两种方法,1、每接收一个EV_RXCHAR,就用ReadFile读一次,这样我觉得太恐怖了。2、接收到一个EV_RXCHAR后,等一定数据量的CPU周期(GetTickCount),再一次性读取缓冲区里的数据。这样做,一般情况下不会有问题,但是,如果数据很多,过了“一定数据量的CPU周期”,还没收完数据怎么办?就会少读数据了。 我用三个线程序来完成串口数据的接收,其实就是第一种方法的变种: 一个侦听EV_RXCHAR,一个对EV_RXCHAR进行分析,其实就是超时判断。如果接收到一个消息后,一段时间没收到下一个EV_RXCHAR,就认为是一个数据包的结束。这个线程就会通知数据接收线程,进行数据接收。一般同一包数据,两个字符之间的时间间隔,应该很小了吧,而两个数据包之间的间隔,应该不会太小吧!(这个地方我不清楚,猜的:( :) )最后一个线程,是接收数据的。-read data from the serial port, there are two methods, one, each receiving a EV_RXCHAR, on the ReadFile read, I think this vote. 2, received a EV_RXCHAR after a certain volume of data, such as CPU cycles (GetTickCount), and the one-time reader, the data buffer. To do so, under normal circumstances there is no problem, but if many of the data, and after a "certain amount of data the CPU cycles," also confiscated End Data how do? Few will read the data. I used three lines to complete serial data reception, the first method is a variant : an interception EV_RXCHAR, one pair of EV_RXCHAR analysis is, in fact, overtime judgment. If a receiver to the news, some time had not received a EV_RXCHAR, it is a data packet to an end. This thread will receive notification of data threads for da
Platform: |
Size: 46080 |
Author: 刘云鹏 |
Hits:
Description: 从串口读取数据,有两种方法, 1、每接收一个EV_RXCHAR,就用ReadFile读一次,这样我觉得太恐怖了。 2、接收到一个EV_RXCHAR后,等一定数据量的CPU周期(GetTickCount),再一次性读取缓冲区里的数据。这样做,一般情况下不会有问题,但是,如果数据很多,过了“一定数据量的CPU周期”,还没收完数据怎么办?就会少读数据了。 我用三个线程序来完成串口数据的-read data from the serial port, there are two methods, one, each receiving a EV_RXCHAR, on the ReadFile read, I think this vote. 2, received a EV_RXCHAR after a certain volume of data, such as CPU cycles (GetTickCount), and the one-time reader, the data buffer. To do so, under normal circumstances there is no problem, but if many of the data, and after a "certain amount of data the CPU cycles," also confiscated End Data how do? Few will read the data. I used three lines to complete serial data
Platform: |
Size: 49152 |
Author: 张权 |
Hits:
Description: delphi 高精度计时函数调用,比gettickcount要精确-delphi precision timing function call, to be accurate than gettickcount
Platform: |
Size: 6144 |
Author: 新市民 |
Hits:
Description: 精确定位Windows里的时间,不仅仅是定位到毫秒级的时间,可能对于精度高的编程才用到。-Precise positioning Windows in time, not just targeted to millisecond time, may have high accuracy using only programming.
Platform: |
Size: 456704 |
Author: wanglingwei |
Hits:
Description: 加速器 变速齿轮 Delphi 做的PORTTALK驱动开发 运行后整个系统都加速 适合所有游戏-Delphi to do the变速齿轮accelerator-driven development PORTTALK running the system as a whole to speed up the game suitable for all
Platform: |
Size: 189440 |
Author: 高大侠 |
Hits:
Description: GetTickCount Sleep CreateEvent CloseHandle ResetEvent SetEvent WaitForSingleObject WaitForMultipleObjects AllocConsole GetStdHandle FreeConsole GetLocalTime WriteConsole
Platform: |
Size: 839680 |
Author: sanjay |
Hits:
Description: GetTickCount无法计算16ms以下的时间,该段代码可以进行毫秒级的精确计时-GetTickCount unable to calculate the following time 16ms, which can code the precise millisecond timing
Platform: |
Size: 1024 |
Author: 保密 |
Hits:
Description: 利用 GetTickCount 計算各種函數進出VB邏輯運算所需的時間,用以決定最好的函數寫法。-GetTickCount function calculated using a variety of logic operations VB out of the time required for the function used to determine the best wording.
Platform: |
Size: 2048 |
Author: 謝政奇 |
Hits:
Description: 用VC++编程,比较三种定时器——SetTimer、timeSetEvent、、QueryPerformanceCounter、GetTickCount的在精度上的差别-Using VC++ programming, comparing three types of timers- SetTimer, timeSetEvent,, QueryPerformanceCounter, GetTickCount the difference in accuracy
Platform: |
Size: 731136 |
Author: Edison |
Hits:
Description: 变速齿轮原理是,游戏在刷新画面时会用到时钟来控制刷新速度,有过游戏开发的人都知道,一般游戏锁定1秒30帧,这样会很流畅,人眼有视觉停顿,当速度达到1秒16帧的时候,就是在跑动画了,游戏用到的计时器有大部分是两个windows提供的api函数,一个是::GetTickCount,一个是::timeGetTime,这两个api的原型请查msdn,我们利用hook api 去修改它的值,从而改变游戏速度,工程是一个d-Change gear principle is that the game will refresh the screen refresh rate is used to control the clock, had a game developer knows that, generally 1 second 30 game lock, it will be very smooth, human eyes have visual pause, When the velocity reaches 1 second 16 time is running animation, and game timer are used to provide most of the api function of two windows, one is:: GetTickCount, one is:: timeGetTime, these two api prototype please check msdn, we use the hook api to modify its value, thus changing the game speed, works as a dll!
Platform: |
Size: 2048 |
Author: 吴磊 |
Hits:
Description: 为了测试函数处理时间,自己写了关于时间度量的类来计算执行命令之间需要花的时间。此类简单易懂,使用和修改方便,带例子。此类比 GetTickCount()函数更精确。使用VC++, VC2010编译通过。希望些类给大家带来便利。
-To test the function of processing time, write your own class on time metric to calculate the execution time to be spent between commands. Such easy to understand, easy to use and modify, with examples. Such than GetTickCount () function is more accurate. Using VC++, VC2010 compile. We hope to bring some class to facilitate.
Platform: |
Size: 243712 |
Author: kevin |
Hits:
Description: 程序列出所有的计时方法和计时应用,WM_TIMER、Sleep()、利用COleDateTime类和COleDateTimeSpan类、利用GetTickCount()函数、利用 timeGetTime()函数、利用 timeSetEvent()函数和使用QueryPerformanceFrequency()和QueryPerformanceCounter()函数实现高精度定时-Program lists all of the timing method and timing applications, WM_TIMER, Sleep (), use COleDateTime class and COleDateTimeSpan class, using GetTickCount () function, using timeGetTime () function, using timeSetEvent () function and use of QueryPerformanceFrequency () and QueryPerformanceCounter () function for high precision time
Platform: |
Size: 1651712 |
Author: 王琳伟 |
Hits:
Description: VB编程GetTickCount反调试代码VB programming GetTickCount anti-debugging code
-VB programming GetTickCount anti-debugging code
Platform: |
Size: 10240 |
Author: dj |
Hits:
Description: VB 编程GetTickCount API函数实例经典代码VB Classic programming GetTickCount API function instance code
-VB Classic programming GetTickCount API function instance code
Platform: |
Size: 4096 |
Author: t |
Hits:
Description: GetTickCount反调试 vb防调试-GetTickCount anti-debugging vb anti-debugging
Platform: |
Size: 17408 |
Author: jj |
Hits: