1、gdb -p pid 当前进程会挂起
2、pstack -p pid or gstack -p pid
3、gcore [-o filename] pid 然后用gdb调试。
2011/12/07
获取正在运行 进程的函数栈
gcc march参数 cpu相关
-
-
CPU Family Rec. system gcc Rec. ports compiler
-
Intel Atom D525 atom CPUTYPE=core2 (*) gcc45 -march=atom
-
Intel Xeon 3065 core2 CPUTYPE=core2 (*) gcc45
-
Intel Xeon E5310 core2 CPUTYPE=core2 (*) gcc45 -march=core2
-
Intel Xeon E5405 core2 no CPUTYPE gcc45 -march=core2
-
Intel Core i7-920 nehalem CPUTYPE=nocona gcc45 -march=nocona
-
Intel Xeon X3450 nehalem CPUTYPE=nocona gcc45 -march=nocona
-
Intel Xeon E5620 nehalem CPUTYPE=nocona gcc45 -march=nocona
-
AMD Opteron 6128 barcelona CPUTYPE=opteron-ssse3 gcc45 -march=barcelona
-
http://blog.vx.sk/archives/25-FreeBSD-Compiler-Benchmark-gcc-base-vs-gcc-ports-vs-clang.html
2011/07/31
关于curl multi的bug
http://curl.haxx.se/mail/lib-2010-06/0030.html
http://sourceforge.net/tracker/index.php?func=detail&aid=2501457&group_id=976&atid=100976
2011/02/15
The TIME-WAIT state in TCP and Its Effect on Busy Servers
2010/10/15
自增运算php & c
以前面试的时候老有人问 ++i 和 i++ 的问题, 每每心里都在暗暗想…,
1、这俩东西功能不一样。
2、 写代码的时候多放些注意力在别的地方比在这个地方纠结强。
我总认为, 可读性和扩展性好的代码 比 一堆 又烂又快的代码好。
3、不免俗的研究了一下。
对于C
-
#include "stdio.h"
-
-
int main(int argc, char *argv[]) {
-
int i = 0;
-
-
int a = 0;
-
int b = 0;
-
-
a = i++;
-
b= ++i;
-
-
i++;
-
++i;
-
-
}
汇编后
-
.file "test.c"
-
.section .rodata
-
.LC0:
-
.string "%d"
-
.text
-
.globl main
-
.type main, @function
-
main:
-
pushl %ebp
-
movl %esp, %ebp
-
andl $-16, %esp
-
subl $32, %esp
-
movl $0, 28(%esp)
-
movl $0, 24(%esp)
-
movl $0, 20(%esp)
-
movl 28(%esp), %eax
-
movl %eax, 24(%esp)
-
addl $1, 28(%esp)
-
addl $1, 28(%esp)
-
movl 28(%esp), %eax
-
movl %eax, 20(%esp)
-
addl $1, 28(%esp)
-
addl $1, 28(%esp)
-
movl $.LC0, %eax
-
movl 24(%esp), %edx
-
movl %edx, 4(%esp)
-
movl %eax, (%esp)
-
call printf
-
movl $.LC0, %eax
-
movl 20(%esp), %edx
-
movl %edx, 4(%esp)
-
movl %eax, (%esp)
-
call printf
-
leave
-
ret
-
.size main, .-main
-
.ident "GCC: (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5"
-
.section .note.GNU-stack,"",@progbits
可以看出没有赋值操作的 自增运算 不管是 ++i 还是i++ 都会被会变成一条相同的汇编(addl $1, 28(%esp))
如果有赋值操作的时候 汇编的条数是一样的 只是 几条语句的顺序不一样
所以C中这两种格式区别仅在于生成的值, 所以在仅使用它们的副作用时, 二者 完全一样,
http://c-faq-chn.sourceforge.net/ccfaq/node46.htm
但是 C++同学的表现是不一样的有兴趣的同学google一下,
悲剧 刚才写的一段代码丢了
简单说下php同学吧
有兴趣的通许参阅一下php源码 大概在这个文件里zend_compile.c
stackoverflow上有一些简单的说明:
http://stackoverflow.com/questions/1756015/whats-the-difference-between-i-and-i-in-php
原文有一段
:For further clarification, post-incrementation in PHP has been documented as storing a temporary variable which attributes to this 10% overhead vs. pre-incrementation.
是说 post-incrementation i++ 比pre-incrementation ++i 花费多10% 来存储一个临时变量。
2010/10/06
http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1/
http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1/
2010/08/25
关于 ubuntu 下 eclipse 代码编辑区域 在代码 补全 后不能编辑 的笔记
以前没有发现这个问题, 今天下了一个eclipse3.6 装了之后,发现编辑代码时,补全之后 编辑器貌似还在获得焦点,
但是不能type 字符,很奇怪,
google 了一下,没有找到,解决方案,
这次baidu很出息,找到是scim问题, 据说还是一个老问题,
修改
/etc/X11/xinit/xinput.d/scim
将原来的
GTK_IM_MODULE=xim
QT_IM_MODULE=xim
改成
GTK_IM_MODULE=scim
QT_IM_MODULE=scim
之前在切换 terminal 的之后, 开始的时候键盘反应慢的问题也解决了。
2010/07/25
Twitter 更新 for 2010-07-25
- firefox + foxyproxy + ssh 比vpn 好用多了 #
Powered by Twitter Tools
Twitter 更新 for 2010-07-25
- firefox + foxyproxy + ssh 比vpn 好用多了 #
Powered by Twitter Tools