This commit is contained in:
midoks
2023-02-12 17:29:29 +08:00
parent 8f36e0ccb2
commit 083fe59fa5
4 changed files with 83 additions and 3 deletions
+3 -2
View File
@@ -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>
+19
View File
@@ -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);
});
}
+2 -1
View File
@@ -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
+59
View File
@@ -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))