Skip to content

Commit 05e2775

Browse files
committed
Add performance and filtering
1 parent 688e8b5 commit 05e2775

18 files changed

Lines changed: 719 additions & 429 deletions

package-lock.json

Lines changed: 45 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
"@radix-ui/react-toggle-group": "^1.1.10",
3131
"@radix-ui/react-tooltip": "^1.2.7",
3232
"@tailwindcss/vite": "4.1.11",
33+
"@tanstack/query-async-storage-persister": "^5.83.1",
3334
"@tanstack/react-query": "^5.84.1",
35+
"@tanstack/react-query-persist-client": "^5.84.2",
3436
"@tanstack/react-table": "^8.21.3",
3537
"@tauri-apps/api": "2",
3638
"@tauri-apps/plugin-opener": "2",

src-lua/feather/init.lua

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
-- Very minimal HTTP server inside Love2D
1+
-- Not Very minimal HTTP server inside Love2D
22
local socket = require("socket")
33
local inspect = require("feather.lib.inspect")
44
local json = require("feather.lib.json")
55
local Class = require("feather.lib.class")
66
local utf8 = require("utf8")
77
local errorhandler = require("feather.error_handler")
88
local get_current_dir = require("feather.utils").get_current_dir
9+
local Performance = require("feather.plugins.performance")
10+
11+
local performance = Performance()
912

1013
local logs = {}
1114

@@ -188,7 +191,8 @@ function Feather:onerror(msg, finish)
188191
end
189192
end
190193

191-
function Feather:update()
194+
---@param dt number
195+
function Feather:update(dt)
192196
local client = self.server:accept()
193197
if client then
194198
if #logs == 0 then
@@ -224,6 +228,11 @@ function Feather:update()
224228
self.lastDelivery = os.time()
225229
end
226230

231+
if request.path == "/performance" then
232+
local body = json.encode(performance:getResponseBody(dt))
233+
response = self:__buildResponse(body)
234+
end
235+
227236
client:send(response)
228237
end
229238

@@ -248,9 +257,9 @@ function Feather:log(line)
248257
table.insert(logs, line)
249258

250259
--- Find a way to avoid deleting incoming logs
251-
-- if #logs > self.maxTempLogs then
252-
-- table.remove(logs, 1)
253-
-- end
260+
if #logs > self.maxTempLogs then
261+
table.remove(logs, 1)
262+
end
254263
end
255264

256265
function Feather:print(...)

src-lua/feather/plugins/base.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
local Class = require("feather.lib.class")
2+
3+
local FeatherPlugin = Class({
4+
init = function(self, config)
5+
self.config = config
6+
end,
7+
update = function(self, dt)
8+
print("update")
9+
end,
10+
onerror = function(self, msg)
11+
print("onerror")
12+
end,
13+
onerrorhandler = function(self, msg)
14+
print("onerrorhandler")
15+
end,
16+
getResponseBody = function(self)
17+
return "Hello World"
18+
end,
19+
})
20+
21+
return FeatherPlugin
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
local Class = require("feather.lib.class")
2+
local Base = require("feather.plugins.base")
3+
4+
local FeatherPerformance = Class({
5+
Class({ __includes = Base }),
6+
init = function(self, config)
7+
self.config = config
8+
self.sysInfo = {
9+
arch = love.system.getOS() ~= "Web" and require("ffi").arch or "Web",
10+
os = love.system.getOS(),
11+
cpuCount = love.system.getProcessorCount(),
12+
}
13+
self.supported = love.graphics.getSupported()
14+
end,
15+
})
16+
17+
function FeatherPerformance:getResponseBody(dt)
18+
return {
19+
sysInfo = self.sysInfo,
20+
supported = self.supported,
21+
memory = collectgarbage("count"),
22+
stats = love.graphics.getStats(),
23+
fps = love.timer.getFPS(),
24+
frameTime = dt,
25+
vsyncEnabled = love.window.getVSync() == 1,
26+
time = os.time(),
27+
}
28+
end
29+
30+
return FeatherPerformance

src-lua/main.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,13 @@ local debugger = FeatherDebugger({
147147
})
148148

149149
a = 0
150+
150151
function love.load() end
151152

152153
function love.draw() end
153154

154155
function love.update(dt)
155-
debugger:update()
156+
debugger:update(dt)
156157
a = a + dt
157158

158159
if a > 1 then

0 commit comments

Comments
 (0)