linux内核学习之likely()和unlikely()
参考资料 : linux内核设计和实现 P13
likely()和unlikely()是内核编译时用于优化 if 判断语句的宏
likely()代表优化
unlikely()代表不优化
一般为了效率 由程序员自己判断if语句里面的内容是否要优化,显然如果if语句里面的内容有很大的概率会执行到就该优化,不然就不必优化
if(likely(A != 0))
{
...
}
相关文档:
1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI) 就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......
class CTimeTickCount
{
public:
CTimeTickCount(int threadIndex, int id )
{
struct timezone tz;
gettimeofday(&m_tvStartTime, &tz);
// m_tmStartTime = ACE_OS::gettimeofday();
m_iThreadIndex ......
1. 创建目录
mkdir –p test/sub
2. 在子目录sub/下编写hello.c和hello.h
/*****hello.c*****/
#include <stdio.h>
#include “hello.h”
void hello()
{
printf(“Hello!\n”);
}
/*****hello.h**** ......
linux命令行下中文文件名乱码的解决方法
首先查询支持的编码:
locale -a
如果没有你需要的编码,例如zh_CN.utf8
root运行: #dpkg-reconfigure locales
选择你需要的编码,用空格选中,可多选。tab选择“OK”,回车。
默认编码选择zh_CN.utf8
安装你所需要的编码。
修改/etc/profile,
注释掉
export LC ......