[20190401]隐含参数_mutex_spin_count.txt
[20190401]隐含参数_mutex_spin_count.txt
--//上午做了一些测试关于semtimedop函数调用,发现自己上个星期在一些问题上理解错误.
--//相关链接:
--//http://blog.itpub.net/267265/viewspace-2640002/
--//http://blog.itpub.net/267265/viewspace-2639675/
--//我当时相当然认为:
16:04:56.410785 semtimedop(309166080, 0x7fff83068fd0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010684>
--//{0, 10000000} 是 timespec. 前面单位是秒,后面单位是纳秒(毫微秒) 1秒=10^9纳秒, 10000000/10^9 = .01.
--//这样每次调用semtimedop需要0.010xXX秒.
--//我的理解相当于不断spin,检查这个资源是否可用.2秒后调用getrusage.
--//我一直以为0.010684秒中的0.000684秒是spin的时间,犯了一个严重错误,主要不熟悉os函数调用.
1.环境:
SCOTT@book> @ 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 m2.txt
set verify off
column a noprint new_value v_a;
select mod ( &&3 ,3) a from dual ;
alter session set optimizer_index_caching= &v_a;
host sleep $(echo &&3/50| bc -l )
insert into job_times values ( sys_context ('userenv', 'sid') ,dbms_utility.get_time ,'&&2') ;
commit ;
declare
v_id number;
v_d date;
begin
for i in 1 .. &&1 loop
--select 1 into v_id from dual ;
--select sysdate into v_d from dual ;
select deptno into v_id from dept where deptno=10;
end loop;
end ;
/
update job_times set time_ela = dbms_utility.get_time - time_ela where sid=sys_context ('userenv', 'sid') and method='&&2';
commit;
2.测试:
$ seq 150 | xargs -I {} -P 150 bash -c "sqlplus -s -l scott/book @m2.txt 1e6 f2_150 {} >/dev/null"
SYS@book> @ mutexy 5 a31kd5tkdvvmm
HASH SUM_SLEEPS SUM_GETS LOCATION MUTEX_TYPE MUTEX_ADDR SQLID KGLNAOWN C100
---------- ---------- ---------- ------------------------------ -------------------- ---------------- ------------- -------------------- ---------------------------------------
1692266099 759340 1.5029E+10 kksLockDelete [KKSCHLPIN6] Cursor Pin 000000007C3104F0 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 534864 1.0520E+10 kksfbc [KKSCHLFSP2] Cursor Pin 000000007C3104F0 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 10 97864344 kksHeapReadUnlock [KKSCHLRDUP] Cursor Pin 000000007C3104F0 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
--//MUTEX_ADDR=000000007C3104F0
--//session 1:
SCOTT@book> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
51 3 60173 DEDICATED 60174 27 121 alter system kill session '51,3' immediate;
--//51=0x33,进程号=60174.
--//session 22
SYS@book> oradebug setmypid
Statement processed.
SYS@book> oradebug peek 0x000000007C3104F0 8
[07C3104F0, 07C3104F8) = 00000000 00000000
SYS@book> oradebug poke 0x000000007C3104F0 8 0x0000000100000033
BEFORE: [07C3104F0, 07C3104F8) = 00000000 00000000
AFTER: [07C3104F0, 07C3104F8) = 00000033 00000001
--//人为设置阻塞,前面4位阻塞sid,后面表示ref count.
--//修改_mutex_spin_count参数:
SCOTT@book> @ m2.txt 1 c1 0
1 row created.
Commit complete.
--//挂起!!
$ strace -fTr -p 60258
Process 60258 attached - interrupt to quit
0.010452 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010918>
0.011051 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010854>
0.010987 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010806>
0.010939 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010908>
0.011039 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010828>
0.010959 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010909>
0.011041 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010872>
0.011015 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010814>
0.010945 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010904>
0.011037 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010873>
0.011008 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010821>
0.010953 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010900>
0.011032 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010886>
0.011018 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010824>
0.010955 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010939>
0.011072 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010867>
0.010998 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010821>
0.010957 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010873>
0.011005 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010865>
0.010997 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010868>
0.011023 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010850>
0.010983 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010839>
0.010971 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010897>
0.011034 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010858>
0.010992 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010836>
0.010970 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010896>
0.011029 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010870>
0.011004 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010831>
0.010963 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010902>
0.011035 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010890>
0.011023 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010823>
0.010956 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010892>
0.011023 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010874>
0.011007 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010835>
0.010971 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010883>
0.011021 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010885>
0.011019 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010850>
0.010991 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010858>
0.010991 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010830>
0.010962 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010903>
0.011037 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010854>
0.010997 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010838>
0.010982 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010909>
0.011046 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010868>
0.011011 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010795>
0.010928 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010906>
0.011037 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010878>
0.011009 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010821>
0.010953 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010901>
0.011033 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010884>
0.011016 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010858>
0.010996 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010857>
0.010988 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010868>
0.011003 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010873>
0.011010 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010860>
0.010993 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010862>
0.010993 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010875>
0.011030 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010841>
0.010973 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010850>
0.010982 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010924>
0.011082 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010830>
0.010966 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010804>
0.010937 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010897>
0.011030 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010887>
0.011020 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010822>
0.010958 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010892>
0.011025 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010867>
0.010999 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010852>
--//过滤semtimedop,截取第1列,注意排除第1行最后1行.保存文件为/tmp/a1.txt.
SYS@book> oradebug poke 0x000000007C3104F0 8 0x0
BEFORE: [07C3104F0, 07C3104F8) = 00000033 00000002
AFTER: [07C3104F0, 07C3104F8) = 00000000 00000000
$ awk '{print $1}' /tmp/a1.txt | sed 1d | sed '$d' |awk '{j++;i=i+$NF}END{print i,i/j}'
0.726011 0.0110002
--//可以发现上一个函数semtimedop调用,与下一个调用.平均值是0.0110002秒.
3.修改参数_mutex_spin_count:
SYS@book> alter system set "_mutex_spin_count"=11165535 scope=memory;
alter system set "_mutex_spin_count"=11165535 scope=memory
*
ERROR at line 1:
ORA-00068: invalid value 11165535 for parameter _mutex_spin_count, must be between 0 and 65535
--//_mutex_spin_count 最大65535.
SYS@book> alter system set "_mutex_spin_count"=65535 scope=memory;
System altered.
--//重复前面的步骤:
$ strace -fTr -p 60258
...
0.010478 getrusage(RUSAGE_SELF, {ru_utime={33, 230948}, ru_stime={0, 146977}, ...}) = 0 <0.000019>
0.000107 getrusage(RUSAGE_SELF, {ru_utime={33, 230948}, ru_stime={0, 146977}, ...}) = 0 <0.000017>
0.001643 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010135>
0.011752 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010376>
0.011982 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010381>
0.011983 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010405>
0.012077 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010339>
0.011976 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010343>
0.011936 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010422>
0.012068 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010353>
0.011988 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010351>
0.011949 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010416>
0.012424 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.011000>
0.012631 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010349>
0.011949 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010414>
0.012045 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010371>
0.012010 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010342>
0.011940 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010415>
0.012240 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010196>
0.011838 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010328>
0.011983 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010372>
0.011996 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010375>
0.012006 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010320>
0.011954 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010390>
0.012018 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010401>
0.011983 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010390>
0.011992 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010408>
0.011957 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010451>
0.012061 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010391>
0.012019 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010382>
0.011960 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010383>
0.011980 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010442>
0.012022 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010413>
0.011993 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010478>
0.012058 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010383>
0.011934 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010397>
0.011974 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010456>
0.012037 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010431>
0.012049 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010334>
0.011914 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010454>
0.012035 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010425>
0.012031 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010389>
0.011995 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010396>
0.011975 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010385>
0.011990 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010427>
0.012004 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010428>
0.012033 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010414>
0.012020 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010381>
0.011931 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010405>
0.012008 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010438>
0.012025 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010424>
0.012010 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010360>
0.011969 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010428>
0.011988 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010408>
0.011986 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010458>
0.012066 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010396>
0.012011 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010343>
0.011902 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010480>
0.012029 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010456>
0.012071 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010338>
0.011949 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010449>
0.012000 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010451>
0.012058 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010375>
0.011981 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010392>
0.012395 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.011006>
0.012610 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010377>
0.011955 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010402>
0.012004 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010420>
0.012008 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010426>
0.012004 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010373>
0.011976 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010438>
0.012046 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010402>
0.012009 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010342>
0.011920 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010462>
0.012011 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010419>
0.011998 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010457>
0.012071 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010397>
0.012006 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010379>
0.011973 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010405>
0.011981 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010399>
0.012004 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010418>
0.011992 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010431>
0.011991 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010400>
0.012003 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010436>
0.012044 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010356>
0.011962 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010430>
0.012032 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010407>
0.011960 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010397>
0.011998 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010436>
0.012017 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010435>
0.012063 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010318>
0.011924 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010437>
0.011986 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010448>
0.012026 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010434>
0.012015 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010405>
0.011982 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010413>
0.011992 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010428>
0.012005 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010428>
0.012004 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010427>
0.012055 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010364>
0.011915 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010417>
0.012020 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010441>
0.012039 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010390>
0.011991 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010386>
0.011963 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010438>
0.012019 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010383>
0.011988 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010434>
0.012018 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010426>
0.012053 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010323>
0.011907 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010455>
0.012031 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010423>
0.012001 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010446>
0.012050 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}) = -1 EAGAIN (Resource temporarily unavailable) <0.010384>
0.011963 semtimedop(309821440, 0x7fffe52f56a0, 1, {0, 10000000}^C <unfinished ...>
--//过滤semtimedop,截取第1列,注意排除第1行最后1行.保存文件为/tmp/a1.txt.
$ awk '{print $1}' /tmp/a2.txt | sed 1d | sed '$d' |awk '{j++;i=i+$NF}END{print i,i/j}'
1.30971 0.0120157
--//可以发现上一个函数semtimedop调用,与下一个调用.平均值是0.0120157秒.
--//存在0.012-0.011 = 0.001差距. 虽然很小还是看出差距.
--//肉眼也可以发现后面的时间间隔基本是0.012xxx或者0.0119xxx.
--//再次测试:
$ strace -fTr -p 60258 -o /tmp/c1.txt
$ awk '{print $3}' /tmp/c1.txt | uniq -c |egrep "semtimedop|getrusag"
119 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
166 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
167 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
166 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
167 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
166 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
166 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
167 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
166 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
167 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
166 semtimedop(309821440,
2 getrusage(RUSAGE_SELF,
...
--//semtimedop 167或者166次, getrusage 2次.也就是2秒时间内比原来调用semtimedop的次数少几次,原来是182次.
--//参考链接:http://blog.itpub.net/267265/viewspace-2639675/
4.继续修改参数_mutex_spin_count:
SYS@book> alter system set "_mutex_spin_count"=0 scope=memory;
System altered.
--//基本看不出来.
--//补充cpu使用情况, "_mutex_spin_count"=65535.
# top -p 60258
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
60258 oracle 20 0 877m 40m 37m R 12.0 0.0 1:52.99 oracle
--//"_mutex_spin_count"=65535.
# top -p 60258
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
60258 oracle 20 0 877m 40m 37m S 0.3 0.0 1:58.61 oracle
--//从cpu的消耗也可以看出spin数量增加的情况下cpu消耗增加.
5.总结:
总之,时间间隔很小,但是还是能看出变化.
不过cpu的使用率还是可以看出明显的变化.