system

How to use Flash Cache on Redhat (not OEL)

August 26, 2013 Architect, hardware, linux, system No comments

QQ图片20130826223025

By ask Surachart for help

Test: Flash Cache on 11gR2 + RHEL

A Flash Cache (11gR2) is supported by OEL or Solaris. If Want To use RHEL(Example: RHEL 5.3)

Patched 8974084 before

SQL> startup
ORA-00439: feature not enabled: Server Flash Cache
ORA-01078: failure in processing system parameters

TEST: ***use "strace" commnad to trace system & signals***
$ strace -o /tmp/file01.txt -f sqlplus '/ as sysdba' <<EOF
startup
EOF

Find 2 points:
1. about /etc/*-release files.

3884  open("/etc/enterprise-release", O_RDONLY) = 8
3884  read(8, "Enterprise Linux Enterprise Linu"..., 255) = 64


2. about "rpm" cammand
32278 execve("/bin/rpm", ["/bin/rpm", "-qi", "--info", "enterprise-release"], [/* 25 vars */] <unfinished ...>
Next, it greps for “66ced3de1e5e0159” from the following output…
 
try to check on Enterprise Linux.

$ rpm -qi --info "enterprise-release"

Name        : enterprise-release           Relocations: (not relocatable)
Version     : 5                                 Vendor: Oracle USA
Release     : 0.0.17                        Build Date: Wed 21 Jan 2009 06:00:33 PM PST
Install Date: Mon 11 May 2009 11:19:45 AM PDT      Build Host: ca-build10.us.oracle.com
Group       : System Environment/Base       Source RPM: enterprise-release-5-0.0.17.src.rpm
Size        : 59030                            License: GPL
Signature   : DSA/SHA1, Wed 21 Jan 2009 06:56:48 PM PST, Key ID 66ced3de1e5e0159
Summary     : Enterprise Linux release file
Description :
System release and information files
Name        : enterprise-release           Relocations: (not relocatable)
Version     : 5                                 Vendor: Oracle USA
Release     : 0.0.17                        Build Date: Wed 21 Jan 2009 06:00:33 PM PST
Install Date: Mon 11 May 2009 11:19:45 AM PDT      Build Host: ca-build10.us.oracle.com
Group       : System Environment/Base       Source RPM: enterprise-release-5-0.0.17.src.rpm
Size        : 59030                            License: GPL
Signature   : DSA/SHA1, Wed 21 Jan 2009 06:56:48 PM PST, Key ID 66ced3de1e5e0159
Summary     : Enterprise Linux release file
Description :
System release and information files


Fixed:
1. FAKE *-release file (don't forgot backup before)
- Modify /etc/redhat-release + /etc/enterprise-release files.
$ cat /etc/redhat-release
Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)

$ cat /etc/enterprise-release
Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)

2. FAKE rpm to check "enterprise-release" package.
- Modify /bin/rpm
#  mv /bin/rpm /bin/rpm.bin

# vi /bin/rpm
#!/bin/sh
if [ "$3" = "enterprise-release" ]
then
     echo 66ced3de1e5e0159
else
      exec /bin/rpm.bin "$*"
fi

# chmod 755 /bin/rpm

Try... Again -> startup database.

SQL> startup

linux tools part 8– Monitoring Reads and Writes to a File and device

May 13, 2013 linux, system No comments

1.配合使用systemtap 监控系统对于文件的读写:

[root@db-42 systemtap]# uname -a
Linux db-42 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@db-42 systemtap]# more inodewatch.stp 
#! /usr/bin/env stap

probe vfs.write, vfs.read
{
  # dev and ino are defined by vfs.write and vfs.read
  if (dev == MKDEV($1,$2) # major/minor device
      && ino == $3)
    printf ("%s(%d) %s 0x%x/%u\n",
      execname(), pid(), probefunc(), dev, ino)
}

inodewatch.stp takes the following information about the file as arguments on the command line:
The file's major device number.
The file's minor device number.
The file's inode number.

[root@db-42 ~]# stat -c '%D %i' test.dat 
803 1831440


[root@db-42 systemtap]# stap  inodewatch.stp  0x8 0x3  1831440

dd(27257) vfs_write 0x800003/1831440
dd(27257) vfs_write 0x800003/1831440
dd(27257) vfs_write 0x800003/1831440
dd(27257) vfs_write 0x800003/1831440
dd(27257) vfs_write 0x800003/1831440
dd(27257) vfs_write 0x800003/1831440
dd(27257) vfs_write 0x800003/1831440

[root@db-42 systemtap]# ps -ef |grep 27257
root     27257 27217 74 14:42 pts/6    00:00:14 dd if /dev/zero of /root/test.dat bs 4K count 10000000

——对于 block device的读写 如下:

[root@db-42 ~]# stat -c "0x%D" /dev/sda11
0x11
[root@db-42 ~]# fdisk -l 

Disk /dev/sda: 1798.6 GB, 1798651772928 bytes
47 heads, 36 sectors/track, 2076236 cylinders
Units = cylinders of 1692 * 512 = 866304 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         242      204714   83  Linux
/dev/sda2             243      161225   136191618   82  Linux swap / Solaris
/dev/sda3          161226      223198    52429158   83  Linux
/dev/sda4          223199     2076236  1567670148    5  Extended
/dev/sda5          223199      247987    20971476   83  Linux
/dev/sda6          247988      272776    20971476   83  Linux
/dev/sda7          272777      390980   100000566   83  Linux
/dev/sda8          390981      414068    19532430   83  Linux
/dev/sda9          414069      437156    19532430   83  Linux
/dev/sda10         437157      460244    19532430   83  Linux
/dev/sda11         460245      483332    19532430   83  Linux
[root@db-42 ~]# more traceio2.stp
#! /usr/bin/env stap

global device_of_interest

probe begin {
  /* The following is not the most efficient way to do this.
      One could directly put the result of usrdev2kerndev()
      into device_of_interest.  However, want to test out
      the other device functions */
  dev = usrdev2kerndev($1)
  device_of_interest = MKDEV(MAJOR(dev), MINOR(dev))
}

probe vfs.write, vfs.read
{
  if (dev == device_of_interest)
    printf ("%s(%d) %s 0x%x\n",
            execname(), pid(), probefunc(), dev)
}
[root@db-42 ~]# stap traceio2.stp  0x11


dd(30266) vfs_read 0x11
dd(30266) vfs_write 0x11
dd(30266) vfs_read 0x11
dd(30266) vfs_write 0x11
dd(30266) vfs_read 0x11
dd(30266) vfs_write 0x11
dd(30266) vfs_read 0x11
dd(30266) vfs_write 0x11
dd(30266) vfs_read 0x11
dd(30266) vfs_write 0x11
dd(30266) vfs_read 0x11
dd(30266) vfs_write 0x11

[oracle@db-42 ~]$ ps -ef |grep  30266
root     30266 27217 99 16:40 pts/6    00:00:32 dd if /dev/zero of /dev/sda11 bs 4K count 100000000

2.直接使用lsof

