强力提高 android 4 编译效率(c,c++部分)
2013-04-28 11:19
363 查看
Setting up ccache
You can optionally tell the build to use the ccache compilation tool. Ccache acts as a compiler cache that can be used to speed-up rebuilds. This works very well if you do "make clean" often, or if you frequently switch between different build products.
Put the following in your .bashrc or equivalent.
export USE_CCACHE=1
By default the cache will be stored in ~/.ccache. If your home directory is on NFS or some other non-local filesystem, you will want to specify the directory in your .bashrc as well.
export CCACHE_DIR=<path-to-your-cache-directory>
The suggested cache size is 50-100GB. You will need to run the following command once you have downloaded the source code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
When building Ice Cream Sandwich (4.0.x) or older, ccache is in a different location:
prebuilt/linux-x86/ccache/ccache -M 50G
This setting is stored in the CCACHE_DIR and is persistent.
------------------------------------------------
原理:
ccache的使用方式,可以加速我们c与c++的编译速度原理就是中间文件的一个缓存,是同一个.o文件的话就省去再次编译的速度。
介于android中c与c++文件数量能占到刚不到一半,所以这个速度还是能省下很多的。
----------------------------------------------
配置:
1在环境变量里添加:
export USE_CCACHE=1
export CCACHE_DIR=/HDD/.ccache
(环境变量有四个位置添加都有效,我习惯添加到全局用户环境变量配置文件:sudo gedit /etc/profile,
第一个是标志,android编译会检测这个
第二个是缓存路径,默认是~/.ccache)
2随便找一个android工程(可能需要2.3以上),设置缓存的大小(注意每执行一次这个,缓存路径会被初始化一次,所以执行一次就好);
prebuilt/linux-x86/ccache/ccache -M 50G
第一次编译一个工程,会缓存工程.o文件,
第二次提升效果明显
ccache缓存的调用情况执行下面命令监视
$ watch -n1 -d prebuilt/linux-x86/ccache/ccache -s
---------------------------------------------------------------------------
真实测试:
工程android 4.0.4
第一次编译:make -j8 36分钟左右;
修改了frameworks的一个资源文件;
再次编译:make clean;make -j8 18分钟
You can optionally tell the build to use the ccache compilation tool. Ccache acts as a compiler cache that can be used to speed-up rebuilds. This works very well if you do "make clean" often, or if you frequently switch between different build products.
Put the following in your .bashrc or equivalent.
export USE_CCACHE=1
By default the cache will be stored in ~/.ccache. If your home directory is on NFS or some other non-local filesystem, you will want to specify the directory in your .bashrc as well.
export CCACHE_DIR=<path-to-your-cache-directory>
The suggested cache size is 50-100GB. You will need to run the following command once you have downloaded the source code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
When building Ice Cream Sandwich (4.0.x) or older, ccache is in a different location:
prebuilt/linux-x86/ccache/ccache -M 50G
This setting is stored in the CCACHE_DIR and is persistent.
------------------------------------------------
原理:
ccache的使用方式,可以加速我们c与c++的编译速度原理就是中间文件的一个缓存,是同一个.o文件的话就省去再次编译的速度。
介于android中c与c++文件数量能占到刚不到一半,所以这个速度还是能省下很多的。
----------------------------------------------
配置:
1在环境变量里添加:
export USE_CCACHE=1
export CCACHE_DIR=/HDD/.ccache
(环境变量有四个位置添加都有效,我习惯添加到全局用户环境变量配置文件:sudo gedit /etc/profile,
第一个是标志,android编译会检测这个
第二个是缓存路径,默认是~/.ccache)
2随便找一个android工程(可能需要2.3以上),设置缓存的大小(注意每执行一次这个,缓存路径会被初始化一次,所以执行一次就好);
prebuilt/linux-x86/ccache/ccache -M 50G
第一次编译一个工程,会缓存工程.o文件,
第二次提升效果明显
ccache缓存的调用情况执行下面命令监视
$ watch -n1 -d prebuilt/linux-x86/ccache/ccache -s
---------------------------------------------------------------------------
真实测试:
工程android 4.0.4
第一次编译:make -j8 36分钟左右;
修改了frameworks的一个资源文件;
再次编译:make clean;make -j8 18分钟
相关文章推荐
- 强力提高 android 4 编译效率(c,c++部分)
- 强力提高 android 4 编译效率(c,c++部分)
- 提高Android编译效率--ccache的原理及使用
- Android分布式编译学习(二)使用ccache 提高编译效率 —— Ubuntu12.04上部署distcc分布式编译
- 使用ant优化android项目编译速度,提高工作效率
- JAVA JNI 调用C/C++库提高运行效率 (图)
- arm-marvell-linux-gnueabi 交叉编译c/c++程序,并移植到android
- 使用IntelliJ IDEA(androidstudio前身)开发android移动应用前的基本设置,提高开发效率
- 一个由c/C++编译的程序占用的内存分几个部分
- 提高Android程序效率注意事项
- 非常适用的Sourceinsight插件,提高效率【强力推荐】
- 编译可在Android上运行的可执行文件:C/C++交叉编译环境
- 使用IntelliJ IDEA(androidstudio前身)开发android移动应用前的基本设置,提高开发效率
- 提高Android开发效率的9个Web工具
- android studio 提高编译的速度,安装apk过慢问题解决
- [转]提高android ContentProvider的效率
- 在window下,简单利用NDK编译c/c++文件,在android项目中调用。
- c++ for Android ----- ndk 编译链接 pthread 报错
- [OS] C/C++编译的程序占用的内存分为以下几个部分
- Android Studio利用快捷键提高代码效率的方法(鸿洋大婶的~)