linux下统计时间类
class CTimeTickCount
{
public:
CTimeTickCount(int threadIndex, int id )
{
struct timezone tz;
gettimeofday(&m_tvStartTime, &tz);
// m_tmStartTime = ACE_OS::gettimeofday();
m_iThreadIndex = threadIndex;
m_iID = id;
}
~CTimeTickCount()
{
struct timezone tz;
struct timeval tv;
gettimeofday(&tv, &tz);
// ACE_Time_Value currTime = ACE_OS::gettimeofday();
long cost = (tv.tv_sec - m_tvStartTime.tv_sec) * 1000 * 1000;
cost += (tv.tv_usec - m_tvStartTime.tv_usec );
if(cost >= 100 * 1000 )
{
//NVS_DEBUG((NVS_LM_ERROR, "====thread no: %d, cost time: %dms, id: %d.",
// m_iThreadIndex, cost, m_iID));
printf( "====thread no: %d, cost time: %dms, id: %d.\n", m_iThreadIndex, cost, m_iID));
}
}
private:
struct timeval m_tvStartTime; // ACE_Time_Value m_tmStartTime; // 开始时间
int m_iThreadIndex; // 线程号
int m_iID; // 标示
};
相关文档:
由操作系统实现的所有系统调用所构成的集合即程序接口或应用编程接口(Application Programming Interface,API)。是应用程序同系统之间的接口。
操作系统的主要功能是为应用程序的运行创建良好的环境,为了达到这个目的,内核提供一系列具备预定功能的的内核函数,通过一组称为系统调用的(system call)的接口呈现给用 ......
采用glimpse可以对源代码进行索引,这样在繁杂的代码里面,可以很快的找到关键字。
这个工具就是glimpse。使用方法就不多说了。可以查google嘛! ^__^
采用tee命令可以将glimpse查找出来的信息转存为文件。
就是这样:
glimpse CONFIG_BOOTDELAY | tee bootdelay.txt
这样就查出了所有CONFI ......
/******************************
*
* server.c
*
******************************/
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<errno.h>
#include<string.h>
#include<netinet/in.h>
#include<sys/wait.h> ......