[root@db-42 ~]# lsof  /root/test.dat 
[root@db-42 ~]# lsof  /root/test.dat 
COMMAND   PID USER   FD   TYPE DEVICE      SIZE    NODE NAME
dd      30756 root    1w   REG    8,3 926494720 1831440 /root/test.dat
[root@db-42 ~]# lsof  /dev/sda
sda    sda1   sda10  sda11  sda2   sda3   sda4   sda5   sda6   sda7   sda8   sda9   
[root@db-42 ~]# lsof  /dev/sda11  
COMMAND   PID USER   FD   TYPE DEVICE SIZE    NODE NAME
dd      30761 root    1w   BLK   8,11      4548595 /dev/sda11
[root@db-42 ~]# lsof  version
lsof: status error on version: No such file or directory
lsof 4.78
 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
 latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
 latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
 usage: [-?abhlnNoOPRstUvVX] [+|-c c] [+|-d s] [+D D] [+|-f]
 [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]]
 [-p s] [+|-r [t]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [-Z [Z]] [--] [names]
Use the ``-h'' option to get more help information.

linux tools part 7– Monitor socket activity

April 23, 2013 linux, system No comments

systemtap发行版本提供了socktop,用于监控socket套接字之间的通信,具体如下:

[root@db-42 ~]# socktop -h
USAGE: socktop [-d] [-i interval] [-N num] [-P protocol]... [-f family]...
               [-t stype]... [-n pname]... [-p pid]... [-u username]... [-h]
    -d           # print network device traffic (default: off)
    -i interval  # interval in seconds between printing (default: 5)
    -N num       # number of top processes and devices to print (default: 10)
    -f family    # this protocol family only (default: all)
    -P protocol  # this protocol only (default: all)
    -t stype     # this socket type only (default: all)
    -n pname     # this process name only (default: all)
    -p pid       # this process ID only (default: all)
    -u username  # this user only (default: all)
    -h           # print this help text

Protocol Families:
    LOCAL, INET, INET6, IPX, NETLINK, X25, AX25, ATMPVC, APPLETALK, PACKET

Protocols:
    TCP, UDP, SCTP, IP, FC, ... (see /etc/protocols for complete list)

Socket Types:
    STREAM, DGRAM, RAW, RDM, SEQPACKET, DCCP, PACKET
    

Description

socket() creates an endpoint for communication and returns a descriptor.

The domain argument specifies a communication domain; this selects the protocol family which will be used for communication. These families are
defined in <sys/socket.h>. The currently understood formats include:

Name

Purpose

Man page

AF_UNIX, AF_LOCAL

Local communication

unix(7)

AF_INET

IPv4 Internet protocols

ip(7)

AF_INET6

IPv6 Internet protocols

ipv6(7)

AF_IPX

IPX – Novell protocols

AF_NETLINK

Kernel user interface device

netlink(7)

AF_X25

ITU-T X.25 / ISO-8208 protocol

x25(7)

AF_AX25

Amateur radio AX.25 protocol

AF_ATMPVC

Access to raw ATM PVCs

AF_APPLETALK

Appletalk

ddp(7)

AF_PACKET

Low level packet interface

packet(7)

具体安装过程如下,在安装systemtap的前提下:

[root@db-42 ~]# uname -r
2.6.18-194.el5
[root@db-42 ~]# wget ftp://bo.mirror.garr.it/pub/1/slc/updates/slc5X/x86_64/debug/kernel-debuginfo-2.6.18-194.el5.x86_64.rpm
--2013-04-23 11:38:06--  ftp://bo.mirror.garr.it/pub/1/slc/updates/slc5X/x86_64/debug/kernel-debuginfo-2.6.18-194.el5.x86_64.rpm
           => `kernel-debuginfo-2.6.18-194.el5.x86_64.rpm'
Resolving bo.mirror.garr.it... 193.206.140.34, 2001:760:ffff:b0::34
Connecting to bo.mirror.garr.it|193.206.140.34|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /pub/1/slc/updates/slc5X/x86_64/debug ... done.
==> SIZE kernel-debuginfo-2.6.18-194.el5.x86_64.rpm ... 181856666
==> PASV ... done.    ==> RETR kernel-debuginfo-2.6.18-194.el5.x86_64.rpm ... done.
Length: 181856666 (173M)

100%[========================================================================================================================================>] 181,856,666 5.07M/s   in 5m 33s  

2013-04-23 11:43:48 (533 KB/s) - `kernel-debuginfo-2.6.18-194.el5.x86_64.rpm' saved [181856666]

[root@db-42 ~]# rpm -ivh kernel-debuginfo-2.6.18-194.el5.x86_64.rpm 
warning: kernel-debuginfo-2.6.18-194.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:kernel-debuginfo       ########################################### [100%]
   
[root@db-42 ~]# wget ftp://bo.mirror.garr.it/pub/1/slc/updates/slc5X/x86_64/debug/kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm
--2013-04-23 11:38:50--  ftp://bo.mirror.garr.it/pub/1/slc/updates/slc5X/x86_64/debug/kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm
           => `kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm'
Resolving bo.mirror.garr.it... 193.206.140.34, 2001:760:ffff:b0::34
Connecting to bo.mirror.garr.it|193.206.140.34|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /pub/1/slc/updates/slc5X/x86_64/debug ... done.
==> SIZE kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm ... 32845933
==> PASV ... done.    ==> RETR kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm ... done.
Length: 32845933 (31M)

100%[========================================================================================================================================>] 32,845,933  52.6K/s   in 45s     

2013-04-23 11:39:41 (711 KB/s) - `kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm' saved [32845933]

[root@db-42 ~]# rpm -ivh kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm 
warning: kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:kernel-debuginfo-common########################################### [100%]

eg:

session 1:

SQL> insert into t10 select * from t10;

76074 rows created.

SQL> /

152148 rows created.

SQL> /

304296 rows created.

SQL> /

608592 rows created.

SQL> /

1217184 rows created.

SQL> /

2434368 rows created.

[root@db-42 ~]# socktop  -d -i 5 
======================= Tue Apr 23 11:50:07 2013 ========================
------------------------------- PROCESSES -------------------------------
PID   UID     #SEND   #RECV SEND_KB RECV_KB PROT FAMILY   COMMAND        
28990 1001    18190   18190  130058  128882 TCP  INET     extract        
29003 1100    18185   18185  128881  130058 TCP  INET6    oracle         
29001 1100        5       5       1       0 TCP  INET6    oracle         
2376  1001        1       0       1       0 TCP  INET6    sshd           
23653 1001        3       0       0       0 TCP  INET     extract        
28834 1001        6       0       0       0 UDP  INET6    oracle         
28814 1001        0       6       0       0 UDP  INET6    oracle         
-------------------------------- DEVICES --------------------------------
DEV             #XMIT         #RECV         XMIT_KB         RECV_KB
lo              49559         49559          262136          261458
eth0                9             8               1               0
=========================================================================


[root@db-42 ~]# ps -ef |grep 29003
root      5682  2418  0 12:53 pts/0    00:00:00 grep 29003
grid     29003     1  0 Mar21 ?        00:04:52 oracle+ASM (LOCAL=NO)


[root@db-42 ~]# socktop -f LOCAL -i 5 -d

======================= Tue Apr 23 11:56:03 2013 ========================
------------------------------- PROCESSES -------------------------------
PID   UID     #SEND   #RECV SEND_KB RECV_KB PROT FAMILY   COMMAND        
4862  1100        3       4       0       1 IP   LOCAL    lsnrctl        
21128 1100        4       3       1       0 IP   LOCAL    tnslsnr        
-------------------------------- DEVICES --------------------------------
DEV             #XMIT         #RECV         XMIT_KB         RECV_KB
lo                 85            85             348             347
eth0               10             9               1               0
=========================================================================

可以清楚的看到在batch insert 过程中ASM process正处于频繁的活动中。

gdb 调试TPCC 一例

March 19, 2013 linux, system No comments

TPCC对mysql 5.5.27做一次性能测试时遭遇 Segmentation fault,gdb调试记录之:

[root@db-81 ~]# uname -a 
Linux db-81 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@db-81 ~]# more /proc/meminfo |grep Total
MemTotal:     49455412 kB
HighTotal:           0 kB
LowTotal:     49455412 kB
SwapTotal:    65537156 kB
VmallocTotal: 34359738367 kB
HugePages_Total:     0
[root@db-81 ~]# more /proc/cpuinfo |grep "processor" |wc -l
16
[root@db-81 ~]# more /proc/cpuinfo |grep  "model name"
model name	: AMD Opteron(tm) Processor 6128
[root@db-13 src]# export C_INCLUDE_PATH=/data/mysql/include:/lib/:lib64:$LD_LIBRARY_PATH:$PATH
[root@db-13 src]# export PATH=/data/mysql/bin:/lib:/lib64:$LD_LIBRARY_PATH:$PATH:$PATH
[root@db-13 src]# export LD_LIBRARY_PATH=/data/mysql/lib:$PATH
[root@db-13 src]# make all
cc -w -O2 -g -I. `mysql_config --include`  -c load.c
cc -w -O2 -g -I. `mysql_config --include`  -c support.c
cc load.o support.o `mysql_config --libs_r` -lrt -o ../tpcc_load
cc -w -O2 -g -I. `mysql_config --include`  -c main.c
cc -w -O2 -g -I. `mysql_config --include`  -c spt_proc.c
cc -w -O2 -g -I. `mysql_config --include`  -c driver.c
cc -w -O2 -g -I. `mysql_config --include`  -c sequence.c
cc -w -O2 -g -I. `mysql_config --include`  -c rthist.c
cc -w -O2 -g -I. `mysql_config --include`  -c neword.c
cc -w -O2 -g -I. `mysql_config --include`  -c payment.c
cc -w -O2 -g -I. `mysql_config --include`  -c ordstat.c
cc -w -O2 -g -I. `mysql_config --include`  -c delivery.c
cc -w -O2 -g -I. `mysql_config --include`  -c slev.c
cc main.o spt_proc.o driver.o support.o sequence.o rthist.o neword.o payment.o ordstat.o delivery.o slev.o `mysql_config --libs_r` -lrt -o ../tpcc_start

[root@db-13 tpcc-mysql]# ./tpcc_start -h 127.0.0.1 -d test -u root -p ‘yihaodian’ -w 30 -c 60 -r 60 -l 1000 -f mysql_tpcc_20130319
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
option h with value ‘127.0.0.1’
option d with value ‘test’
option u with value ‘root’
option p with value ‘yihaodian’
option w with value ’30’
option c with value ’60’
option r with value ’60’
option l with value ‘1000’
option f with value ‘mysql_tpcc_20130319’

[server]: 127.0.0.1
[port]: 3306
[DBname]: test
[user]: root
[pass]: yihaodian
[warehouse]: 30
[connection]: 60
[rampup]: 60 (sec.)
[measure]: 1000 (sec.)
Segmentation fault
[root@db-13 tpcc-mysql]# ./tpcc_start
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************

[server]:
[port]: 3306
[DBname]: tpcc
[user]:
[pass]:
[warehouse]: 1
[connection]: 10
[rampup]: 10 (sec.)
[measure]: 20 (sec.)

RAMP-UP TIME.(10 sec.)
Segmentation fault

