我的站点

一个系统软件工程师的随手涂鸦

Author: nanxiao (Page 1 of 71)

git小技巧(14)——“git pull” 强行覆盖local repository

参考自stackoverflow

git fetch --all
git reset --hard origin/<branch_name>

Perf笔记(八)——hotspot

hotspotKDAB发布的一个新的分析perf.data的工具。除了比perf report更直观外,其最大看点就是集成了火焰图,也就是FlameGraph。相信hotspot会对分析性能提供更大的帮助。

P.S.对比一下perf report

perf
hotspot

hotspot

2017年6月总结

技术方面:
(1)工作上完成了两个任务:
a)基于HElib实现了一个新的项目的POC
b)把现有的单机版系统改造成了分布式。
下周一会把上个月的成果做一个demo

(2)Rust语言还在学习中,写了两个练手小项目:streamRustTCPFramework

(3)重操旧业找了一台机器搭建了FreeBSD系统,除了完成两篇FreeBSD-101-Hacks以外,还发布了一篇Unix公众号文章:FreeBSD操作系统上获取CPU信息

(4)更新了沉寂半年的ChinaDTrace公众号,写了3文章

生活方面:
(1)又一位同事离开了公司,送别那天我们一起吃的自助。自助味道不错,价格也不是太贵,可以接受。总体来说性价比不错。同时也希望有新鲜的血液在7月份补充公司进来。

(2)月中休了一个3天小长假,出去远足了一次。

(3)这个月休闲的时候看了很多民国相关的视频。

(4)借了一本有关商贸口语的英语书,读了一半。

 

附:这月看过的技术视频:

Introduction to OpenMP – Tim Mattson (Intel)

What is FreeBSD by Gavin Atkinson

CppCon 2016: Tim Haines “Improving Performance Through Compiler Switches…”

The LLDB Debugger in FreeBSD by Ed Maste

FOSDEM 2017: gobpf – utilizing eBPF from Go

Sasha Goldshtein – Modern Linux Tracing Landscape

C++Now 2017: Niko Matsakis “Rust: Hack Without Fear!”

How to get one of those Open Source jobs

CMake

Easiest CMake Project Ever

Infrastructure 2017 – Alfonso Acosta – High-performance Linux monitoring with eBPF

Berkeley Packet Filter – Introduction

git小技巧(13)——git add 总结

选自stackoverflow

Capture

git小技巧(12)——编辑配置文件

通过手动修改配置文件,可以达到很多目的(比如改变upstream):

git config -e

参考自stackoverflow

FreeBSD操作系统上获取CPU信息

FreeBSD既没有GNU/Linux操作系统上的/proc/cpuinfo文件,也不提供lscpu命令(其实lscpu也是访问的/proc/cpuinfo文件)。因此在FreeBSD上想了解当前机器的CPU信息,需要费点小周折:

(1)使用sysctl命令:

# sysctl hw.model hw.machine hw.ncpu
hw.model: Intel(R) Core(TM)2 CPU          6600  @ 2.40GHz
hw.machine: amd64
hw.ncpu: 2

(2)读取/var/run/dmesg.boot文件:

