[20181130]control file sequential read.txt
[20181130]control file sequential read.txt
--//昨天上午探究了大量控制文件读的情况,链接:http://blog.itpub.net/267265/viewspace-2222146/
--//今天做一些细节探究:
1.环境:
sys@xxxxx1> @ ver1
port_string version banner
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/linux 2.4.xx 11.2.0.4.0 oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit production
--//建立执行脚本如下:
$ cat c.txt
select 'flashpct;'||trim(ceil(percent_space_used)) from v$flash_recovery_area_usage where file_type='flashback log'
union all
select 'flashtime;'||to_char(oldest_flashback_time,'yyyy-mm-dd hh24:mi:ss') from v$flashback_database_log;
--//session 1:
sys@xxxxx1> @ spid
sid serial# process server spid pid p_serial# c50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
60 26633 1442 dedicated 1443 418 203 alter system kill session '60,26633' immediate;
--//记下spid=1443.
2.使用strace跟踪
--//session 2:
$ strace -p 1443 -t -e pread -o /tmp/aa1
--//切换到session 1:
sys@xxxxx1> @ c.txt
'flashpct;'||trim(ceil(percent_space_used))
-------------------------------------------------
flashpct;0
--//session 2,按ctrl+c退出:
# strace -p 1443 -t -e pread -o /tmp/aa1
process 1443 attached - interrupt to quit
^cprocess 1443 detached
# cat /tmp/aa1
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(256, "\25\302\0\0j\3\0\0\1\255\3338\377\377\1\4b\27\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 16384, 476741632) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 480264192) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(258, "\25\302\0\0000\3\0\0b\261\3338\377\377\1\4[\r\0\0\30\0\f\0\340\7\0\0\0\0\0\0"..., 16384, 477626368) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(258, "\25\302\0\0000\3\0\0b\261\3338\377\377\1\4[\r\0\0\30\0\f\0\340\7\0\0\0\0\0\0"..., 16384, 477626368) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(256, "\25\302\0\0r\0\0\0\306\333\2638\377\377\1\4{z\0\0\3\0\2\0\0\0\0\0\0\0+d"..., 16384, 475168768) = 16384
16:10:10 pread(256, "\25\302\0\0s\0\0\0\377\254\3338\377\377\1\4u\31\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 16384, 475185152) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(256, "\25\302\0\0i\4\0\0p<\3338\377\377\1\4(\324\0\0=\2\0\0\30\1\0\0v\0301;"..., 16384, 480395264) = 16384
16:10:10 pread(258, "\25\302\0\0|\4\0\0\200\212\3338\377\377\1\4\25q\0\0l\2\0\0000\2\0\0z(2;"..., 16384, 480444416) = 16384
16:10:10 pread(257, "\25\302\0\0\232\4\0\0<r\3338\377\377\1\4\345\354\0\0`\2\0\0`\4\0\0\301]3;"..., 16384, 478445568) = 16384
16:10:10 pread(257, "\25\302\0\0\301\4\0\0!{\3338\377\377\1\4\3\247\0\0\216\2\0\0\301\10\0\0r\3015;"..., 16384, 477511680) = 16384
16:10:10 pread(257, "\25\302\0\0\35\5\0\0005\254\3218\377\377\1\4\376\274\0\0\350\2\0\0\177\21\0\0\36\7\24;"..., 16384, 478756864) = 16384
16:10:10 pread(258, "\25\302\0\0\323\1\0\00040\3338\377\377\1\4\261\306\0\0r\3650;\n\5\1\0\342\225\0\0"..., 16384, 473874432) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(257, "\25\302\0\0t\2\0\0qd\2407\377\377\1\4\251a\0\0u\332\2047\0\0\0\0\0\0\0\0"..., 16384, 475201536) = 16384
16:10:10 pread(257, "\25\302\0\0u\2\0\0\262\342\2638\377\377\1\4u\226\0\0bracontrolfi"..., 16384, 475217920) = 16384
16:10:10 pread(258, "\25\302\0\0x\2\0\0 \201\2708\377\377\1\4\t:\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 16384, 476184576) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 480264192) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(258, "\25\302\0\0000\3\0\0b\261\3338\377\377\1\4[\r\0\0\30\0\f\0\340\7\0\0\0\0\0\0"..., 16384, 477626368) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(258, "\25\302\0\0000\3\0\0b\261\3338\377\377\1\4[\r\0\0\30\0\f\0\340\7\0\0\0\0\0\0"..., 16384, 477626368) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 472924160) = 16384
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(258, "\25\302\0\0)\0\0\0j\261\3338\377\377\1\4\365\343\0\0\0\0\0\0\0\0\0\0k\237\2047"..., 16384, 473972736) = 16384
16:10:10 pread(258, "\25\302\0\0000\3\0\0b\261\3338\377\377\1\4[\r\0\0\30\0\f\0\340\7\0\0\0\0\0\0"..., 16384, 477626368) = 16384
# rev /tmp/aa1 | cut -f1 -d'=' | rev | sed -e 's/$/+/g' -e '$s/+$//g'| xargs echo| bc -l
950272
--//可以读的文件句柄是256,257,258.
# ls -l /proc/1443/fd | grep 25[678]
lrwx------ 1 root root 64 2018-11-29 16:10:11 256 -> /dev/asm-diskf
lrwx------ 1 root root 64 2018-11-29 16:10:11 257 -> /dev/asm-diskg
lrwx------ 1 root root 64 2018-11-29 16:10:11 258 -> /dev/asm-diske
--//可以发现对应以上裸设备.
--//单独看两个:
16:10:10 pread(257, "\25\302\0\0'\0\0\0j\261\3338\377\377\1\4}o\0\0\0\0p\0\0\0\200\0\0\0\0\0"..., 16384, 473022464) = 16384
16:10:10 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\355\376\0\0\0\0\0\0\0\4 \v+^\3665"..., 16384, 480264192) = 16384
$ man pread
pread(2) linux programmer's manual pread(2)
name
pread, pwrite - read from or write to a file descriptor at a given offset
synopsis
#define _xopen_source 500
#include
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
--//第1个是句柄,第2个参数缓存地址指针,第3个是读取长度,第4个是偏移量。
473022464/1024/1024 = 451.10937500000000000000
480264192/1024/1024 = 458.01562500000000000000
--//以grid用户登录,访问asm实例:
sql> column path format a40
sql> select disk_number,group_number,path from v$asm_disk where group_number=1 and disk_number in(1,0,2) order by 1;
disk_number group_number path
----------- ------------ ----------------------------------------
0 1 /dev/asm-diske
1 1 /dev/asm-diskf
2 1 /dev/asm-diskg
sql> select disk_kffxp, au_kffxp, xnum_kffxp,group_kffxp,number_kffxp from x$kffxp where (au_kffxp=451 or au_kffxp=458) and disk_kffxp=2;
disk_kffxp au_kffxp xnum_kffxp group_kffxp number_kffxp
---------- ---------- ---------- ----------- ------------
2 458 0 1 260
2 451 4 1 261
--//number_kffxp对应的是260,261.
--//使用asmcmd查看:
$ rlwrap asmcmd -p
asmcmd [+] > ls -l data/xxxxx/controlfile
type redund striped time sys name
controlfile unprot fine 2018/08/20 01:00:00 y current.260.931438443
controlfile unprot fine 2018/08/20 01:00:00 y current.261.931438443
--//如下查询:
sql> column type format a12
sql> select * from v$asm_file where type='controlfile' order by type;
group_number file_number compound_index incarnation block_size blocks bytes space type redund stripe creation_ modificat r permissions user_number user_incarnation usergroup_number usergroup_incarnation prim mirr hot_reads hot_writes hot_bytes_read hot_bytes_written cold_reads cold_writes cold_bytes_read cold_bytes_written
------------ ----------- -------------- ----------- ---------- ---------- ---------- ---------- ------------ ------ ------ --------- --------- - ---------------- ----------- ---------------- ---------------- --------------------- ---- ---- ---------- ---------- -------------- ----------------- ---------- ----------- --------------- ------------------
1 260 16777476 931438443 16384 1837 30097408 33554432 controlfile unprot fine 24-dec-16 20-aug-18 u rw-rw-rw- 0 0 0 0 cold cold 0 0 0 0 3146179 13420526 5.1548e+10 2.1988e+11
1 261 16777477 931438443 16384 1837 30097408 33554432 controlfile unprot fine 24-dec-16 20-aug-18 u rw-rw-rw- 0 0 0 0 cold cold 0 0 0 0 283440487 13420559 1.9953e+13 2.1988e+11
--//再次证明读取的是控制文件.
3.疑问:
# rev /tmp/aa1 | cut -f1 -d'=' | rev | sed -e 's/$/+/g' -e '$s/+$//g'| xargs echo| bc -l
950272
--//我跟踪看到的读950272.950272/1024 = 928k.
sys@xxxxx1> @ viewsess 'physical read total'
name statistic# value sid
---------------------------------------------------------------------- ---------- ---------- ----------
physical read total io requests 50 0 714
physical read total multi block requests 51 0 714
physical read total bytes optimized 53 0 714
physical read total bytes 55 0 714
sys@xxxxx1> @ c.txt
'flashpct;'||trim(ceil(percent_space_used))
-------------------------------------------------
flashpct;0
sys@xxxxx1> @ viewsess 'physical read total'
name statistic# value sid
---------------------------------------------------------------------- ---------- ---------- ----------
physical read total io requests 50 73 714
physical read total multi block requests 51 15 714
physical read total bytes optimized 53 0 714
physical read total bytes 55 13828096 714
--//13828096/1024/1024 = 13.1875m,为什么呢?
# wc /tmp/aa1
58 422 7310 /tmp/aa1
--//我重复使用strace做了跟踪:
# strace -p 24584 -t -o /tmp/aa2
# strace -p 24584 -t -c
process 24584 attached - interrupt to quit
^cprocess 24584 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
-nan 0.000000 0 4 read
-nan 0.000000 0 2 write
-nan 0.000000 0 2 open
-nan 0.000000 0 2 close
-nan 0.000000 0 2 mmap
-nan 0.000000 0 58 pread
-nan 0.000000 0 4 semctl
-nan 0.000000 0 20 getrusage
-nan 0.000000 0 16 times
-nan 0.000000 0 16 io_getevents
-nan 0.000000 0 15 io_submit
-nan 0.000000 0 2 semtimedop
------ ----------- ----------- --------- --------- ----------------
100.00 0.000000 143 total
--//可以看到io_submit异步io操作.等于15,正好和physical read total multi block requests的数值一致.
--//pread=58(与wc /tmp/aa1看到一致),io_submit=15,相加正好与physical read total io requests=73一致.不知道是否是巧合.我对异步io操作的函数不熟悉.
16:45:26 io_submit(140402112221184, 8, {{0x7fb1e81f8210, 0, 0, 0, 256}, {0x7fb1e81f8480, 0, 0, 0, 258},
{0x7fb1e81f86f0, 0, 0, 0, 257}, {0x7fb1e81f8960, 0, 0, 0, 258},
{0x7fb1e81f8bd0, 0, 0, 0, 257}, {0x7fb1e81f8e40, 0, 0, 0, 256},
{0x7fb1e81f90b0, 0, 0, 0, 258}, {0x7fb1e81f9320, 0, 0, 0, 257}}) = 8
--//猜测里面的256,257,258对应文件句柄.
# man io_submit
io_submit(2) linux programmer's manual io_submit(2)
name
io_submit - submit asynchronous i/o blocks for processing
synopsis
#include <libaio.h>
int io_submit(aio_context_t ctx_id, long nr, struct iocb **iocbpp);
link with -laio.
description
io_submit() queues nr i/o request blocks for processing in the aio context ctx_id. iocbpp should be an array of
nr aio control blocks, which will be submitted to context ctx_id.
# man io_getevents
io_getevents(2) linux programmer's manual io_getevents(2)
name
io_getevents - read asynchronous i/o events from the completion queue
synopsis
#include <linux/time.h>
#include <libaio.h>
int io_getevents(aio_context_t ctx_id, long min_nr, long nr,
struct io_event *events, struct timespec *timeout);
link with -laio.
description
io_getevents() attempts to read at least min_nr events and up to nr events from the completion queue of the aio
context specified by ctx_id. timeout specifies the amount of time to wait for events, where a null timeout waits
until at least min_nr events have been seen. note that timeout is relative and will be updated if not null and
the operation blocks.
# egrep 'io_submit|io_getevents' /tmp/aa2
16:45:26 io_submit(140402112221184, 8, {{0x7fb1e81f8210, 0, 0, 0, 256}, {0x7fb1e81f8480, 0, 0, 0, 258}, {0x7fb1e81f86f0, 0, 0, 0, 257}, {0x7fb1e81f8960, 0, 0, 0, 258}, {0x7fb1e81f8bd0, 0, 0, 0, 257}, {0x7fb1e81f8e40, 0, 0, 0, 256}, {0x7fb1e81f90b0, 0, 0, 0, 258}, {0x7fb1e81f9320, 0, 0, 0, 257}}) = 8
16:45:26 io_getevents(140402112221184, 8, 128, {{0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 81920, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}}, {600, 0}) = 8
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 257}, {0x7fb1e81f8480, 0, 0, 0, 256}, {0x7fb1e81f86f0, 0, 0, 0, 258}, {0x7fb1e81f8960, 0, 0, 0, 257}, {0x7fb1e81f8bd0, 0, 0, 0, 258}, {0x7fb1e81f8e40, 0, 0, 0, 257}, {0x7fb1e81f90b0, 0, 0, 0, 256}, {0x7fb1e81f9320, 0, 0, 0, 258}, {0x7fb1e81f9590, 0, 0, 0, 257}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f8210, 0x7fb1e81f8210, 81920, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 49152, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}}, {600, 0}) = 9
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 257}, {0x7fb1e81f8480, 0, 0, 0, 256}, {0x7fb1e81f86f0, 0, 0, 0, 258}, {0x7fb1e81f8960, 0, 0, 0, 257}, {0x7fb1e81f8bd0, 0, 0, 0, 258}, {0x7fb1e81f8e40, 0, 0, 0, 257}, {0x7fb1e81f90b0, 0, 0, 0, 256}, {0x7fb1e81f9320, 0, 0, 0, 258}, {0x7fb1e81f9590, 0, 0, 0, 257}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f8210, 0x7fb1e81f8210, 81920, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 49152, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}}, {600, 0}) = 9
16:45:26 io_submit(140402112221184, 5, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}, {0x7fb1e81f8960, 0, 0, 0, 258}, {0x7fb1e81f8bd0, 0, 0, 0, 257}}) = 5
16:45:26 io_getevents(140402112221184, 5, 128, {{0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8210, 0x7fb1e81f8210, 81920, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 49152, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}}, {600, 0}) = 5
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}, {0x7fb1e81f8960, 0, 0, 0, 258}, {0x7fb1e81f8bd0, 0, 0, 0, 257}, {0x7fb1e81f8e40, 0, 0, 0, 256}, {0x7fb1e81f90b0, 0, 0, 0, 258}, {0x7fb1e81f9320, 0, 0, 0, 257}, {0x7fb1e81f9590, 0, 0, 0, 256}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0}}, {0, 0}) = 1
16:45:26 io_getevents(140402112221184, 8, 128, {{0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 114688, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}}, {600, 0}) = 8
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}, {0x7fb1e81f8960, 0, 0, 0, 257}, {0x7fb1e81f8bd0, 0, 0, 0, 256}, {0x7fb1e81f8e40, 0, 0, 0, 258}, {0x7fb1e81f90b0, 0, 0, 0, 257}, {0x7fb1e81f9320, 0, 0, 0, 256}, {0x7fb1e81f9590, 0, 0, 0, 258}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 114688, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}}, {600, 0}) = 9
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}, {0x7fb1e81f8960, 0, 0, 0, 257}, {0x7fb1e81f8bd0, 0, 0, 0, 256}, {0x7fb1e81f8e40, 0, 0, 0, 258}, {0x7fb1e81f90b0, 0, 0, 0, 257}, {0x7fb1e81f9320, 0, 0, 0, 256}, {0x7fb1e81f9590, 0, 0, 0, 258}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}, {0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 114688, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}}, {600, 0}) = 9
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}, {0x7fb1e81f8960, 0, 0, 0, 257}, {0x7fb1e81f8bd0, 0, 0, 0, 256}, {0x7fb1e81f8e40, 0, 0, 0, 258}, {0x7fb1e81f90b0, 0, 0, 0, 257}, {0x7fb1e81f9320, 0, 0, 0, 256}, {0x7fb1e81f9590, 0, 0, 0, 258}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 114688, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}}, {600, 0}) = 9
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}, {0x7fb1e81f8960, 0, 0, 0, 257}, {0x7fb1e81f8bd0, 0, 0, 0, 256}, {0x7fb1e81f8e40, 0, 0, 0, 258}, {0x7fb1e81f90b0, 0, 0, 0, 257}, {0x7fb1e81f9320, 0, 0, 0, 256}, {0x7fb1e81f9590, 0, 0, 0, 258}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0}}, {0, 0}) = 1
16:45:26 io_getevents(140402112221184, 8, 128, {{0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 114688, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}}, {600, 0}) = 8
16:45:26 io_submit(140402112221184, 3, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}}) = 3
16:45:26 io_getevents(140402112221184, 3, 128, {{0x7fb1e81f86f0, 0x7fb1e81f86f0, 114688, 0}, {0x7fb1e81f8210, 0x7fb1e81f8210, 49152, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}}, {600, 0}) = 3
16:45:26 io_submit(140402112221184, 3, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 258}}) = 3
16:45:26 io_getevents(140402112221184, 3, 128, {{0x7fb1e81f8210, 0x7fb1e81f8210, 114688, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 81920, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}}, {600, 0}) = 3
16:45:26 io_submit(140402112221184, 6, {{0x7fb1e81f8210, 0, 0, 0, 257}, {0x7fb1e81f8480, 0, 0, 0, 258}, {0x7fb1e81f86f0, 0, 0, 0, 257}, {0x7fb1e81f8960, 0, 0, 0, 256}, {0x7fb1e81f8bd0, 0, 0, 0, 258}, {0x7fb1e81f8e40, 0, 0, 0, 257}}) = 6
16:45:26 io_getevents(140402112221184, 6, 128, {{0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 114688, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}}, {600, 0}) = 6
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 257}, {0x7fb1e81f8480, 0, 0, 0, 258}, {0x7fb1e81f86f0, 0, 0, 0, 257}, {0x7fb1e81f8960, 0, 0, 0, 256}, {0x7fb1e81f8bd0, 0, 0, 0, 258}, {0x7fb1e81f8e40, 0, 0, 0, 257}, {0x7fb1e81f90b0, 0, 0, 0, 256}, {0x7fb1e81f9320, 0, 0, 0, 258}, {0x7fb1e81f9590, 0, 0, 0, 257}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 114688, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}}, {600, 0}) = 9
16:45:26 io_submit(140402112221184, 7, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}, {0x7fb1e81f8960, 0, 0, 0, 258}, {0x7fb1e81f8bd0, 0, 0, 0, 257}, {0x7fb1e81f8e40, 0, 0, 0, 256}, {0x7fb1e81f90b0, 0, 0, 0, 258}}) = 7
16:45:26 io_getevents(140402112221184, 7, 128, {{0x7fb1e81f8210, 0x7fb1e81f8210, 81920, 0}, {0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 16384, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}}, {600, 0}) = 7
16:45:26 io_submit(140402112221184, 9, {{0x7fb1e81f8210, 0, 0, 0, 258}, {0x7fb1e81f8480, 0, 0, 0, 257}, {0x7fb1e81f86f0, 0, 0, 0, 256}, {0x7fb1e81f8960, 0, 0, 0, 258}, {0x7fb1e81f8bd0, 0, 0, 0, 257}, {0x7fb1e81f8e40, 0, 0, 0, 256}, {0x7fb1e81f90b0, 0, 0, 0, 258}, {0x7fb1e81f9320, 0, 0, 0, 257}, {0x7fb1e81f9590, 0, 0, 0, 256}}) = 9
16:45:26 io_getevents(140402112221184, 9, 128, {{0x7fb1e81f86f0, 0x7fb1e81f86f0, 131072, 0}, {0x7fb1e81f8210, 0x7fb1e81f8210, 49152, 0}, {0x7fb1e81f8480, 0x7fb1e81f8480, 131072, 0}, {0x7fb1e81f8e40, 0x7fb1e81f8e40, 131072, 0}, {0x7fb1e81f9590, 0x7fb1e81f9590, 81920, 0}, {0x7fb1e81f8bd0, 0x7fb1e81f8bd0, 131072, 0}, {0x7fb1e81f9320, 0x7fb1e81f9320, 131072, 0}, {0x7fb1e81f90b0, 0x7fb1e81f90b0, 131072, 0}, {0x7fb1e81f8960, 0x7fb1e81f8960, 131072, 0}}, {600, 0}) = 9
--//我的感觉把io_getevents 函数里面的16384,131072加起来就是读取的字节总数.
# grep 'io_getevents' /tmp/aa2 | sed '1,$s/{/\^j/g' | grep "^0x" | cut -f3 -d, | sed -e 's/$/+/g' -e '$s/+$//g'| xargs echo| bc -l
12877824
--//12877824+950272 = 13828096
--//^_^.正好和如下看到的一致.佩服一下自己..^_^.
sys@xxxxx1> @ viewsess 'physical read total'
name statistic# value sid
---------------------------------------------------------------------- ---------- ---------- ----------
physical read total io requests 50 73 714
physical read total multi block requests 51 15 714
physical read total bytes optimized 53 0 714
physical read total bytes 55 13828096 714
---//简单说明一下以上命令.# grep 'io_getevents' /tmp/aa2 | sed '1,$s/{/\^j/g' | grep "^0x" | cut -f3 -d, | sed -e 's/$/+/g' -e '$s/+$//g'| xargs echo| bc -l
1. grep 'io_getevents' /tmp/aa2 --//过滤出来io_getevents函数.
2. sed '1,$s/{/\^j/g' --//将{替换为回车,^j在linux下先输入ctrl+v在按ctrl+enter就可以了,前面的\避免转义.
3. grep "^0x" --//过滤0x开头的行.
# grep 'io_getevents' /tmp/aa2 | sed '1,$s/{/\^j/g' | grep "^0x" | head -1
0x7fb1e81f8210, 0x7fb1e81f8210, 16384, 0},
4.cut -f3 -d, --//以,为分隔符,取第3个字段.也就是里面16384.输出.
5.sed -e 's/$/+/g' -e '$s/+$//g'--//在每行结尾加入+,最后一行删除+号.
# grep 'io_getevents' /tmp/aa2 | sed '1,$s/{/\^j/g' | grep "^0x" | cut -f3 -d, | sed -e 's/$/+/g' -e '$s/+$//g' | tail -5
81920+
131072+
131072+
131072+
131072
6.xargs echo --//也就是把多行变成一行,这里注意命令行缓存大小,一般情况下不会溢出的.
7.bc -l --//也就是计算.
--//顺便说一下bash shell编程一般不考虑执行效率,仅仅考虑快速编程,完成对应的工作.估计awk也许更好.
4.总结:
--//写这篇blog我参考以前遇到的问题,链接:http://blog.itpub.net/267265/viewspace-751787/,当时我应该看到读取调用函数是pread.
--//这个函数应该不支持异步io.仅仅io_submit,io_getevents才表明系统执行异步io.
--//也就是讲实际上就算是asm系统,实际上有1部分读取使用pread函数.而不是全部使用异步io.