[root@db-13 tpcc-mysql]# strace ./tpcc_start
execve("./tpcc_start", ["./tpcc_start"], [/* 29 vars */]) = 0
brk(0)                                  = 0xddce000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ac29d63a000
uname({sys="Linux", node="db-13", ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ac29d63b000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/data/mysql/lib/tls/x86_64/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/data/mysql/lib/tls/x86_64", 0x7fff4f83cf60) = -1 ENOENT (No such file or directory)
open("/data/mysql/lib/tls/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/data/mysql/lib/tls", 0x7fff4f83cf60) = -1 ENOENT (No such file or directory)
open("/data/mysql/lib/x86_64/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/data/mysql/lib/x86_64", 0x7fff4f83cf60) = -1 ENOENT (No such file or directory)
open("/data/mysql/lib/libmysqlclient.so.18", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\345\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=6870358, ...}) = 0
mmap(NULL, 4577240, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2ac29d63c000
mprotect(0x2ac29d911000, 1048576, PROT_NONE) = 0
mmap(0x2ac29da11000, 540672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2d5000) = 0x2ac29da11000
mmap(0x2ac29da95000, 18392, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2ac29da95000
close(3)                                = 0
open("/data/mysql/lib/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/data/mysql/bin/tls/x86_64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/data/mysql/bin/tls/x86_64", 0x7fff4f83cf30) = -1 ENOENT (No such file or directory)
open("/data/mysql/bin/tls/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/data/mysql/bin/tls", 0x7fff4f83cf30) = -1 ENOENT (No such file or directory)
open("/data/mysql/bin/x86_64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/data/mysql/bin/x86_64", 0x7fff4f83cf30) = -1 ENOENT (No such file or directory)
open("/data/mysql/bin/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/data/mysql/bin", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/lib/tls/x86_64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib/tls/x86_64", 0x7fff4f83cf30) = -1 ENOENT (No such file or directory)
open("/lib/tls/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib/tls", 0x7fff4f83cf30)        = -1 ENOENT (No such file or directory)
open("/lib/x86_64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64", 0x7fff4f83cf30)     = -1 ENOENT (No such file or directory)
open("/lib/libpthread.so.0", O_RDONLY)  = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\230X\0004\0\0\0"..., 832) = 832
close(3)                                = 0
stat("/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/lib64/tls/x86_64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/tls/x86_64", 0x7fff4f83cf30) = -1 ENOENT (No such file or directory)
open("/lib64/tls/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/tls", 0x7fff4f83cf30)      = -1 ENOENT (No such file or directory)
open("/lib64/x86_64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/x86_64", 0x7fff4f83cf30)   = -1 ENOENT (No such file or directory)
open("/lib64/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240W\340\253?\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=145824, ...}) = 0
mmap(0x3fabe00000, 2204528, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3fabe00000
mprotect(0x3fabe16000, 2093056, PROT_NONE) = 0
mmap(0x3fac015000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x3fac015000
mmap(0x3fac017000, 13168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3fac017000
close(3)                                = 0
open("/data/mysql/lib/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/data/mysql/bin/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libm.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20$Z\0004\0\0\0"..., 832) = 832
close(3)                                = 0
open("/lib64/libm.so.6", O_RDONLY)      = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`>`\253?\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=615136, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ac29da9a000
mmap(0x3fab600000, 2629848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3fab600000
mprotect(0x3fab682000, 2093056, PROT_NONE) = 0
mmap(0x3fab881000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x81000) = 0x3fab881000
close(3)                                = 0
open("/data/mysql/lib/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/data/mysql/bin/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/librt.so.1", O_RDONLY)       = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200H\230\0004\0\0\0"..., 832) = 832
close(3)                                = 0
open("/lib64/librt.so.1", O_RDONLY)     = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \"\340\257?\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=53448, ...}) = 0
mmap(0x3fafe00000, 2132936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3fafe00000
mprotect(0x3fafe07000, 2097152, PROT_NONE) = 0
mmap(0x3fb0007000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x3fb0007000
close(3)                                = 0
open("/data/mysql/lib/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/data/mysql/bin/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libdl.so.2", O_RDONLY)       = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\372W\0004\0\0\0"..., 832) = 832
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY)     = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\16\240\253?\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=23360, ...}) = 0
mmap(0x3faba00000, 2109696, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3faba00000
mprotect(0x3faba02000, 2097152, PROT_NONE) = 0
mmap(0x3fabc02000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x3fabc02000
close(3)                                = 0
open("/data/mysql/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/data/mysql/bin/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340\317D\0004\0\0\0"..., 832) = 832
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY)      = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\332!\253?\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1717800, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ac29da9b000
mmap(0x3fab200000, 3498328, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3fab200000
mprotect(0x3fab34e000, 2093056, PROT_NONE) = 0
mmap(0x3fab54d000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14d000) = 0x3fab54d000
mmap(0x3fab552000, 16728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3fab552000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ac29da9c000
arch_prctl(ARCH_SET_FS, 0x2ac29da9c6d0) = 0
mprotect(0x3fab54d000, 16384, PROT_READ) = 0
mprotect(0x3fabc02000, 4096, PROT_READ) = 0
mprotect(0x3fb0007000, 4096, PROT_READ) = 0
mprotect(0x3fab881000, 4096, PROT_READ) = 0
mprotect(0x3fac015000, 4096, PROT_READ) = 0
mprotect(0x3fab01b000, 4096, PROT_READ) = 0
set_tid_address(0x2ac29da9c760)         = 25524
set_robust_list(0x2ac29da9c770, 0x18)   = 0
futex(0x7fff4f83da8c, FUTEX_WAKE_PRIVATE, 1) = 0
rt_sigaction(SIGRTMIN, {0x3fabe05380, [], SA_RESTORER|SA_SIGINFO, 0x3fabe0eb10}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x3fabe052b0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x3fabe0eb10}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 6), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ac29da9d000
write(1, "********************************"..., 40***************************************
) = 40
write(1, "*** ###easy### TPC-C Load Genera"..., 40*** ###easy### TPC-C Load Generator ***
) = 40
write(1, "********************************"..., 40***************************************
) = 40
write(1, "<Parameters>\n", 13<Parameters>
)          = 13
write(1, "     [server]: \n", 16     [server]: 
)       = 16
write(1, "     [port]: 3306\n", 18     [port]: 3306
)     = 18
write(1, "     [DBname]: tpcc\n", 20     [DBname]: tpcc
)   = 20
write(1, "       [user]: \n", 16       [user]: 
)       = 16
write(1, "       [pass]: \n", 16       [pass]: 
)       = 16
write(1, "  [warehouse]: 1\n", 17  [warehouse]: 1
)      = 17
write(1, " [connection]: 10\n", 18 [connection]: 10
)     = 18
write(1, "     [rampup]: 10 (sec.)\n", 25     [rampup]: 10 (sec.)
) = 25
write(1, "    [measure]: 20 (sec.)\n", 25    [measure]: 20 (sec.)
) = 25
rt_sigaction(SIGALRM, {0x4021c0, [], SA_RESTORER, 0x3fabe0eb10}, NULL, 8) = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "\253\224\300!", 4)             = 4
close(3)                                = 0
brk(0)                                  = 0xddce000
brk(0xddef000)                          = 0xddef000
mmap(NULL, 10489856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_32BIT, -1, 0) = 0x40dfb000
mprotect(0x40dfb000, 4096, PROT_NONE)   = 0
clone(child_stack=0x417fb250, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x417fb9d0, tls=0x417fb940, child_tidptr=0x417fb9d0) = 25525
futex(0x417fb9d0, FUTEX_WAIT, 25525, NULL) = 0
open("/proc/stat", O_RDONLY)            = 3
read(3, "cpu  4327497980 1619853 67702808"..., 8192) = 3722
close(3)                                = 0
open("/etc/nsswitch.conf", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1696, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaaab000
read(3, "#\n# /etc/nsswitch.conf\n#\n# An ex"..., 4096) = 1696
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x2aaaaaaab000, 4096)            = 0
open("/data/mysql/lib/libnss_files.so.2", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\37\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=53880, ...}) = 0
mmap(NULL, 2139432, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2aaaaaaac000
mprotect(0x2aaaaaab6000, 2093056, PROT_NONE) = 0
mmap(0x2aaaaacb5000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9000) = 0x2aaaaacb5000
close(3)                                = 0
mprotect(0x2aaaaacb5000, 4096, PROT_READ) = 0
open("/etc/services", O_RDONLY)         = 3
fcntl(3, F_GETFD)                       = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=362031, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaacb7000
read(3, "# /etc/services:\n# $Id: services"..., 4096) = 4096
read(3, "rotocol\nntp\t\t123/tcp\nntp\t\t123/ud"..., 4096) = 4096
read(3, "767/udp\nrsync\t\t873/tcp\t\t\t\t# rsyn"..., 4096) = 4096
read(3, "stmanager\ncvspserver\t2401/tcp\t\t\t"..., 4096) = 4096
close(3)                                = 0
munmap(0x2aaaaacb7000, 4096)            = 0
rt_sigaction(SIGPIPE, {0x1, [PIPE], SA_RESTORER|SA_RESTART, 0x3fab2302d0}, {SIG_DFL, [], 0}, 8) = 0
clone(child_stack=0x417fb250, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x417fb9d0, tls=0x417fb940, child_tidptr=0x417fb9d0) = 25526
mmap(NULL, 10489856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_32BIT, -1, 0) = 0x41ef1000
mprotect(0x41ef1000, 4096, PROT_NONE)   = 0
clone(child_stack=0x428f1250, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x428f19d0, tls=0x428f1940, child_tidptr=0x428f19d0) = 25527
mmap(NULL, 10489856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_32BIT, -1, 0) = 0x428f2000
mprotect(0x428f2000, 4096, PROT_NONE)   = 0
clone(child_stack=0x432f2250, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x432f29d0, tls=0x432f2940, child_tidptr=0x432f29d0) = 25528
+++ killed by SIGSEGV +++


GDB 调用

[root@db-13 tpcc-mysql]# gdb
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) file tpcc_start
Reading symbols from /tmp/tpcc-mysql/tpcc_start...done.
(gdb) run
Starting program: /tmp/tpcc-mysql/tpcc_start 
[Thread debugging using libthread_db enabled]
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
<Parameters>
     [server]: 
     [port]: 3306
     [DBname]: tpcc
       [user]: 
       [pass]: 
  [warehouse]: 1
 [connection]: 10
     [rampup]: 10 (sec.)
    [measure]: 20 (sec.)
[New Thread 0x40a00940 (LWP 27592)]
[Thread 0x40a00940 (LWP 27592) exited]
[New Thread 0x40a00940 (LWP 27593)]
[New Thread 0x41401940 (LWP 27594)]
[New Thread 0x41e02940 (LWP 27595)]
[New Thread 0x42803940 (LWP 27596)]
[New Thread 0x43204940 (LWP 27597)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x40a00940 (LWP 27593)]
my_stat (path=0x409ff750 "/usr/local/mysql/share/charsets/Index.xml", stat_area=0x409ff620, my_flags=0) at /pb2/build/sb_0-6421281-1342807431.83/mysql-5.5.27/mysys/my_lib.c:413
413	/pb2/build/sb_0-6421281-1342807431.83/mysql-5.5.27/mysys/my_lib.c: No such file or directory.
	in /pb2/build/sb_0-6421281-1342807431.83/mysql-5.5.27/mysys/my_lib.c
(gdb) 
(gdb) q
A debugging session is active.

	Inferior 1 [process 27589] will be killed.

Quit anyway? (y or n) y

删除 mysql.sock

[root@db-13 tmp]# rm mysql.sock 
rm: remove symbolic link `mysql.sock'? y

再次调用

[root@db-13 tpcc-mysql]# gdb
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) file tpcc_start
Reading symbols from /tmp/tpcc-mysql/tpcc_start...done.
(gdb) run
Starting program: /tmp/tpcc-mysql/tpcc_start 
[Thread debugging using libthread_db enabled]
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
<Parameters>
     [server]: 
     [port]: 3306
     [DBname]: tpcc
       [user]: 
       [pass]: 
  [warehouse]: 1
 [connection]: 10
     [rampup]: 10 (sec.)
    [measure]: 20 (sec.)
[New Thread 0x40a00940 (LWP 28199)]
[Thread 0x40a00940 (LWP 28199) exited]
[New Thread 0x40a00940 (LWP 28200)]
[New Thread 0x41401940 (LWP 28201)]
error at thread_main
0, , 
error at thread_main
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[Thread 0x41401940 (LWP 28201) exited]
[New Thread 0x41e02940 (LWP 28202)]
error at thread_main
[Thread 0x40a00940 (LWP 28200) exited]
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[New Thread 0x42803940 (LWP 28203)]
error at thread_main
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[Thread 0x41e02940 (LWP 28202) exited]
[Thread 0x42803940 (LWP 28203) exited]
[New Thread 0x43204940 (LWP 28204)]
error at thread_main
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[New Thread 0x43c05940 (LWP 28205)]
error at thread_main
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[Thread 0x43204940 (LWP 28204) exited]
[Thread 0x43c05940 (LWP 28205) exited]
[New Thread 0x44606940 (LWP 28207)]
error at thread_main
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[New Thread 0x45007940 (LWP 28208)]
error at thread_main
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[Thread 0x44606940 (LWP 28207) exited]
[Thread 0x45007940 (LWP 28208) exited]
[New Thread 0x45a08940 (LWP 28210)]
error at thread_main
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[New Thread 0x46409940 (LWP 28211)]
[Thread 0x45a08940 (LWP 28210) exited]

RAMP-UP TIME.(10 sec.)
error at thread_main
2002, HY000, Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[Thread 0x46409940 (LWP 28211) exited]

MEASURING START.

  10, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000
  20, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000

STOPPING THREADS

<Raw Results>
  [0] sc:0  lt:0  rt:0  fl:0 
  [1] sc:0  lt:0  rt:0  fl:0 
  [2] sc:0  lt:0  rt:0  fl:0 
  [3] sc:0  lt:0  rt:0  fl:0 
  [4] sc:0  lt:0  rt:0  fl:0 
 in 20 sec.

<Raw Results2(sum ver.)>
  [0] sc:0  lt:0  rt:0  fl:0 
  [1] sc:0  lt:0  rt:0  fl:0 
  [2] sc:0  lt:0  rt:0  fl:0 
  [3] sc:0  lt:0  rt:0  fl:0 
  [4] sc:0  lt:0  rt:0  fl:0 

<Constraint Check> (all must be [OK])
 [transaction percentage]
        Payment: nan% (>=43.0%) [NG] *
   Order-Status: nan% (>= 4.0%) [NG] *
       Delivery: nan% (>= 4.0%) [NG] *
    Stock-Level: nan% (>= 4.0%) [NG] *
 [response time (at least 90% passed)]
      New-Order: nan%  [NG] *
        Payment: nan%  [NG] *
   Order-Status: nan%  [NG] *
       Delivery: nan%  [NG] *
    Stock-Level: nan%  [NG] *

<TpmC>
                 0.000 TpmC

Program exited normally.
(gdb) q

重新link mysql.sock

[root@db-13 data]# ln -s  /data/mysql/data/mysql.sock  /tmp/mysql.sock
[root@db-13 data]# ls -l /tmp/mysql.sock 
lrwxrwxrwx 1 root root 27 Mar 19 15:59 /tmp/mysql.sock -> /data/mysql/data/mysql.sock

再次调用

[root@db-13 tpcc-mysql]# gdb
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) file tpcc_start
Reading symbols from /tmp/tpcc-mysql/tpcc_start...done.
(gdb) run
Starting program: /tmp/tpcc-mysql/tpcc_start 
[Thread debugging using libthread_db enabled]
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
<Parameters>
     [server]: 
     [port]: 3306
     [DBname]: tpcc
       [user]: 
       [pass]: 
  [warehouse]: 1
 [connection]: 10
     [rampup]: 10 (sec.)
    [measure]: 20 (sec.)
[New Thread 0x40a00940 (LWP 28955)]
[Thread 0x40a00940 (LWP 28955) exited]
[New Thread 0x40a00940 (LWP 28956)]
[New Thread 0x41401940 (LWP 28957)]
[New Thread 0x41e02940 (LWP 28959)]
[New Thread 0x42803940 (LWP 28961)]
[New Thread 0x43204940 (LWP 28963)]
[New Thread 0x43c05940 (LWP 28965)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x40a00940 (LWP 28956)]
my_stat (path=0x409ff750 "/usr/local/mysql/share/charsets/Index.xml", stat_area=0x409ff620, my_flags=0) at /pb2/build/sb_0-6421281-1342807431.83/mysql-5.5.27/mysys/my_lib.c:413
413	/pb2/build/sb_0-6421281-1342807431.83/mysql-5.5.27/mysys/my_lib.c: No such file or directory.
	in /pb2/build/sb_0-6421281-1342807431.83/mysql-5.5.27/mysys/my_lib.c
(gdb) q
A debugging session is active.

	Inferior 1 [process 28952] will be killed.

Quit anyway? (y or n) y

[root@db-13 tpcc-mysql]# find / -name mysql-5.5.27
[root@db-13 tpcc-mysql]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 148786916 4382960 136724084 4% /
/dev/sda7 258699556 191712 245154620 1% /backup
/dev/sdb1 1134323348 178684616 897089040 17% /data
/dev/sda6 10153988 8957012 672860 94% /var
/dev/sda5 20315812 203008 19064164 2% /home
/dev/sda1 248895 12332 223713 6% /boot
tmpfs 66047196 0 66047196 0% /dev/shm

创建path file
[root@db-13 data]# mkdir -p /usr/local/mysql/share/charsets/
[root@db-13 data]# touch /usr/local/mysql/share/charsets/Index.xml

再次调用

[root@db-13 tpcc-mysql]# gdb
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) file ptcc_start
ptcc_start: No such file or directory.
(gdb) file tpcc_start
Reading symbols from /tmp/tpcc-mysql/tpcc_start...done.
(gdb) run
Starting program: /tmp/tpcc-mysql/tpcc_start 
[Thread debugging using libthread_db enabled]
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
<Parameters>
     [server]: 
     [port]: 3306
     [DBname]: tpcc
       [user]: 
       [pass]: 
  [warehouse]: 1
 [connection]: 10
     [rampup]: 10 (sec.)
    [measure]: 20 (sec.)
[New Thread 0x40a00940 (LWP 29179)]
[Thread 0x40a00940 (LWP 29179) exited]
[New Thread 0x40a00940 (LWP 29180)]
[New Thread 0x41401940 (LWP 29181)]
[New Thread 0x41e02940 (LWP 29182)]
[New Thread 0x42803940 (LWP 29183)]
[New Thread 0x43204940 (LWP 29184)]
[New Thread 0x43c05940 (LWP 29185)]
[New Thread 0x44606940 (LWP 29186)]
error at thread_main
error at thread_main
error at thread_main
1045, 28000, 
error at thread_main
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
error at thread_main
[New Thread 0x45007940 (LWP 29188)]
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
error at thread_main
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
[Thread 0x43204940 (LWP 29184) exited]
error at thread_main
[Thread 0x41e02940 (LWP 29182) exited]
[New Thread 0x45a08940 (LWP 29189)]
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
error at thread_main
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
[Thread 0x42803940 (LWP 29183) exited]
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
[Thread 0x44606940 (LWP 29186) exited]
[Thread 0x45007940 (LWP 29188) exited]
[Thread 0x43c05940 (LWP 29185) exited]
[Thread 0x41401940 (LWP 29181) exited]
[New Thread 0x46409940 (LWP 29190)]
error at thread_main

RAMP-UP TIME.(10 sec.)
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
[Thread 0x40a00940 (LWP 29180) exited]
[Thread 0x45a08940 (LWP 29189) exited]
error at thread_main
1045, 28000, Access denied for user 'root'@'localhost' (using password: NO)
[Thread 0x46409940 (LWP 29190) exited]

MEASURING START.

  10, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000, 0(0):0.000|0.000

Program received signal SIGINT, Interrupt.
0x0000003fabe0e39d in pause () from /lib64/libpthread.so.0
(gdb) 
(gdb) q
A debugging session is active.

	Inferior 1 [process 29176] will be killed.

Quit anyway? (y or n) 
Please answer y or n.
A debugging session is active.

	Inferior 1 [process 29176] will be killed.

Quit anyway? (y or n) y
[root@db-13 tpcc-mysql]# ./tpcc_start  -h 127.0.0.1 -d test  -u root  -p 'yihaodian'  -w 30  -c 60  -r 60   -l 1000 -f mysql_tpcc_20130319
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
option h with value '127.0.0.1'
option d with value 'test'
option u with value 'root'
option p with value 'yihaodian'
option w with value '30'
option c with value '60'
option r with value '60'
option l with value '1000'
option f with value 'mysql_tpcc_20130319'
<Parameters>
     [server]: 127.0.0.1
     [port]: 3306
     [DBname]: test
       [user]: root
       [pass]: yihaodian
  [warehouse]: 30
 [connection]: 60
     [rampup]: 60 (sec.)
    [measure]: 1000 (sec.)
error at thread_main
1146, 42S02, Table 'test.customer' doesn't exist
error at thread_main
1146, 42S02, Table 'test.customer' doesn't exist
error at thread_main
1146, 42S02, Table 'test.customer' doesn't exist
error at thread_main
1146, 42S02, Table 'test.customer' doesn't exist
error at thread_main
1146, 42S02, Table 'test.customer' doesn't exist
error at thread_main
1146, 42S02, Table 'test.customer' doesn't exist


OK!

[root@db-13 tpcc-mysql]# ./tpcc_start -h 127.0.0.1 -d tpcc1000 -u root -p ‘yihaodian’ -w 30 -c 60 -r 60 -l 1000 -f mysql_tpcc_20130319

***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
option h with value '127.0.0.1'
option d with value 'tpcc1000'
option u with value 'root'
option p with value 'yihaodian'
option w with value '30'
option c with value '60'
option r with value '60'
option l with value '1000'
option f with value 'mysql_tpcc_20130319'
<Parameters>
     [server]: 127.0.0.1
     [port]: 3306
     [DBname]: tpcc1000
       [user]: root
       [pass]: yihaodian
  [warehouse]: 30
 [connection]: 60
     [rampup]: 60 (sec.)
    [measure]: 1000 (sec.)

RAMP-UP TIME.(60 sec.)

MEASURING START.

  10, 2639(0):2.135|3.487, 2635(0):0.443|1.441, 263(0):0.258|0.458, 264(0):2.723|3.562, 263(0):6.258|9.052
  20, 3144(0):2.073|2.507, 3151(0):0.431|0.539, 316(0):0.267|0.368, 318(0):2.680|2.907, 314(0):6.354|8.062
  30, 2609(0):2.024|2.413, 2602(0):0.417|0.505, 259(0):0.245|0.288, 257(0):2.774|2.940, 261(0):6.030|6.613
  40, 3311(0):2.079|2.454, 3309(0):0.426|0.522, 332(0):0.238|0.270, 328(0):2.699|3.071, 331(0):5.638|7.017
  50, 2464(0):2.105|2.475, 2469(0):0.425|0.540, 246(0):0.229|0.289, 247(0):2.651|2.820, 246(0):6.281|6.725
  60, 2884(0):2.085|2.773, 2883(0):0.427|0.501, 289(0):0.253|0.281, 295(0):2.712|2.879, 289(0):6.327|6.646
  70, 2641(0):2.043|2.436, 2640(0):0.437|0.701, 263(0):0.248|0.292, 263(0):2.833|2.868, 263(0):5.315|6.035
  80, 3045(0):2.038|2.497, 3049(0):0.429|0.558, 306(0):0.252|0.452, 310(0):2.692|2.841, 305(0):5.783|7.210
  90, 2551(0):2.043|2.564, 2551(0):0.433|0.552, 255(0):0.258|0.325, 249(0):2.653|2.823, 256(0):5.321|6.107
 100, 2553(0):2.078|2.721, 2551(0):0.439|0.551, 254(0):0.231|0.247, 256(0):2.688|3.792, 255(0):6.583|7.014
 110, 2923(0):2.060|2.483, 2924(0):0.426|0.763, 293(0):0.251|0.295, 295(0):2.645|2.878, 293(0):5.843|6.378
 120, 2639(0):2.007|2.252, 2638(0):0.434|0.539, 264(0):0.234|0.301, 261(0):2.726|2.823, 262(0):6.181|6.839
 130, 2884(0):2.062|2.515, 2885(0):0.425|0.554, 288(0):0.248|0.285, 283(0):2.597|2.892, 289(0):6.086|6.667
 140, 2758(0):2.095|2.542, 2750(0):0.434|0.962, 276(0):0.252|0.267, 279(0):2.662|3.059, 276(0):5.527|7.356
 150, 2406(0):2.011|2.492, 2416(0):0.426|0.492, 241(0):0.259|0.285, 248(0):2.650|2.691, 240(0):5.834|6.283
 160, 2903(0):2.066|2.361, 2904(0):0.431|0.522, 289(0):0.255|0.328, 282(0):2.828|2.927, 291(0):5.757|6.791
 170, 2677(0):2.023|2.730, 2672(0):0.426|0.535, 269(0):0.249|0.348, 267(0):2.674|2.810, 268(0):5.374|7.441
 180, 2395(0):2.061|2.474, 2385(0):0.440|0.555, 239(0):0.249|0.259, 254(0):2.643|2.724, 239(0):5.896|7.731

linux tools part 6– network Monitoring (2)

March 19, 2013 linux, system No comments

基于上次的nicstat linux还提供了nethogs,可以监控指定pid的具体流量,在这里可以下到源码.

获取过程:

open("/proc/$pid/fd")
open("/proc/net/tcp")
open("/proc/net/tcp6")
open("/etc/passwd")

eg:

[root@db-81 27274]# nethogs  -d  5

NetHogs version 0.7.snapshot

  PID USER     PROGRAM                      DEV        SENT      RECEIVED       
31984 oracle   oracleyhddb2                 eth0      35.318    4166.566 KB/sec
16420 liuyang  sshd: liuyang@pts/1          eth0       0.389	   0.013 KB/sec
0     root     ..83:10050-10.1.0.173:45031             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:44767             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:44399             0.000	   0.000 KB/sec
16514 zabbix   /sbin/zabbix_agentd          eth0       0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:42917             0.000	   0.000 KB/sec
31986 oracle   oracleyhddb2                 eth0       0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:40690             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:39504             0.000	   0.000 KB/sec
15016 liuyang  sshd: liuyang@pts/0          eth0       0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:38933             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:38792             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:36237             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:35992             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:35715             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:34958             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:34793             0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:34079             0.000	   0.000 KB/sec
15134 liuyang  sshd: liuyang@notty          eth0       0.000	   0.000 KB/sec
0     root     ..83:10050-10.1.0.173:28508             0.000	   0.000 KB/sec
0     root     unknown TCP                             0.000	   0.000 KB/sec

  TOTAL                                               35.707    4166.579 KB/sec 

/proc/net/tcp

[root@db-81 ~]# cat /proc/net/tcp
  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode                                                     
   0: 00000000:2742 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54323        0 50676198 1 ffff810745393940 3000 0 0 2 -1                 
   1: 00000000:1622 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54322        0 1204282 1 ffff81063ff60680 3000 0 0 2 -1                  
   2: 00000000:0CEA 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54326        0 102946291 1 ffff810bda120180 3000 0 0 2 -1                
   3: 00000000:0015 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 102942838 1 ffff81062bc60080 3000 0 0 2 -1                
   4: 00000000:0016 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 98812948 1 ffff810bda121980 3000 0 0 2 -1                 
   5: 0100007F:177A 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54324        0 104444736 1 ffff81004f0286c0 3000 0 0 2 -1                
   6: 0100007F:177B 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54324        0 104449554 1 ffff81063ff60c80 3000 0 0 2 -1                
   7: 0100007F:177C 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54324        0 104472621 1 ffff81062bc60680 3000 0 0 2 -1                
   8: 0100007F:177D 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54324        0 104475697 1 ffff81033613b880 3000 0 0 2 -1                
   9: 0100007F:177E 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54324        0 104460816 1 ffff81063ff60080 3000 0 0 2 -1                
  10: 0100007F:177F 00000000:0000 0A 00000000:00000000 00:00000000 00000000 54324        0 104477846 1 ffff81033613a680 3000 0 0 2 -1                
  11: 5100000A:0016 6E14000A:D92E 01 00000034:00000000 01:00000032 00000000     0        0 104477788 4 ffff81033613a080 512 40 15 3 100              
  12: 5100000A:0016 6E14000A:D304 01 00000000:00000000 02:0008BF47 00000000     0        0 104475630 2 ffff81062bc60c80 256 40 16 3 3                
  13: 5100000A:0016 6E14000A:C804 01 00000000:00000000 02:00078BBC 00000000     0        0 104472775 2 ffff81062bc61880 252 40 16 9 100              
  14: 5100000A:0016 6E14000A:EC72 01 00000000:00000000 02:0004210C 00000000     0        0 104444698 2 ffff81004f0280c0 493 40 18 4 4                
  15: 5100000A:0016 6E14000A:C7ED 01 00000000:00000000 02:0007889C 00000000     0        0 104472575 2 ffff81062bc61280 230 40 0 3 3                 
  16: 5100000A:0016 6E14000A:F6FC 01 00000000:00000000 02:0008A211 00000000     0        0 104460762 2 ffff81063ff61880 333 40 18 4 100              
  17: 5100000A:0016 6E14000A:EDC5 01 00000034:00000000 01:00000016 00000000     0        0 104449512 3 ffff81063ff61280 238 40 1 4 2    

The data presented in each output column is:

sl

The number of the line in the output listing.

local_address

The local IP address and port number for the socket. The IP address is displayed as a little-endian four-byte hexadecimal number; that is, the least significant byte is listed first, so you’ll need to reverse the order of the bytes to convert it to an IP address. The port number is a simple two-byte hexadecimal number.

rem_address

The remote IP address and port number for the socket. Encoding is the same as for the local_address.

st

The socket status.

tx_queue:rx_queue

The size of the transmit and receive queues.

tr:tm->when

The tr field indicates whether a timer is active for this socket. A value of zero indicates the timer is not active. The tm->when field indicates the time remaining (in jiffies) before timeout occurs.

retrnsmt

Unused.

uid

The ID of the user that owns the socket. This is the same ID found in the /etc/passwd file.

time-out

Unused.

inode

A cryptic-looking number that identifies the socket to the Linux virtual filesystem.

linux tools part 5– Trace network information

March 13, 2013 linux, system No comments

Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. While Nmap is commonly used for security audits, many systems and network administrators find it useful for routine tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime.

一句话,Nmap 是一款开源的网络探测及安全审核工具.可以在这里看到具体说明,可以在这里下载到最新版本。

nmap的使用方法:

-sT	TCP connect()扫描,这是最基本的TCP扫描方式。这种扫描很容易被检测到,在目标主机的日志中会记录大批的连接请求以及错误信息。
-sS	TCP同步扫描(TCP SYN),因为不必全部打开一个TCP连接,所以这项技术通常称为半开扫描(half-open)。这项技术最大的好处是,很少有系统能够把这记入系统日志。不过,你需要root权限来定制SYN数据包。
-sF,-sX,-sN	秘密FIN数据包扫描、圣诞树(Xmas Tree)、空(Null)扫描模式。这些扫描方式的理论依据是:关闭的端口需要对你的探测包回应RST包,而打开的端口必需忽略有问题的包(参考RFC 793第64页)。
-sP	ping扫描,用ping方式检查网络上哪些主机正在运行。当主机阻塞ICMP echo请求包是ping扫描是无效的。nmap在任何情况下都会进行ping扫描,只有目标主机处于运行状态,才会进行后续的扫描。
-sU	如果你想知道在某台主机上提供哪些UDP(用户数据报协议,RFC768)服务,可以使用此选项。
-sA	ACK扫描,这项高级的扫描方法通常可以用来穿过防火墙。
-sW	滑动窗口扫描,非常类似于ACK的扫描。
-sR	RPC扫描,和其它不同的端口扫描方法结合使用。
-b	FTP反弹攻击(bounce attack),连接到防火墙后面的一台FTP服务器做代理,接着进行端口扫描。
-P0	在扫描之前,不ping主机。
-PT	扫描之前,使用TCP ping确定哪些主机正在运行。
-PS	对于root用户,这个选项让nmap使用SYN包而不是ACK包来对目标主机进行扫描。
-PI	设置这个选项,让nmap使用真正的ping(ICMP echo请求)来扫描目标主机是否正在运行。
-PB	这是默认的ping扫描选项。它使用ACK(-PT)和ICMP(-PI)两种扫描类型并行扫描。如果防火墙能够过滤其中一种包,使用这种方法,你就能够穿过防火墙。
-O	这个选项激活对TCP/IP指纹特征(fingerprinting)的扫描,获得远程主机的标志,也就是操作系统类型。
-I	打开nmap的反向标志扫描功能。
-f	使用碎片IP数据包发送SYN、FIN、XMAS、NULL。包增加包过滤、入侵检测系统的难度,使其无法知道你的企图。
-v	冗余模式。强烈推荐使用这个选项,它会给出扫描过程中的详细信息。
-S <IP>	在一些情况下,nmap可能无法确定你的源地址(nmap会告诉你)。在这种情况使用这个选项给出你的IP地址。
-g port	设置扫描的源端口。一些天真的防火墙和包过滤器的规则集允许源端口为DNS(53)或者FTP-DATA(20)的包通过和实现连接。显然,如果攻击者把源端口修改为20或者53,就可以摧毁防火墙的防护。
-oN	把扫描结果重定向到一个可读的文件logfilename中。
-oS	扫描结果输出到标准输出。
-oX 扫描结果输出到XML文件
--host_timeout	设置扫描一台主机的时间,以毫秒为单位。默认的情况下,没有超时限制。
--max_rtt_timeout	设置对每次探测的等待时间,以毫秒为单位。如果超过这个时间限制就重传或者超时。默认值是大约9000毫秒。
--min_rtt_timeout	设置nmap对每次探测至少等待你指定的时间,以毫秒为单位。
-M count	置进行TCP connect()扫描时,最多使用多少个套接字进行并行的扫描。
-iL filename	从filename文件中读取扫描的目标。
-iR	让nmap自己随机挑选主机进行扫描。
-p	端口 这个选项让你选择要进行扫描的端口号的范围。如:-p 20-30,139,60000。
-exclude	排除指定主机。
-excludefile	排除指定文件中的主机。

eg:

nmap  xx.xx.xx.1-254 (scan all of 254 ip port)

Nmap 在root权限下可以提供更多的信息,例如判断对端操作系统,发送 SYN-PACKET 接受ACK,基于上面所说的”这项技术最大的好处是,很少有系统能够把这记入系统日志。不过,你需要root权限来定制SYN数据包” client端在接收到scan端的SYN packet之后 会回复一个ACK 响应

eg:

[root@db-41 ~]# nmap -sS -O 10.0.0.14

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-03-13 00:14 CST
Interesting ports on dca-srv-0153.idc.yihaodian.com (10.0.0.14):
Not shown: 1677 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
1521/tcp open  oracle
3306/tcp open  mysql
MAC Address: F0:4D:A2:3C:BE:07 (Unknown)
Device type: general purpose
Running: Linux 2.4.X|2.5.X|2.6.X
OS details: Linux 2.4.7 - 2.6.11
Uptime 5.344 days (since Thu Mar  7 15:59:46 2013)

Nmap finished: 1 IP address (1 host up) scanned in 3.355 seconds

你也可以使用-oX 将输出结果写入到file中。

eg:

[root@db-41 ~]# nmap -sS -O -oX louis.xml 10.0.1.10

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-03-13 00:17 CST
Interesting ports on dcb-srv-0177-lp2.idc.yihaodian.com (10.0.1.10):
Not shown: 1662 closed ports
PORT      STATE SERVICE
13/tcp    open  daytime
22/tcp    open  ssh
25/tcp    open  smtp
37/tcp    open  time
111/tcp   open  rpcbind
199/tcp   open  smux
427/tcp   open  svrloc
512/tcp   open  exec
513/tcp   open  login
514/tcp   open  shell
657/tcp   open  unknown
1522/tcp  open  rna-lm
6112/tcp  open  dtspc
9090/tcp  open  zeus-admin
32770/tcp open  sometimes-rpc3
32771/tcp open  sometimes-rpc5
32772/tcp open  sometimes-rpc7
32777/tcp open  sometimes-rpc17
Device type: general purpose
Running: FreeBSD 5.X
OS details: FreeBSD 5.0-RELEASE

Nmap finished: 1 IP address (1 host up) scanned in 2.245 seconds

之前的一个RAC 案例中 即使用了Nmap 来tracing了 HAIP的问题

linux tools part 4– Monitor process IO state

March 5, 2013 linux, system No comments

iotop是一个类似top的检测process IO 的Python 项目。可以在这里下载到源码,可以在这里找到具体的说明。下面做一个演示:

首先下载源码,要求python version>=2.6

wget http://guichaz.free.fr/iotop/files/iotop-0.5.tar.gz
wget http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz

编译python

[root@oel58 tmp]# cd /tmp/Python-2.6.6
[root@oel58 Python-2.6.6]#./configure && make && make install

....


checking for %zd printf() format support... yes
checking for socklen_t... yes
checking for build directories... done
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Modules/Setup.config
config.status: creating pyconfig.h
creating Modules/Setup
creating Modules/Setup.local
creating Makefile


...

Writing /usr/local/lib/python2.6/lib-dynload/Python-2.6.6-py2.6.egg-info
if test -f /usr/local/bin/python -o -h /usr/local/bin/python; \
        then rm -f /usr/local/bin/python; \
        else true; \
        fi
(cd /usr/local/bin; ln python2.6 python)
rm -f /usr/local/bin/python-config
(cd /usr/local/bin; ln -s python2.6-config python-config)
/usr/bin/install -c -m 644 ./Misc/python.man \
                /usr/local/share/man/man1/python.1

编译完成之后,编译iotop 源码

[root@oel58 tmp]# cd iotop-0.5
[root@oel58 iotop-0.5]# ./setup.py  install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/iotop
copying iotop/version.py -> build/lib/iotop
copying iotop/netlink.py -> build/lib/iotop
copying iotop/__init__.py -> build/lib/iotop
copying iotop/ui.py -> build/lib/iotop
copying iotop/data.py -> build/lib/iotop
copying iotop/genetlink.py -> build/lib/iotop
copying iotop/vmstat.py -> build/lib/iotop
copying iotop/ioprio.py -> build/lib/iotop
running build_scripts
creating build/scripts-2.6
copying and adjusting sbin/iotop -> build/scripts-2.6
changing mode of build/scripts-2.6/iotop from 644 to 755
running install_lib
creating /usr/local/lib/python2.6/site-packages/iotop
copying build/lib/iotop/version.py -> /usr/local/lib/python2.6/site-packages/iotop
copying build/lib/iotop/netlink.py -> /usr/local/lib/python2.6/site-packages/iotop
copying build/lib/iotop/__init__.py -> /usr/local/lib/python2.6/site-packages/iotop
copying build/lib/iotop/ui.py -> /usr/local/lib/python2.6/site-packages/iotop
copying build/lib/iotop/data.py -> /usr/local/lib/python2.6/site-packages/iotop
copying build/lib/iotop/genetlink.py -> /usr/local/lib/python2.6/site-packages/iotop
copying build/lib/iotop/vmstat.py -> /usr/local/lib/python2.6/site-packages/iotop
copying build/lib/iotop/ioprio.py -> /usr/local/lib/python2.6/site-packages/iotop
byte-compiling /usr/local/lib/python2.6/site-packages/iotop/version.py to version.pyc
byte-compiling /usr/local/lib/python2.6/site-packages/iotop/netlink.py to netlink.pyc
byte-compiling /usr/local/lib/python2.6/site-packages/iotop/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.6/site-packages/iotop/ui.py to ui.pyc
byte-compiling /usr/local/lib/python2.6/site-packages/iotop/data.py to data.pyc
byte-compiling /usr/local/lib/python2.6/site-packages/iotop/genetlink.py to genetlink.pyc
byte-compiling /usr/local/lib/python2.6/site-packages/iotop/vmstat.py to vmstat.pyc
byte-compiling /usr/local/lib/python2.6/site-packages/iotop/ioprio.py to ioprio.pyc
running install_scripts
copying build/scripts-2.6/iotop -> /usr/local/bin
changing mode of /usr/local/bin/iotop to 755
running install_data
copying iotop.8 -> /usr/local/share/man/man8
running install_egg_info
Writing /usr/local/lib/python2.6/site-packages/iotop-0.5-py2.6.egg-info

————————————————————–

[root@oel58 bin]# ./iotop --only
Total DISK READ :       0.00 B/s | Total DISK WRITE :     255.17 M/s
Actual DISK READ:       0.00 B/s | Actual DISK WRITE:     256.64 M/s
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                                                                                 
16389 be/4 root        0.00 B/s   48.40 M/s  0.00 % 11.61 % dd if /dev/zero of /tmp/temp.txt bs 1M count 10000
16418 be/4 root        0.00 B/s   58.64 M/s  0.00 % 11.55 % dd if /dev/zero of /tmp/temp.txt bs 1M count 10000
16359 be/4 root        0.00 B/s   73.66 M/s  0.00 %  3.48 % dd if /dev/zero of /tmp/temp.txt bs 1M count 10000
 6756 be/4 root        0.00 B/s    0.00 B/s  0.00 %  5.97 % [flush-8:0]
16418 be/4 root        0.00 B/s   21.15 M/s  0.00 %  4.52 % dd if /dev/zero of /tmp/temp.txt bs 1M count 10000
16447 be/4 root        0.00 B/s   23.91 M/s  0.00 %  3.02 % dd if /dev/zero of /tmp/temp.txt bs 1M count 10000
  109 be/4 root        3.54 K/s 1030.75 K/s  0.00 %  2.36 % [kjournald]
16359 be/4 root        0.00 B/s   22.91 M/s  0.00 %  1.69 % dd if /dev/zero of /tmp/temp.txt bs 1M count 10000

Python ≥ 2.7 and a Linux kernel ≥ 2.6.20 with the TASK_DELAY_ACCT CONFIG_TASKSTATS, TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on.

经测试py version >2.6即可,此外需要说明如果kernel version < 2.6.20 会出现如下问题:

Total DISK READ :	0.00 B/s | Total DISK WRITE :       0.00 B/s
Actual DISK READ:	0.00 B/s | Actual DISK WRITE:      16.26 K/s
TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND


CONFIG_TASK_DELAY_ACCT not enabled in kernel, cannot determine SWAPIN and IO %   

strace iotop主要调用的python模块

open("/usr/local/lib/python2.6/lib-dynload/_socket.so", O_RDONLY) = 9
open("/usr/local/lib/python2.6/lib-dynload/_ssl.so", O_RDONLY|O_LARGEFILE) = 8
open("/usr/local/lib/python2.6/site-packages/iotop/vmstat.py", O_RDONLY|O_LARGEFILE) = 5
open("/usr/local/lib/python2.6/site-packages/iotop/vmstat.pyc", O_RDONLY|O_LARGEFILE) = 6
open("/usr/local/lib/python2.6/lib-dynload/cStringIO.so", O_RDONLY) = 7
open("/usr/local/lib/python2.6/lib-dynload/cStringIO.so", O_RDONLY|O_LARGEFILE) = 6

.....

iotop 对python的依赖性过高,以及对于version的要求过于严格,导致了通用性和移植性的下降。

linux tools part 3– Monitor process status

February 28, 2013 linux, system No comments

pidstat是一款很不错的针对linux pid状态监控的程序

The pidstat command is used for monitoring individual tasks currently being managed by the Linux kernel.
It writes to standard output activities for every task selected with option -p or for every task managed by the Linux kernel if option -p ALL has been used. Not selecting any tasks is equivalent to specifying -p ALL but only active tasks (tasks with non-zero statistics values) will appear in the report.

pidstat的具体用法参考这里,源码版本在这里下载

[root@db56 tmp]# tar -zxvf sysstat-10.0.5.tar.gz 
[root@db56 tmp]# cd sysstat-10.0.5
 [root@db56 sysstat-10.0.5]# ./configure 
.
Check programs:
.
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
.....

config.status: creating contrib/isag/isag
config.status: creating Makefile

   Sysstat version:		10.0.5
   Installation prefix:		/usr/local
   rc directory:		/etc/rc.d
   Init directory:		/etc/rc.d/init.d
   Configuration directory:	/etc/sysconfig
   Man pages directory:		${datarootdir}/man
   Compiler:			gcc
   Compiler flags:		-g -O2

[root@db56 sysstat-10.0.5]# 
[root@db56 sysstat-10.0.5]# 
[root@db56 sysstat-10.0.5]# make -f  Makefile

————————————————-

eg:

[root@db56 sysstat-10.0.5]# ./pidstat -p 12990  2 5 
Linux 2.6.18-194.el5 (db56) 	02/28/2013 	_x86_64_	(12 CPU)

03:07:46 PM       PID    %usr %system  %guest    %CPU   CPU  Command
03:07:48 PM     12990    0.00    0.00    0.00    0.00     7  oracle
03:07:50 PM     12990    0.00    0.00    0.00    0.00     7  oracle
03:07:52 PM     12990    0.00    0.00    0.00    0.00     7  oracle
03:07:54 PM     12990    0.00    0.00    0.00    0.00     7  oracle
03:07:56 PM     12990    0.00    0.00    0.00    0.00     7  oracle
Average:        12990    0.00    0.00    0.00    0.00     -  oracle


[root@db56 sysstat-10.0.5]# pidstat -r -t -p 12990 1 2
Linux 2.6.18-194.el5 (db56) 	02/28/2013 	_x86_64_	(12 CPU)

04:06:28 PM      TGID       TID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
04:06:29 PM     12990         -      0.00      0.00 12733740  18184   0.06  oracle
04:06:29 PM         -     12990      0.00      0.00 12733740  18184   0.06  |__oracle

04:06:29 PM      TGID       TID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
04:06:30 PM     12990         -      0.00      0.00 12733740  18184   0.06  oracle
04:06:30 PM         -     12990      0.00      0.00 12733740  18184   0.06  |__oracle

Average:         TGID       TID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
Average:        12990         -      0.00      0.00 12733740  18184   0.06  oracle
Average:            -     12990      0.00      0.00 12733740  18184   0.06  |__oracle


strace pidstat -p 12990 :

open("/proc/uptime", O_RDONLY)          = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b3fb25f9000
read(3, "45884933.69 45647910.77\n", 4096) = 24
close(3)                                = 0
munmap(0x2b3fb25f9000, 4096)            = 0
open("/proc/stat", O_RDONLY)            = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b3fb25f9000
read(3, "cpu  340880517 704021 59278877 5"..., 4096) = 1513
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x2b3fb25f9000, 4096)            = 0
open("/proc/12990/stat", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b3fb25f9000
read(3, "12990 (oracle) S 1 12990 12990 0"..., 4096) = 231
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x2b3fb25f9000, 4096)            = 0
open("/proc/12990/status", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b3fb25f9000
read(3, "Name:\toracle\nState:\tS (sleeping)"..., 4096) = 779
read(3, "", 4096)                       = 0
close(3) 

主要从/proc/$pid/stat 获取信息:

 /proc/[pid]/stat
              Status information about the process.  This is used by ps(1).  It is
              defined in /usr/src/linux/fs/proc/array.c.

              The fields, in order, with their proper scanf(3) format specifiers,
              are:

              pid %d      The process ID.

              comm %s     The filename of the executable, in parentheses.  This is
                          visible whether or not the executable is swapped out.

              state %c    One character from the string "RSDZTW" where R is running,
                          S is sleeping in an interruptible wait, D is waiting in
                          uninterruptible disk sleep, Z is zombie, T is traced or
                          stopped (on a signal), and W is paging.

              ppid %d     The PID of the parent.

              pgrp %d     The process group ID of the process.

              session %d  The session ID of the process.

              tty_nr %d   The controlling terminal of the process.  (The minor device
                          number is contained in the combination of bits 31 to 20 and
                          7 to 0; the major device number is in bits 15 to 8.)

              tpgid %d    The ID of the foreground process group of the controlling
                          terminal of the process.

              flags %u (%lu before Linux 2.6.22)
                          The kernel flags word of the process.  For bit meanings,
                          see the PF_* defines in <linux/sched.h>.  Details depend on
                          the kernel version.

              minflt %lu  The number of minor faults the process has made which have
                          not required loading a memory page from disk.

              cminflt %lu The number of minor faults that the process's waited-for
                          children have made.

              majflt %lu  The number of major faults the process has made which have
                          required loading a memory page from disk.

              cmajflt %lu The number of major faults that the process's waited-for
                          children have made.

              utime %lu   Amount of time that this process has been scheduled in user
                          mode, measured in clock ticks (divide by
                          sysconf(_SC_CLK_TCK).  This includes guest time, guest_time
                          (time spent running a virtual CPU, see below), so that
                          applications that are not aware of the guest time field do
                          not lose that time from their calculations.

              stime %lu   Amount of time that this process has been scheduled in
                          kernel mode, measured in clock ticks (divide by
                          sysconf(_SC_CLK_TCK).

              cutime %ld  Amount of time that this process's waited-for children have
                          been scheduled in user mode, measured in clock ticks
                          (divide by sysconf(_SC_CLK_TCK).  (See also times(2).)
                          This includes guest time, cguest_time (time spent running a
                          virtual CPU, see below).

              cstime %ld  Amount of time that this process's waited-for children have
                          been scheduled in kernel mode, measured in clock ticks
                          (divide by sysconf(_SC_CLK_TCK).

              priority %ld
                          (Explanation for Linux 2.6) For processes running a real-
                          time scheduling policy (policy below; see
                          sched_setscheduler(2)), this is the negated scheduling
                          priority, minus one; that is, a number in the range -2 to
                          -100, corresponding to real-time priorities 1 to 99.  For
                          processes running under a non-real-time scheduling policy,
                          this is the raw nice value (setpriority(2)) as represented
                          in the kernel.  The kernel stores nice values as numbers in
                          the range 0 (high) to 39 (low), corresponding to the user-
                          visible nice range of -20 to 19.

                          Before Linux 2.6, this was a scaled value based on the
                          scheduler weighting given to this process.

              nice %ld    The nice value (see setpriority(2)), a value in the range
                          19 (low priority) to -20 (high priority).

              num_threads %ld
                          Number of threads in this process (since Linux 2.6).
                          Before kernel 2.6, this field was hard coded to 0 as a
                          placeholder for an earlier removed field.

              itrealvalue %ld
                          The time in jiffies before the next SIGALRM is sent to the
                          process due to an interval timer.  Since kernel 2.6.17,
                          this field is no longer maintained, and is hard coded as 0.

              starttime %llu (was %lu before Linux 2.6)
                          The time in jiffies the process started after system boot.

              vsize %lu   Virtual memory size in bytes.

              rss %ld     Resident Set Size: number of pages the process has in real
                          memory.  This is just the pages which count toward text,
                          data, or stack space.  This does not include pages which
                          have not been demand-loaded in, or which are swapped out.

              rsslim %lu  Current soft limit in bytes on the rss of the process; see
                          the description of RLIMIT_RSS in getpriority(2).

              startcode %lu
                          The address above which program text can run.

              endcode %lu The address below which program text can run.

              startstack %lu
                          The address of the start (i.e., bottom) of the stack.

              kstkesp %lu The current value of ESP (stack pointer), as found in the
                          kernel stack page for the process.

              kstkeip %lu The current EIP (instruction pointer).

              signal %lu  The bitmap of pending signals, displayed as a decimal
                          number.  Obsolete, because it does not provide information
                          on real-time signals; use /proc/[pid]/status instead.

              blocked %lu The bitmap of blocked signals, displayed as a decimal
                          number.  Obsolete, because it does not provide information
                          on real-time signals; use /proc/[pid]/status instead.

              sigignore %lu
                          The bitmap of ignored signals, displayed as a decimal
                          number.  Obsolete, because it does not provide information
                          on real-time signals; use /proc/[pid]/status instead.

              sigcatch %lu
                          The bitmap of caught signals, displayed as a decimal
                          number.  Obsolete, because it does not provide information
                          on real-time signals; use /proc/[pid]/status instead.

              wchan %lu   This is the "channel" in which the process is waiting.  It
                          is the address of a system call, and can be looked up in a
                          namelist if you need a textual name.  (If you have an up-
                          to-date /etc/psdatabase, then try ps -l to see the WCHAN
                          field in action.)

              nswap %lu   Number of pages swapped (not maintained).

              cnswap %lu  Cumulative nswap for child processes (not maintained).

              exit_signal %d (since Linux 2.1.22)
                          Signal to be sent to parent when we die.

              processor %d (since Linux 2.2.8)
                          CPU number last executed on.

              rt_priority %u (since Linux 2.5.19; was %lu before Linux 2.6.22)
                          Real-time scheduling priority, a number in the range 1 to
                          99 for processes scheduled under a real-time policy, or 0,
                          for non-real-time processes (see sched_setscheduler(2)).

              policy %u (since Linux 2.5.19; was %lu before Linux 2.6.22)
                          Scheduling policy (see sched_setscheduler(2)).  Decode
                          using the SCHED_* constants in linux/sched.h.

              delayacct_blkio_ticks %llu (since Linux 2.6.18)
                          Aggregated block I/O delays, measured in clock ticks
                          (centiseconds).

              guest_time %lu (since Linux 2.6.24)
                          Guest time of the process (time spent running a virtual CPU
                          for a guest operating system), measured in clock ticks
                          (divide by sysconf(_SC_CLK_TCK).

              cguest_time %ld (since Linux 2.6.24)
                          Guest time of the process's children, measured in clock
                          ticks (divide by sysconf(_SC_CLK_TCK).

linux tools part 2– network Monitoring

February 27, 2013 linux, system No comments

本来想写一篇关于nicstat的文章,霸爷已经写的非常好了参考这里nicstat 网络流量统计利器

这里说明一下使用nicstat 可以完美替代iptraf ,nload 等工具

同样可以替代watch –命令行模式:
eg:

Every 1.0s: /sbin/ifconfig eth0 | grep bytes                                                                                                                           Wed Feb 27 22:20:58 2013

          RX bytes:1851917520138 (1.6 TiB)  TX bytes:41460941958 (38.6 GiB)

--

Every 1.0s: /sbin/ifconfig eth0 | grep bytes                                                                                                                           Wed Feb 27 22:21:27 2013

          RX bytes:1851921542828 (1.6 TiB)  TX bytes:41461009539 (38.6 GiB)
[root@db-83 nicstat-1.92]# nicstat -help
USAGE: nicstat [-hvnsxpztual] [-i int[,int...]]
   [-S int:mbps[,int:mbps...]] [interval [count]]

         -h                 # help
         -v                 # show version (1.92)
         -i interface       # track interface only
         -n                 # show non-local interfaces only (exclude lo0)
         -s                 # summary output
         -x                 # extended output
         -p                 # parseable output
         -z                 # skip zero value lines
         -t                 # show TCP statistics
         -u                 # show UDP statistics
         -a                 # equivalent to "-x -u -t"
         -l                 # list interface(s)
         -M                 # output in Mbits/sec
         -S int:mbps[fd|hd] # tell nicstat the interface
                            # speed (Mbits/sec) and duplex
    eg,
       nicstat              # print summary since boot only
       nicstat 1            # print every 1 second
       nicstat 1 5          # print 5 times only
       nicstat -z 1         # print every 1 second, skip zero lines
       nicstat -i hme0 1    # print hme0 only every 1 second
[root@db-83 nicstat-1.92]# nicstat -a
22:14:24    InKB   OutKB   InSeg  OutSeg Reset  AttF %ReTX InConn OutCon Drops
TCP         0.00    0.00   125.7   57.71  0.01  0.01 0.000   0.15   0.01  0.00
22:14:24                    InDG   OutDG     InErr  OutErr
UDP                         0.00    0.00      0.00    0.00
22:14:24      RdKB    WrKB   RdPkt   WrPkt   IErr  OErr  Coll  NoCP Defer  %Util
lo            0.00    0.00    0.01    0.01   0.00  0.00  0.00  0.00  0.00   0.00
eth0         185.3    4.15   127.4   57.70   0.00  0.00  0.00  0.00  0.00   0.16
[root@db-83 nicstat-1.92]# nicstat -i eth0  5 4 
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
22:14:31     eth0   185.3    4.15   127.4   57.70  1488.9   73.62  0.16   0.00
22:14:36     eth0    0.32    0.29    3.00    2.40   109.5   125.3  0.00   0.00
22:14:41     eth0    0.23    0.05    3.60    0.40   66.67   136.0  0.00   0.00
22:14:46     eth0   494.6    5.77   337.8   78.99  1499.6   74.83  0.41   0.00
[root@db-83 nicstat-1.92]# nicstat  -v
nicstat version 1.92
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
22:15:50       lo    0.00    0.00    0.01    0.01   50.00   50.00  0.00   0.00
22:15:50     eth0   185.3    4.15   127.4   57.70  1488.9   73.62  0.16   0.00

NOTES:

– Some unusual network cards may not provide all the details to Kstat,(or provide different symbols). Check for newer versions of this program, and the @Network array in the code below.
– Utilisation is based on bytes transferred divided by speed of the interface (if the speed is known). It should be impossible to reach 100% as there are overheads due to bus negotiation and timing.
– Loopback interfaces may only provide packet counts (if anything), and so bytes and %util will always be zero. Newer versions of Solaris (newer than Solaris 10 6/06) may provide loopback byte stats.
– Saturation is determined by counting read and write errors caused by the interface running at saturation. This approach is not ideal, and the value reported is often lower than it should be (eg, 0.0). Reading the rKB/s and wKB/s fields may be more useful.

linux tools part 1– Linux Kernel Performance

February 27, 2013 linux, system No comments

Perf is a profiler tool for Linux 2.6+ based systems that abstracts away CPU hardware differences in Linux performance measurementsand presents a simple commandline interface. Perf is based on the perf_events interface exported by recent versions of the Linux kernel. This article demonstrates the perf tool through example runs.

最初的时候,它叫做 Performance counter,在 2.6.31 中第一次亮相。此后他成为内核开发最为活跃的一个领域。在 2.6.32 中它正式
改名为 Performance Event,因为 perf 已不再仅仅作为 PMU 的抽象,而是能够处理所有的性能相关的事件。

使用 perf,您可以分析程序运行期间发生的硬件事件,比如 instructions retired ,processor clock cycles 等;您也可以分析软件
事件比如 Page Fault 和进程切换。

这使得 Perf 拥有了众多的性能分析能力,举例来说,使用 Perf 可以计算每个时钟周期内的指令数,称为 IPC,IPC 偏低表明代码没有
很好地利用 CPU。Perf 还可以对程序进行函数级别的采样,从而了解程序的性能瓶颈究竟在哪里等等。Perf 还可以替代 strace,可以添
加动态内核 probe 点,还可以做 benchmark 衡量调度器的好坏.

Subcommands:

perf stat: obtain event counts

perf record: record events for later reporting

perf report: break down events by process, function, etc.

perf annotate: annotate assembly or source code with event counts

perf top: see live event count

perf sched: tracing/measuring of scheduler actions and latencies

perf list: list available events

relative link:
linux-performance-analysis-and-tools

Perf — Linux下的系统性能调优工具介绍

http://en.wikipedia.org/wiki/Perf_(Linux)

perf relation with oracle:

linux-perf-utility-with-el-6 by Hoogland p1

linux-perf-utility-with-el-6 by Hoogland p2