自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

wangzhicheng2013的专栏

王志成IT心路历程

  • 博客(23)
  • 资源 (14)
  • 收藏
  • 关注

原创 异步asio udp server和client (单线程)

1.asyn_asio_udp_server.hpp#ifndef ASYN_ASIO_UDP_SERVER_HPP_#define ASYN_ASIO_UDP_SERVER_HPP_#include <string.h>#include <iostream>#include <string>#include "boost/asio.hpp"...

2019-07-07 14:06:50 1225 1

原创 测试系统堆内存

一 需求:使用new操作测试程序最多可申请多大的堆内存二 实现:1.直接使用new直接使用new可能会抛出bad_alloc异常,所以要使用try catch捕获2.使用new(nothrow)分配失败不会抛出异常,而是返回空指针三 代码:1.test.cpp#include <stdint.h>#include <iostream>...

2019-07-04 15:43:33 285

原创 redis client pool

1.redis_client.hpp#ifndef REDIS_CLIENT_HPP_#define REDIS_CLIENT_HPP_#include <hiredis/hiredis.h>#include <string.h>#include <iostream>#include <string>using namespace ...

2019-07-03 21:01:53 748

原创 程序性能优化---倒置字符串中单词

需求:输入 have a nice day输出 day nice a have实现:#include <unistd.h>#include <iostream>#include <vector>#include <sstream>#include <stack>using namespace std;stri...

2019-07-03 16:30:23 226

原创 使用select实现异步定时器

需求:实现异步定时器,不干扰其它线程实现:使用select作为超时API,但一定程度增加系统payload代码:select_timer.hpp#ifndef SRC_SELECT_TIMER_HPP_#define SRC_SELECT_TIMER_HPP_#include <sys/time.h>#include <iostream>#...

2019-07-01 18:55:52 1343

原创 CPU整数乘法能力已超越应用软件层面上的优化

一 需求:测试现代CPU整数乘法 VS 埃及乘法二 测试代码:#include <iostream>using namespace std;inline bool odd(int n) { return n & 0x01;}inline int half(int n) { return n >> 1;}inline int ...

2019-07-30 16:30:15 187

原创 likely应用

#include <stdlib.h>#include <iostream>using namespace std;#define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0)int main() { int x; cin ...

2019-07-30 15:19:35 264

原创 实时显示时间

#include <unistd.h>#include <time.h>#include <iostream>#include "select_timer.hpp"using namespace std;void show_current_time() { time_t tt = {0}; time(&tt); str...

2019-07-29 16:34:15 171

原创 c++中的委托

#ifndef SRC_COMMON_EVENTS_HPP_#define SRC_COMMON_EVENTS_HPP_#include <map>using namespace std;template <class cb_func_type>class common_events {public: common_events() { next_key...

2019-07-29 15:21:23 273

原创 string assign is not thread safe

#include <string.h>#include <time.h>#include <iostream>#include <string>#include <vector>#include <thread>#include <mutex>#include <atomic>usin...

2019-07-26 21:12:11 151

原创 元编程实现求整数序列最大值

使用元编程 stl算法库和自定义函数实现求整数序列最大值#include <stdint.h>#include <iostream>#include <vector>#include <type_traits>#include <algorithm>using namespace std;template <in...

2019-07-26 10:42:51 222

原创 元编程求阶乘

元编程求阶乘有计算优势,但必须在程序中输入常量,这个只适用特定业应用场景。#include <stdint.h>#include <iostream>#include <type_traits>using namespace std;template <unsigned n>struct factorial : std::integr...

2019-07-26 10:13:18 177

原创 simple delegate design mode

#include <iostream>using namespace std;template <class T, class R, typename... Args>class self_delegate {public: self_delegate(T *obj_ptr, R (T::*fun_ptr)(Args...)) : obj_ptr_(obj...

2019-07-25 21:04:55 118

原创 hex to decimal with two methods istringstream is so slow

#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <time.h>#include <iostream>#include <string>#include <sstream&g...

2019-07-24 20:41:25 156

原创 基于libevent的http server

需求:实现http server,提供rest接口实现:使用libevent实现http server,采用多线程处理,每个线程对应一个event base代码:1.socket_config.hpp#ifndef SRC_SOCKET_CONFIG_HPP_#define SRC_SOCKET_CONFIG_HPP_#include <string>using...

2019-07-24 09:40:28 760

原创 切绳子

