[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.
[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.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2222208/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20181129]大量的control file sequential read.txt
- I/O上的等待事件 —— control file sequential read/control file parallel write事件Parallel
- 【等待事件】db file sequential read事件
- db file sequential read等待事件事件
- 等待事件db file sequential read、db file scattered read和direct read的區別事件
- 【TUNE_ORACLE】等待事件之IO等待“db file sequential read”Oracle事件
- 如何檢視Control File中儲存的內容
- 每週分享第 4 期(20181130)
- 邏輯STANDBY建立中碰到ORA-16146: standby destination control file enqueue unavailableENQAI
- [20180905]lob與direct path read.txt
- An Analysis of Sequential Recommendation Datasets
- 轉:Intellij idea Version Control File Status Colors ( 版本控制檔案狀態顏色 )IntelliJIdea
- SEQUENTIAL 隨筆備份
- Pytorch --- nn.Sequential()模組PyTorch
- Pytorch——torch.nn.Sequential()詳解PyTorch
- 序列推薦模型梳理(Sequential Recommendation)模型
- [20181130]如何猜測那些值存在hash衝突.txt
- [20181130]hash衝突導致查詢緩慢.txt
- WPF Customize control
- Cache-Control
- User Account Control
- Leetcode 2453. Destroy Sequential Targets | rust 實現LeetCodeRust
- An Attentive Inductive Bias for Sequential Recommendation beyond the Self-Attention
- 【論文筆記】Bridging Hierarchical and Sequential Context Modeling筆記Context
- HTML 24 - Form ControlHTMLORM
- Cache-Control指令
- Statistical Process Control in SAP
- Control charts in SAP QM
- Cache-Control for Civilians
- cat > file << EOF 與 cat > file << -
- CHEE 4703: Process Dynamics and Control
- Cys_Control(六) MTreeViewView
- Session, LocalStorage ,Cache-ControlSession
- File
- Macs Fan Control Pro啟用碼+Macs Fan Control Pro 中文安裝包Mac
- Macs Fan Control Pro中文破解版+Macs Fan Control Pro啟用碼Mac
- How to Convert Class File to Java File Online?Java
- Python TensorFlow深度神經網路迴歸:keras.SequentialPython神經網路Keras