[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.环境:
[email protected]> @ 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"

[email protected]> @ 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:
[email protected]> @ 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
[email protected]> oradebug setmypid
Statement processed.

[email protected]> oradebug peek 0x000000007C3104F0 8
[07C3104F0, 07C3104F8) = 00000000 00000000

[email protected]> oradebug poke 0x000000007C3104F0 8 0x0000000100000033
BEFORE: [07C3104F0, 07C3104F8) = 00000000 00000000
AFTER:  [07C3104F0, 07C3104F8) = 00000033 00000001
--//人为设置阻塞,前面4位阻塞sid,后面表示ref count.
--//修改_mutex_spin_count参数:

[email protected]> @ 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.

[email protected]> 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:

[email protected]> 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.

[email protected]> 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:

[email protected]> 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的使用率还是可以看出明显的变化.

原文地址:https://www.cnblogs.com/lfree/p/10637212.html

时间: 2024-11-09 00:32:31

[20190401]隐含参数_mutex_spin_count.txt的相关文章

js的隐含参数(arguments,callee,caller)使用方法

在提到上述的概念之前,首先想说说javascript中函数的隐含参数: arguments arguments 该对象代表正在执行的函数和调用它的函数的参数.[function.]arguments[n]参数function:选项.当前正在执行的 Function 对象的名字. n :选项.要传递给 Function 对象的从0开始的参数值索引.说明Arguments是进行函数调用时,除了指定的参数外,还另外创建的一个隐藏对象.Arguments是一个类似数组但不是数组的对象,说它类似数组是因为

Scala隐含参数详解

隐含参数隐含参数列表(implicit p1,...,pn)将参数p1,...,pn标记为隐含的.一个方法或构造器仅能有一个隐含参数列表,且必须是给出的参数列表的最后一个.具有隐含参数列表的方法可以像正常方法一样应用到参量上.这种情况下implicit标识符没有作用.然而如果该方法没有隐含参数列表中的参量,对应的参量会自动提供.有两种情况实体参量可以传递给类型为T隐含参数.首先,所有的标识符x可以在方法被调用的地方无需前缀就可以访问到,且该标识符表示一个隐含定义(§7.1)或隐含参数.一个可用的

隐含参数“_allow_resetlogs_corruption”的用法

当数据库中某些数据文件损坏,而从备份恢复这个文件所需的某个(或某些)联机日志文件或归档日志文件丢失时,只能把这些文件部分恢复,从而与数据库中其他文件不同步,我们可以通过下面的步骤还原并打开数据库: 用之前的备份恢复损坏的数据文件. 尽量还原损坏的文件. 把数据库启动到nomount. 用SQL命令重建控制文件(要求之前用“alter database backup controlfile to trace”做过控制文件的文本备份) 设置隐含参数:alter system set “_allow_

shutdown abort模式丢失redo,使用隐含参数启库

shutdown abort模式 丢失redo log 无法open数据库 通过告警报错ORA-00354: corrupt redo log block header 从该错误可以看出当前日志的redo block的header出现问题,导致oracle无法读取redo进行恢复.通过以下检查发现数据库文件头都一致,没有需要恢复的文件,但是由于数据库是非正常关闭,last_change scn没有被写入,数据库判断需要恢复,则读取相应的redo log group 3,但是此时该文件已经损坏.

传递给函数的隐含参数:arguments及递归函数的实现

传递给函数的隐含参数:arguments当进行函数调用时,除了指定的参数外,还创建一个隐含的对象——arguments.arguments是一个类似数组但不是数组的对象,说它类似是因为它具有数组一样的访问性质,可以用arguments[index]这样的语法取值,拥有数组长度属性length.arguments 对象存储的是实际传递给函数的参数,而不只局限于函数声明所定义的参数列表,例如:function func(a,b){alert(a);alert(b);for(var i=0;i<arg

11G利用隐含参数,修改用户名

步骤概述: 1. 停库,修改隐含参数_enable_rename_user 为true 2. 以 restrict方式启动数据库 3.  alter user  aaaa   rename   to  bbbb identified by  bbbb123; 4. 正常重启数据库 以下是测试步骤: 一.查看  隐含参数“_enable_rename_user”  默认是禁止 set linesize 321column name format a30column value format a25

oracle隐含参数修改与查看

oracle隐含参数修改与查看 alter system set "_allow_resetlogs_corruption"=false scope=spfile sid='*'; col name for a30;col value for a10;selectx.ksppinm  name,y.ksppstvl  value,y.ksppstdf  isdefault,decode(bitand(y.ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','

WebService 实现BS环境与BS环境传递参数,根据参数生成txt文档

客户端: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Client.aspx.cs" Inherits="客户端.Client" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"><head runat="ser

JS构造函数、原型对象、隐含参数this

This 解析器再调用函数每次都会向函数内部传递一个隐含的参数this,this指向的是一个对象(函数执行的上下文对象) 1.以函数形式调用时,this永远是window. 2.以方法形式调用时,this就是调用方法的那个对象 3.当以构造函数的形式调用时,this就是新创建的那个对象 使用工厂的方法创建对象 通过该方法可以大批量的创建对象,这样创建的对象使用的构造函数都是Object,无法区分多种不同类型的对象. function create(name,age,geder){ var obj