make clean:
find . -name "*.o" -exec ls {} \; --查看路径是否正确
find . -name "*.o" -exec rm -f {} \; --删除
清理linux缓存:
free -m 查看
echo 3 > /proc/sys/vm/drop_caches 清除
free -m 查看
mpstat -P ALL 2 ---查看cpu变化
指定编译器:
export CC=arm-qcom-linux-gnueabi-gcc-5.2.0
export STAGING_DIR=/home/dog/qcom/toolchain/toolchain-arm_cortex-a7_gcc-5.2.0_glibc-2.21_eabi/bin:$STAGING_DIR
测试USB读写速率:
sync;time dd if=/dev/zero of=/mnt/sda2/largefile bs=10k count=10240;time sync
sync;echo 3 >/proc/sys/vm/drop_caches;time dd if=/mnt/sda2/largefile of=/dev/null bs=10k
当服务器连接过多,新的连接可以重新使用time-wait,常见web server
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_tw_recycle=1
缩短FIN序列到内存可以空闲处理处理新连接的时间(避免死socket内存溢出)
sysctl -w net.ipv4.tcp_fin_timeout=30
针对所有协议设置最大系统发送缓存和接收缓存rmem到8M
sysctl -w net.core.wmem_max=8388608
sysctl -w net.core.rmem_max=8388608
sysctl -w net.ipv4.wmem="4096 87380 8388608"
sysctl -w net.ipv4.rmem="4096 87380 8388608"
丢弃路由器发送的由操作系统通过保留路径验证的来源数据包 -- act
sysctl -w net.ipv4.conf.eth0.rp_filter=1
sysctl -w net.ipv4.conf.lo.rp_filter=1
sysctl -w net.ipv4.conf.default.rp_filter=1
sysctl -w net.ipv4.conf.all.rp_filter=1
设置重组ip碎片的内存最小256m和最大384m
sysctl -w net.ipv4.ipfrag_low_thresh=262144
sysctl -w net.ipv4.ipfrag_high_thresh=393216
__ratelimit: N callbacks suppressed表示内核阻止了N条syslog消息,这是因为系统重复的日志过多(频率过高),太快输出,被内核中的net_ratelimit()限制了syslog消息。
cat /proc/sys/kernel/printk_ratelimit
cat /proc/sys/kernel/printk_ratelimit_burst 内核允许每5秒记录10条消息。超过这个限制,内核就会抛弃日志,并打印上述log信息。
sysctl -w net.core.message_cost=0 --》 关闭ratelimit机制,但系统就可能存在被日志攻击的风险
清空cache (可选)
echo 1 > /proc/sys/vm/drop_caches
释放完内存后改回去让系统重新自动分配内存。
echo 0 >/proc/sys/vm/drop_caches
如果我们需要释放所有缓存,就输入下面的命令:
echo 3 > /proc/sys/vm/drop_caches
跟目录磁盘满:vscode存储问题,删除路径中的文件
/home/xxx/.config/Code/User/workspaceStorage ---删除路径中的文件
查看当前目录文件大小: du -h --max-depth=1
CMakeLists.txt编译
在相同目录下新建文件夹,在文件夹里面 cmake ../可以生成相关文件
然后输入make进行编译。 可能需要设置环境变量。