From 877aebdc2675986fce873272455d3530ce282907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 2 Nov 2020 11:49:44 +0800 Subject: =?UTF-8?q?Revert=20"=E5=90=8E=E5=8F=B0cpu=E6=B6=88=E8=80=97"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 33beca3671744d7d7add8310774a5b01c3392188. --- script-beta/config.lua | 3 --- script-beta/service/service.lua | 11 ----------- 2 files changed, 14 deletions(-) diff --git a/script-beta/config.lua b/script-beta/config.lua index d12107cc..99f701fd 100644 --- a/script-beta/config.lua +++ b/script-beta/config.lua @@ -149,9 +149,6 @@ local ConfigTemplate = { enable = {false, Boolean}, path = {'.vscode/lua-plugin/*.lua', String}, }, - misc = { - backGroundCPU = {10, Integer}, - } } local OtherTemplate = { diff --git a/script-beta/service/service.lua b/script-beta/service/service.lua index 3e912cb7..11cc7b19 100644 --- a/script-beta/service/service.lua +++ b/script-beta/service/service.lua @@ -4,7 +4,6 @@ local await = require 'await' local timer = require 'timer' local proto = require 'proto' local vm = require 'vm' -local config = require 'config' local m = {} m.type = 'service' @@ -134,23 +133,13 @@ function m.report() end function m.startTimer() - local clock = os.clock() while true do ::CONTINUE:: pub.step() if await.step() then - local passed = os.clock() - clock - local cpu = config.config.misc.backGroundCPU - if cpu >= 1 and cpu < 100 then - local sleepRate = (100 - cpu) / cpu - local extraSleep = math.min(passed * sleepRate, 0.1) - thread.sleep(extraSleep) - end - clock = os.clock() goto CONTINUE end thread.sleep(0.001) - clock = os.clock() timer.update() end end -- cgit v1.2.3