![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c项目常用
shao326
未婚
展开
-
c语言 计时执行时间
#include<stdio.h> #include<time.h> int main() { struct timeval start,end; double timeuse; gettimeofday( &start, NULL ); //****被测试点****** gettimeofday( &end, NULL );...2011-04-07 21:02:12 · 123 阅读 · 0 评论 -
守护进程
引入头文件: #include<unistd.h> #include<sys/types.h> 代码main函数中加入: switch (fork()) { case 0: { printf("start system\n"); setsid(); } break; case -1: ...原创 2012-05-23 16:30:38 · 51 阅读 · 0 评论 -
cpu使用率和内存使用率
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <sys/stat.h> #includ原创 2012-06-14 19:49:58 · 542 阅读 · 0 评论 -
项目中的信号处理
(1)main函数中调用 static void init_sig(){ /*信号设置*/ struct sigaction action; //设置常用终止信号 action.sa_handler = handler; sigemptyset(&action.sa_mask); action.sa_flags = 0; sigactio...原创 2012-04-12 09:15:15 · 104 阅读 · 0 评论 -
libevent作为客户端
libevent通常作为服务端,但是有场景会作为客户端去抓取别的服务,通常可以使用libcurl去抓取,但是会使整个线程处于等待状态,这时可以使用libevent客户端模式,使请求完全异步。 #ifndef _EVENT_CURL_H_ #define _EVENT_CURL_H_ #include <string> using n...原创 2017-12-04 19:54:44 · 663 阅读 · 0 评论