
linux
文章平均质量分 78
我是一头奔跑的猪
这个作者很懒,什么都没留下…
展开
-
自己实现简单的智能指针
#include#includeusing namespace std;templateclass share{ public: share():point(0){} share(T* p1) { point = p1; } ~share() { cout << "begin to delete share" << endl; if原创 2016-08-04 19:40:35 · 2267 阅读 · 0 评论 -
使用reuseport和recvmmsg优化UDP服务器_应用服务器
地址:http://www.shangxueba.com/jingyan/2216074.html最近刚好完成了一个DNS服务器的开发,因此积累一点对高性能UDP服务器的开发经验。如果你也遇到UDP服务器的性能不佳,远不如你的预期,也许你也可以采用本文的手段去优化一下试试。 udp不像tcp是有连接的,因此udp不能通过建立多个连接来提高对服务器的并发访问,然后我转载 2016-09-08 11:44:02 · 5201 阅读 · 0 评论 -
epoll中的data联合体怎样使用的问题
1、epoll结构体的成员data其实是一个结构体,具体如下:typedef union epoll_data{ void *ptr; int fd; uint32_t u32; uint64_t u64;} epoll_data_t; struct epoll_event{ uint32_t events; /* Epoll events */ epoll_原创 2016-09-08 15:16:32 · 5805 阅读 · 1 评论 -
linux性能分析的前60秒
转载自:http://techblog.netflix.com/2015/11/linux-performance-analysis-in-60s.htmlLinux Performance Analysis in 60,000 MillisecondsYou login to a Linux server with a performance issue: w转载 2016-11-20 12:58:39 · 1059 阅读 · 0 评论 -
nginx支持thinkphp
最近在搭建lnmp服务框架支持thinkphp,碰到一些问题,记录一下: 1、php7不兼容Thinkphp5以下的版本 2、nginx配置文件怎样支持Thinkphp的重写:server { listen 80; server_name localhost; root /home/web/nginx/原创 2017-01-13 18:29:11 · 485 阅读 · 0 评论 -
Linux动态库(.so)搜索路径设置方法
众所周知,Linux动态库的默认搜索路径是/lib和/usr/lib。动态库被创建后,一般都复制到这两个目录中。当程序执行时需要某动态库,并且该动 态库还未加载到内存中,则系统会自动到这两个默认搜索路径中去查找相应的动态库文件,然后加载该文件到内存中,这样程序就可以使用该动态库中的函数,以及该动态库的其它资源了。在Linux 中,动态库的搜索路径除了默认的搜索路径外,还可以通过以下三种方法转载 2017-02-06 14:55:28 · 2880 阅读 · 0 评论 -
mysql5.6启动失败的一般解决方法
本文针对mysql5.6而言: MySQL server PID file could not be found! Starting MySQL...The server quit without updating PID file (/var/lib/mysql/mysql.pid).---------------------------------------原创 2017-01-20 12:36:14 · 6885 阅读 · 0 评论 -
使用 /proc 文件系统来访问 Linux 内核的内容
本文转自:https://www.ibm.com/developerworks/cn/linux/l-proc.html转载 2017-04-10 11:54:54 · 652 阅读 · 0 评论 -
thrift安装过程报错处理
1、make过程中总是: src/generate/thrift-t_c_glib_generator.o: file not recognized: File truncated /var/log/message查看了内核日志:发现 localhost kernel: Out of memory 怀疑是内存不足导致,看了下虚拟机内存分配只有1g,增加到2g后,make,一切原创 2017-05-03 11:08:35 · 4012 阅读 · 0 评论 -
wireshark ts流分析--简明步骤
1、先过滤出:pat包,2、具体上面已经说明。原创 2016-09-07 19:43:18 · 5051 阅读 · 0 评论 -
makefile三个常见变量:$@,$^,$<
转载自:http://my.oschina.net/u/1413984/blog/199029Makefile有三个非常有用的变量。分别是$@,$^,$<代表的意义分别是: $@--目标文件,$^--所有的依赖文件,$<--第一个依赖文件。 如果我们使用上面三个变量,那么我们可以简化我们的Makefile文件为: # 这是简化后的Makefile main:ma转载 2016-09-09 10:30:17 · 622 阅读 · 0 评论 -
list-erase
#include#include#include#include#includetypedef std::list CList_int;void deleteAllList(){ CList_int::iterator it, it1; if( m_list.empty() ) { return; } for( it =原创 2016-08-29 16:12:48 · 461 阅读 · 0 评论 -
线程池
#include #include#include#includeusing namespace std;static pthread_mutex_t m_pthreadMutex = PTHREAD_MUTEX_INITIALIZER; /** 线程同步锁 */static pthread_cond_t m_pthreadCond = PTHREAD_COND_INITIAL原创 2016-08-30 14:11:26 · 337 阅读 · 0 评论 -
派生类的构造函数中,可以将基类作为成员变量进行初始化
#include#include#includeusing namespace std;class A{public: A():m_year(0){} A(int n){m_year = n;}public: int m_year ;};class B : public A{public: B(){} B(int n):A(n)原创 2016-08-19 17:46:00 · 3072 阅读 · 0 评论 -
sql语句
1、查询某个日期接下来的几天: select '2016-02-0'::date + i;2、确定某个表是否存在:SELECT COUNT(*) FROM pg_class WHERE relname = ‘表名’3、做除数时需要的判断: case when sum(count)=0 hen 0 else sum(h.speed * h.count)/sum(h.co原创 2016-08-23 14:10:54 · 336 阅读 · 0 评论 -
std::list<>在结构体中占用的内存大小
#include#include#include#include#includetypedef struct tagTest{ char name[200]; int year;}Test;#define NUM 1typedef struct tagInfo{ //int count; char c; //会对齐到8字节,无论是count原创 2016-09-14 16:44:03 · 2786 阅读 · 0 评论 -
aliyun ubuntu pstack无法使用的问题解决 crawl: Input/output error
好久没写博客了。原创 2017-11-14 16:43:37 · 9677 阅读 · 0 评论