摘要: #include <atomic> #include <chrono> #include <condition_variable> #include <iostream> #include <mutex> #include <thread> int main() { constexpr size_t 阅读全文
posted @ 2022-10-20 20:58 山岚2013 阅读(109) 评论(0) 推荐(0) 编辑
摘要: /proc/meminfo 粗略解释 Linux 内存总览 更多解释 /PROC/MEMINFO之谜 阅读全文
posted @ 2022-10-18 17:38 山岚2013 阅读(43) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/songthin/article/details/1703966 https://cplusplus.com/reference/new/operator%20new/ https://en.cppreference.com/w/cpp/memory/ne 阅读全文
posted @ 2022-10-18 10:21 山岚2013 阅读(17) 评论(0) 推荐(0) 编辑
摘要: class baseA { public: virtual float mulTwo(float a, float b) = 0; virtual ~baseA() = default; }; class vClassA : public baseA { public: ~vClassA() ove 阅读全文
posted @ 2022-10-17 22:45 山岚2013 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 操作系统中的 CPU 和主内存(Main memory)都是稀缺资源,所有运行在当前操作系统的进程会共享系统中的 CPU 和内存资源,操作系统会使用 CPU 调度器分配 CPU 时间1并引入虚拟内存系统以管理物理内存,本文会分析操作系统为什么需要虚拟内存。 在回答虚拟内存存在的必要性之前,我们需要理 阅读全文
posted @ 2022-10-17 10:54 山岚2013 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 首先,我们知道MMU的作用是把虚拟地址转换成物理地址。虚拟地址和物理地址的映射关系存储在页表中,而现在页表又是分级的。64位系统常见的配置是4级页表,就以4级页表为例说明。分别是PGD、PUD、PMD、PTE四级页表。 在硬件上会有一个叫做页表基地址寄存器,它存储PGD页表的首地址。MMU就是根据页 阅读全文
posted @ 2022-10-09 14:58 山岚2013 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 科学计算用优化 经过实验证明这个命令优化效果最好,把我的 1.2S 的 FFT 优化到了 0.4S使用 pragma 命令优化程序: #pragma GCC optimize("Ofast,no-stack-protector") 实用优化项: #pragma GCC optimize("Ofast 阅读全文
posted @ 2022-09-28 12:32 山岚2013 阅读(3101) 评论(0) 推荐(0) 编辑
摘要: 构造时直接使用初始化列表 T object { arg1, arg2, ... }; (1) T { arg1, arg2, ... } (2) new T { arg1, arg2, ... } (3) Class { T member { arg1, arg2, ... }; }; (4) Cl 阅读全文
posted @ 2022-09-26 20:48 山岚2013 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 1. lmBench 介绍 Lmbench是一套简易,可移植的,符合ANSI/C标准为UNIX/POSIX而制定的微型测评工具。一般来说,它衡量两个关键特征:反应时间和带宽。Lmbench旨在使系统开发者深入了解关键操作的基础成本。 lmbench是个用于评价系统综合性能的多平台开源benchmar 阅读全文
posted @ 2022-09-05 10:19 山岚2013 阅读(384) 评论(0) 推荐(0) 编辑
摘要: sudo apt install gcc-9 g++-9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /us 阅读全文
posted @ 2022-08-16 23:24 山岚2013 阅读(864) 评论(0) 推荐(0) 编辑
摘要: sudo dpkg --add-architecture i386 sudo apt install libc6:i386 libstdc++6:i386 sudo apt-get update sudo apt install libncurses5-dev lib32z1 阅读全文
posted @ 2022-08-16 23:13 山岚2013 阅读(2223) 评论(0) 推荐(0) 编辑
摘要: 概念 std::ref :针对std::thread,需要把实参显式转换为引用类型; std::move :无条件把参数转换为右值;但是右值赋值给新变量时,实际还要看是否满足右值条件,如const std::string&& 赋值后,实际调用的是左值构造/赋值; std::forward :根据实参 阅读全文
posted @ 2022-08-10 21:18 山岚2013 阅读(146) 评论(0) 推荐(0) 编辑
摘要: #include <algorithm> #include <array> #include <iostream> #include <iterator> #include <random> template <class Iter> void fill_with_random_int_values 阅读全文
posted @ 2022-08-03 16:24 山岚2013 阅读(214) 评论(0) 推荐(0) 编辑
摘要: shared_ptr std::shared_ptr<int> sp1 = new int(); // shared count = 1, weak count = 0 std::shared_ptr<int> sp2(sp1); // shared count = 2, weak count = 阅读全文
posted @ 2022-07-23 10:21 山岚2013 阅读(88) 评论(0) 推荐(0) 编辑
摘要: C++中的 volatile, atomic, memory barrier 应用场景对比 | -- | volatile | memory barrier | atomic | | : : | :--: | :--: | :--: | | 抑制编译器重排 | Yes | Yes | Yes | | 阅读全文
posted @ 2022-07-22 15:43 山岚2013 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 1. start-group 编译选项 假设程序x依赖三个静态库:libX1.a、libX2.a和libX3.a,而libX2.a又依赖libX1.a,libX3.a依赖libX2.a和libX1.a,正常情况下的CMakeLists.txt格式如下 target_link_libraries( x 阅读全文
posted @ 2022-07-13 16:27 山岚2013 阅读(2595) 评论(0) 推荐(0) 编辑
摘要: omit-frame-pointer 开启该选项,主要是用于去掉所有函数SFP(Stack Frame Pointer)的,即在函数调用时不保存栈帧指针SFP,代价是不能通过backtrace进行调试根据堆栈信息了。通过去掉SFP,可以提高程序运行速度,达到优化程序的目的。如果要打开栈指针,使用 - 阅读全文
posted @ 2022-07-01 17:14 山岚2013 阅读(1275) 评论(0) 推荐(0) 编辑
摘要: Conda环境安装 OpenCV pip install opencv-python opencv-contrib-python -i https://mirrors.aliyun.com/pypi/simple/ #验证是否安装成功 python >> import cv2 >> print(cv 阅读全文
posted @ 2022-06-21 11:32 山岚2013 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 查看串口设备 # Ubuntu 22.04自动卸载CH341串口 sudo apt remove brltty ls -l /dev/ttyUSB0 # 查看串口设备添加信息 sudo dmesg | grep ttyUSB0 给普通用户访问权限 sudo chmod 666 /dev/ttyUSB 阅读全文
posted @ 2022-06-14 20:44 山岚2013 阅读(514) 评论(0) 推荐(0) 编辑
摘要: PC主机安装必要软件 sudo apt-get install bison flex expect-dev build-essential m4 autoconf automake texi2html 源码下载 gdb ncurses termcap 编译termcap wget https://f 阅读全文
posted @ 2022-05-31 15:29 山岚2013 阅读(239) 评论(0) 推荐(0) 编辑