mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:19:26 +08:00
up
This commit is contained in:
@@ -286,7 +286,8 @@ label.checkbox_label span {
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$.getScript( "/plugins/file?name=&f=js/app.js", function(){
|
||||
pluginService('migration_api',$('.plugin_version').attr('version'));
|
||||
$.getScript( "/plugins/file?name=migration_api&f=js/app.js", function(){
|
||||
// pluginService('migration_api',$('.plugin_version').attr('version'));
|
||||
initStep();
|
||||
});
|
||||
</script>
|
||||
@@ -56,3 +56,22 @@ function maPostCallbak(method, args, callback){
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
|
||||
function initStep(){
|
||||
$('.infoNext').click(function(){
|
||||
var step = $('.step_head .active span').text();
|
||||
console.log(step);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,4 +26,5 @@ fi
|
||||
# $RUN_CMD --stap --shdict 'limit 10m' test_find_server_name.lua
|
||||
|
||||
# $RUN_CMD test_rand.lua
|
||||
$RUN_CMD test_ffi_time.lua
|
||||
# $RUN_CMD test_ffi_time.lua
|
||||
$RUN_CMD test_get_cpu.lua
|
||||
@@ -0,0 +1,59 @@
|
||||
local function target()
|
||||
ngx.re.find("hello, world.", [[\w+\.]], "jo")
|
||||
end
|
||||
for i = 1, 100 do
|
||||
target()
|
||||
end
|
||||
|
||||
function file_exists(path)
|
||||
local file = io.open(path, "rb")
|
||||
if file then file:close() end
|
||||
return file ~= nil
|
||||
end
|
||||
|
||||
-- 以上为预热操作
|
||||
collectgarbage()
|
||||
|
||||
|
||||
function get_cpu_stat()
|
||||
local cpu_total = 0
|
||||
local fp = io.open('/proc/stat','r')
|
||||
local cpu_line = fp:read()
|
||||
fp:close()
|
||||
|
||||
|
||||
local iterator, err = ngx.re.gmatch(cpu_line,"(d+)")
|
||||
while true do
|
||||
local m, err = iterator()
|
||||
if not m then
|
||||
break
|
||||
end
|
||||
cpu_total = cpu_total + m[0]
|
||||
end
|
||||
return cpu_total
|
||||
end
|
||||
|
||||
function get_cpu_percent()
|
||||
local fp = io.open("/proc/stat","r")
|
||||
local cpu_line = fp:read()
|
||||
fp:close()
|
||||
local iterator, err = ngx.re.gmatch(cpu_line,"(d+)")
|
||||
while true do
|
||||
local m, err = iterator()
|
||||
if not m then
|
||||
break
|
||||
end
|
||||
cpu_total1 = cpu_total1 + m[0]
|
||||
end
|
||||
end
|
||||
|
||||
ngx.update_time()
|
||||
local begin = ngx.now()
|
||||
local N = 1e2
|
||||
for i = 1, N do
|
||||
get_cpu_stat()
|
||||
end
|
||||
ngx.update_time()
|
||||
|
||||
ngx.say("test_get_cpu elapsed: ", (ngx.now() - begin))
|
||||
|
||||
Reference in New Issue
Block a user