summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/settings.json3
-rw-r--r--main.lua2
-rw-r--r--script/tracy.lua18
-rw-r--r--test.lua1
4 files changed, 23 insertions, 1 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 89305242..54ad1616 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -11,7 +11,8 @@
"ID",
"DEVELOP",
"DBGPORT",
- "DBGWAIT"
+ "DBGWAIT",
+ "tracy"
],
"Lua.diagnostics.disable": [
"close-non-object"
diff --git a/main.lua b/main.lua
index ad9da5b4..4e050f9d 100644
--- a/main.lua
+++ b/main.lua
@@ -14,6 +14,8 @@ log.init(ROOT, ROOT / 'log' / 'service.log')
log.info('Lua Lsp startup, root: ', ROOT)
log.debug('ROOT:', ROOT:string())
+require 'tracy' .disable()
+
xpcall(dofile, log.debug, rootPath .. '/debugger.lua')
local service = require 'service'
diff --git a/script/tracy.lua b/script/tracy.lua
new file mode 100644
index 00000000..a5f6d9b1
--- /dev/null
+++ b/script/tracy.lua
@@ -0,0 +1,18 @@
+local suc = pcall(require, 'luatracy')
+local originTracy = tracy
+
+local function enable()
+ tracy = originTracy
+end
+
+local function disable()
+ tracy = {
+ ZoneBeginN = function () end,
+ ZoneEnd = function () end,
+ }
+end
+
+return {
+ enable = enable,
+ disable = disable,
+}
diff --git a/test.lua b/test.lua
index ed8d8dfc..5563e550 100644
--- a/test.lua
+++ b/test.lua
@@ -18,6 +18,7 @@ log.debug('测试开始')
ac = {}
--dofile((ROOT / 'build_package.lua'):string())
+require 'tracy' .enable()
local function loadAllLibs()
assert(require 'bee.filesystem')