# grep -i cpu /var/run/dmesg.boot
CPU: Intel(R) Core(TM)2 CPU          6600  @ 2.40GHz (2400.05-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
est1: <Enhanced SpeedStep Frequency Control> on cpu1
SMP: AP CPU #1 Launched!

(3)通过dmidecode命令获得CPUcache信息:

# dmidecode -t processor -t cache
# dmidecode 3.0
Scanning /dev/mem for entry point.
SMBIOS 2.4 present.

Handle 0x0004, DMI type 4, 35 bytes
Processor Information
        Socket Designation: LGA 775
        Type: Central Processor
        Family: Pentium 4
        Manufacturer: Intel
        ID: F6 06 00 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 15, Stepping 6
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
......
Handle 0x0005, DMI type 7, 19 bytes
Cache Information
        Socket Designation: L1-Cache
        Configuration: Enabled, Not Socketed, Level 1
        Operational Mode: Write Back
        Location: Internal
        Installed Size: 32 kB
        Maximum Size: 32 kB
......

参考资料:
FreeBSD CPU Information Command
What is the equivalent of /proc/cpuinfo on FreeBSD v8.1?

2017年5月总结

工作/技术方面:
休假回来,这个月就是全力以赴的投入工作。除了开发了一个小feature外,主要精力都放在调试系统性能。技术方面侧重在perfOpenMPRust语言上。

生活方面:
每个周末都出去溜达,找美食,逛商场,其乐融融。晚上就看纪录片:努尔哈赤袁崇焕之死义和团西安事变

这月看过的技术视频:

CppCon 2016: Bjarne Stroustrup “The Evolution of C++ Past, Present and Future”

Rust: Removing the Sharp Edges from Systems Programming – Jonathan Creekmore, Star Lab

CppCon 2016: Howard Hinnant “A <chrono> Tutorial”

Python, Linkers, and Virtual Memory

Linux Profiling at Netflix

Keynote – Rust: confident, productive systems programming by Aaron Turon

Netdev 0.1 – Tutorial on perf Usage

 

Perf笔记(七)——perf trace

perf trace有类似于strace功能,可以实时监控程序的系统调用:

# perf trace ./a.out
 0.032 ( 0.002 ms): a.out/7673 brk(                                                                  ) = 0x1e6b000
 0.051 ( 0.005 ms): a.out/7673 access(filename: 0xb7c1cb00, mode: R                                  ) = -1 ENOENT No such file or directory
 0.063 ( 0.005 ms): a.out/7673 open(filename: 0xb7c1a7b7, flags: CLOEXEC                             ) = 3
 0.070 ( 0.002 ms): a.out/7673 fstat(fd: 3, statbuf: 0x7ffffb72bc80                                  ) = 0
 0.073 ( 0.004 ms): a.out/7673 mmap(len: 38436, prot: READ, flags: PRIVATE, fd: 3                    ) = 0x7f18b7e15000
 0.079 ( 0.001 ms): a.out/7673 close(fd: 3                                                           ) = 0
 0.087 ( 0.005 ms): a.out/7673 open(filename: 0xb7e21ec0, flags: CLOEXEC                             ) = 3
 0.093 ( 0.003 ms): a.out/7673 read(fd: 3, buf: 0x7ffffb72be28, count: 832                           ) = 832
 0.099 ( 0.002 ms): a.out/7673 fstat(fd: 3, statbuf: 0x7ffffb72bcc0                                  ) = 0
 0.102 ( 0.003 ms): a.out/7673 mmap(len: 8192, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS, fd: -1    ) = 0x7f18b7e13000
 0.110 ( 0.004 ms): a.out/7673 mmap(len: 2283024, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3   ) = 0x7f18b79cf000
 0.116 ( 0.007 ms): a.out/7673 mprotect(start: 0x7f18b79fc000, len: 2093056                          ) = 0
 0.125 ( 0.005 ms): a.out/7673 mmap(addr: 0x7f18b7bfb000, len: 8192, prot: READ|WRITE, flags: PRIVATE|DENYWRITE|FIXED, fd: 3, off: 180224) = 0x7f18b7bfb000
 0.142 ( 0.002 ms): a.out/7673 close(fd: 3                                                           ) = 0
 0.153 ( 0.006 ms): a.out/7673 open(filename: 0xb7e134c0, flags: CLOEXEC                             ) = 3
 0.161 ( 0.003 ms): a.out/7673 read(fd: 3, buf: 0x7ffffb72bdf8, count: 832                           ) = 832
 0.165 ( 0.002 ms): a.out/7673 fstat(fd: 3, statbuf: 0x7ffffb72bc90                                  ) = 0
 0.169 ( 0.005 ms): a.out/7673 mmap(len: 2216432, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3   ) = 0x7f18b77b1000
......

Perf笔记(六)——编译和使用最新版本的perf

AcmeLinux perfmaintainer,他的perf/core分支包含了perf工具的最新功能。所以如果想体验最新版本的perf,可以下载和编译Acmeperf

git clone git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux -b perf/core
cd linux/tools/perf
make

Perf笔记(五)——显示具体函数的profiling信息

在使用perf report命令显示profiling的结果时:

1
a可以显示当前函数的profiling信息以及汇编指令:

2

Page 1 of 71

Powered by WordPress & Theme by Anders Norén