Abel'Blog

我干了什么?究竟拿了时间换了什么?

0%

pprof

pprof is a tool for visualization and analysis of profiling data.

pprof reads a collection of profiling samples in profile.proto format and
generates reports to visualize and help analyze the data. It can generate both
text and graphical reports (through the use of the dot visualization package).

profile.proto is a protocol buffer that describes a set of callstacks
and symbolization information. A common usage is to represent a set of
sampled callstacks from statistical profiling. The format is
described on the proto/profile.proto file. For details on protocol
buffers, see https://developers.google.com/protocol-buffers

Profiles can be read from a local file, or over http. Multiple
profiles of the same type can be aggregated or compared.

If the profile samples contain machine addresses, pprof can symbolize
them through the use of the native binutils tools (addr2line and nm).

阅读全文 »

简介

模板编程的应用主要有两种:泛型编程 (generic programming) 和 元编程 (meta-programming)。前者注重于 通用概念 的抽象,设计通用的 类型 或 算法 (algorithm),不需要过于关心编译器如何生成具体的代码;而后者注重于设计模板推导时的 选择 (selection) 和 迭代 (iteration),通过模板技巧设计程序。[1]

元编程(template meta-programming),在许多现代C++和Boost程序组件里面使用了。如果不能理解这块的东西,将无法读懂很多代码。可以通过它操作产生程序的程序。元编程是工作在编译器级别的一种程序。和普通编程不相同,普通编程是在执行的时候,对变量计算、判断和赋值;元编程是泛型编程的子集。

元编程的基本 演算规则 (calculus rule) 有两种:编译时测试 (compile-time test) 和 编译时迭代 (compile-time iteration) [1],分别实现了 控制结构 (control structure) 中的 选择 (selection) 和 迭代 (iteration)。基于这两种基本的演算方法,可以完成更复杂的演算。

阅读全文 »

简介

C++非常容易出现内存泄漏的问题。写一篇文章来总结这块的事情。

内存泄漏和内存野指针,是相伴随出现的。本质来自于堆内存处理的粗暴造成。

阅读全文 »

开始阅读一下recast-crowds相关知识,这个功能是避免怪物在跑动的时候,挤在一块。先从数据结构开始了解。

RVO视频参考

每个agent都认为其他的agent都会移动;

agent在接近其他agent的时候,速度会变慢,甚至能停止;

当拥挤的时候,将会先尝试自己指向最近的寻路点连线向量$\vec{a}$,是否存在碰撞;

如果有碰撞,先减速,将$\vec{a}$向量±45°做短距离移动;

阅读全文 »