-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathserver.lua
52 lines (51 loc) · 4.17 KB
/
server.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
local ProfRunning = false
RegisterConsoleListener(function(channel, message)
if string.find(message, "server thread hitch warning") then
if not ProfRunning then
print("Hitch warning detected, starting profiler")
ExecuteCommand("profiler record 100")
ProfRunning = true
end
end
if string.find(message, "Stopped the recording") then
ExecuteCommand("profiler saveJSON resources/KLprofiler/profiler.json")
end
if string.find(message, "Save complete") then
oldnamets = 0
oldname = None
json2 = LoadResourceFile(GetCurrentResourceName(), "profiler.json")
traceEvents = json.decode(json2).traceEvents
print("The following resources are using more tick time than recommended, please check them out:")
for k,v in pairs(traceEvents) do
if string.find(v.name, "tick") then
if oldname == v.name then
ticktime = v.ts - oldnamets
if ticktime > 5000 then
name = string.gsub(v.name, "tick", "")
name = string.gsub(name, "%(", "")
name = string.gsub(name, "%)", "")
name = string.gsub(name, " ", "")
print(name .. ": " .. ticktime / 1000 .. "ms")
end
end
oldname = v.name
oldnamets = v.ts
end
end
ProfRunning = false
end
end)
--────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────#
--................&,..................................................................................................................................#
--.............*&&&&&%................................................................................................................................#
--...........&&&&&&&&&&&...........&&&%......................#&&#.................................%&&#..........................&&&...................#
--........,&&&&&&&&&&&&&&&#........&&&%......................#&&#.................................%&&#..........................&&&...................#
--.............%&&&&&&.............&&&%..(&&&(..&&&&&&&&&&&,.#&&&&&&&&&&..#&&&&&&&&&&#..&&&&&&&&&.%&&#..&&&&&&&&&&...#&&&&&&&&&.&&&...&&&&............#
--.............%&&&&&&.............&&&%&&&&....&&&......&&&,.#&&&....%&&#.#&&&.....(&&&,&&&/......%&&#.&&&......&&&,&&&/........&&&*&&&#..............#
--.............%&&&&&&.............&&&&&&&&....&&&......&&&,.#&&#....%&&#.#&&%......&&&...%&&&&&%.%&&#*&&&......&&&*&&&.........&&&&&&&%..............#
--.............%&&&&&&.............&&&%..%&&&..%&&&#..(&&&&,.#&&#....%&&#.#&&&&...&&&&..#&....&&&.%&&#.%&&&#..(&&&%..&&&&...&&,.&&&...&&&&..(&&/......#
--.............%&&&&&&.............&&&%....%&&&../&&&&#.&&&,.#&&#....%&&#.#&&%,&&&&%....,%&&&&&,..%&&#...,%&&&&&,......%&&&&&,..&&&.....&&&%#&&/......#
--.............%&&&&&&....................................................#&&%........................................................................#
--........................................................................#&&%........................................................................#
--....................................................................................................................................................#
--─────────────────────────────────────────────────────────────────©─2023──⬆─kahpslock────────────────────────────────────────────────────────────────#