题目描述有N条绳子,它们的长度分别为Li。如果从它们中切割出K条长度相同的绳子,这K条绳子每条最长能有多长?答案保留到小数点后2位(直接舍掉2位后的小数)。输入输出格式输入格式:第一行两个整数N和K(0<N<=10000, 0<K<=10000),接下来N行,描述了每条绳子的长度Li(0<Li<=100000.00)。输出格式:切割后每条...

2019-07-22 11:27:12 271

原创 组播例子

1.sender.cpp#include <sys/types.h> #include <sys/socket.h>#include <arpa/inet.h>#include <stdlib.h>#include <unistd.h>#include <stdio.h>#include <string...

2019-07-16 11:06:26 522

原创 random value in array

#include <stdlib.h>#include <time.h>#include <iostream>#include <string>#include <algorithm>using namespace std;void swap(int *p, int *q) { int tmp = *p; *...

2019-07-15 21:42:00 135

原创 the power of compile computation

#include <iostream>#include <string>#include <algorithm>using namespace std;template<int N>class aTMP{public: enum { ret = N * aTMP<N-1>::ret };...

2019-07-12 20:56:06 115

原创 gen similarity compute

1.similar_gen.cpp#include <string.h>#include <iostream>#include <string>#include <algorithm>#include "boost/noncopyable.hpp"using namespace std;class similar_gen : pub...

2019-07-10 21:08:04 175

原创 使用asio创建简单udp服务demo

1.server.cpp#include <iostream>#include <string>#include "boost/asio.hpp"using namespace std;using namespace boost::asio;static const size_t BUF_SIZE = 1024;int main() { io_servi...

2019-07-04 16:50:04 1133

原创 c++11以后的那些语法糖并不能带来程序性能的提升

一 需求:c++11后有些让人看着很炫的语法糖,比如tuple,for_each等,但是它们并不能提升c++程序性能,做个简单测试,验证这些语法糖带来的效果。二 实现:1.测试函数返回多个值(1)使用tuple返回 (2) 使用结构体引用返回2.测试遍历一个vector,并对其中元素执行操作 (1) 使用普通循环 (2) 使用for (auto &amp...

2019-07-04 14:52:19 414 1

原创 sort three number

#include <iostream>#include <set>#include <algorithm>using namespace std;void sort_three0(int &a, int &b, int &c) { vector<int>v{a, b, c}; sort(begin(v...

2019-07-01 21:18:40 182

多边形游戏

//多边形游戏:n个顶点,n条边的多边形,每一个顶点有一个整数值,每一条边上有*或+,代表乘法和加法 //从中任意删除一条边,用相邻的顶点和关联的边上的运算符进行运算,运算结果产生新的顶点 //用新的顶点取代原来的两个顶点和他们关联的边,这样依次做下去,最后只剩一个顶点,求出最大的顶点值

2012-01-22

字符串匹配程序

#include<iostream>#include<vector>#include<string> #include<sstream>using namespace std;

2012-01-21

计算机集群

distributed processing system, which consists of a collection of interconnected stand-alone computers working together as a single, integrated computing resource

2012-01-19

大规模并行处理机系统 MPP

In a massively parallel processing system, current levels of technology allow for

2012-01-18

对称多处理机

单一物理地址空间(single physical Address Space) 高速缓存一致性(Cache coherence) 低通信延迟(low Latency)Only an OS copy

2012-01-18

Interconnection Network

the n! Connection patterns of its n inputs and n outputs.For example Clos network.In contrast ,blocking network, for example Omega,multistage cube

2012-01-18

Communication in Multiprocessor Systems

在扩展的多处理机、多计算机机群或分布式系统中,各个组成模块都可以系统总线、I/O总线、交叉开关或多级开关互连之。

2012-01-18

高级计算机测试

A PLA has a set of inputs and corresponding input complements (which can be implemented with a set of inverters), and two stages of logic

2012-01-18

高级体系结构课程纲要

A PLA has a set of inputs and corresponding input mplements (which can be implemented with a set of inverters), and two stages of logic

2012-01-18

高级计算机体系结构

单片集成大量三极管,功能增强加工线条精细,三极管尺寸小,门延减小,频率提高集成度提高,功耗增加,温度升高引脚受空间限制线条电阻可能超过门延

2012-01-18

线性表的分析

线性表示一个有序的链表,集合里的元素是谓语有序的口岸

2011-12-19

CBR推理技术模型

AI资料介绍,一些详细的c++编码,和人工智能前沿的技术和方法论

2011-11-23

人工智能课件

人工智能方法与系统,涉及c++编程,还有一些人工智能前沿的问题。

2011-11-23

计算机技术人工智能1

人工智能第一课,的题目是什么呢,这样吧人工智能方法林离的

2011-10-30

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除