随笔分类 -  Linux

摘要:// freq 是一秒内执行的次数 int freq_op(int freq) { uint64_t freq_interval_ns = uint64_t(1000000000/freq) uint64_t start_time_ns = getTimeOfNs(); uint64_t do_ti 阅读全文
posted @ 2021-02-09 10:14 delta1037 阅读(95) 评论(0) 推荐(0)
摘要:select实现精确定时 相较sleep和usleep的不精确定时,select的超时可以作为一种较为精确的定时 static void sleepUS(uint64_t usec){ struct timeval tv; tv.tv_sec = usec / 1000000UL; tv.tv_us 阅读全文
posted @ 2020-09-14 14:02 delta1037 阅读(69) 评论(0) 推荐(0)
摘要:# SERVER_DETECT_BASH :脚本文件路径 # SSH_SCRIPT_ARG :脚本执行的参数 # 结果输出可以自定义重定向 ssh -p ${SSH_PORT} ${SSH_ACCOUNT}@${SSH_IP} 'bash -s' < ${SERVER_DETECT_BASH} ${ 阅读全文
posted @ 2020-09-09 14:59 delta1037 阅读(309) 评论(0) 推荐(0)
摘要:SSH自动填充密码 #!/usr/bin/expect set L_IP [lindex $argv 0] set L_PORT [lindex $argv 1] set L_ACCOUNT [lindex $argv 2] set L_PASSWD [lindex $argv 3] set tim 阅读全文
posted @ 2020-09-09 11:36 delta1037 阅读(362) 评论(0) 推荐(0)
摘要:void CStat::runtimePrintBuf(std::vector<std::string> &buf){ static int last_print_lines = 0; for(int i = 0; i < last_print_lines; ++i){ printf("\033[1 阅读全文
posted @ 2020-08-27 17:18 delta1037 阅读(375) 评论(0) 推荐(0)
摘要:Linux识别按键 top中的源代码,慢慢理解。。。 不需要按ENTER键,按下即可识别 代码片段 部分摘自top源代码,部分来源于网络博客 #include <sys/time.h> #include <stdio.h> #include <termios.h> /* The original a 阅读全文
posted @ 2020-08-14 09:48 delta1037 阅读(376) 评论(0) 推荐(0)
摘要:# 备份文件 mv /etc/localtime /etc/localtime.bak # 修改为上海时间 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 阅读全文
posted @ 2020-08-04 14:39 delta1037 阅读(87) 评论(0) 推荐(0)
摘要:fio安装 fio 3.21下载地址 下载之后解压tar -xzvf,打开解压后的文件夹 ./configure --enable-gfio # 只有加这个参数才能编译安装gfio make fio make gfio make install CentOS 7 make时缺少头文件问题 我安装的虚 阅读全文
posted @ 2020-07-25 14:38 delta1037 阅读(417) 评论(0) 推荐(0)