comparison host/admin/src/private/tools/admin.html.luan @ 2047:ea026254b3b6 default tip

show scheduler threads
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 09 Nov 2025 11:32:18 -0700
parents 301a6561fb6b
children
comparison
equal deleted inserted replaced
2033:905a6ade55f2 2047:ea026254b3b6
7 local Http = require "luan:http/Http.luan" 7 local Http = require "luan:http/Http.luan"
8 require "java" 8 require "java"
9 local Runtime = require "java:java.lang.Runtime" 9 local Runtime = require "java:java.lang.Runtime"
10 local System = require "java:java.lang.System" 10 local System = require "java:java.lang.System"
11 local Server = require "java:goodjava.webserver.Server" 11 local Server = require "java:goodjava.webserver.Server"
12 local threadPool = Server.threadPool
13 local ThreadLuan = require "java:luan.modules.ThreadLuan"
14 local scheduler = ThreadLuan.scheduler
12 15
13 16
14 return function() 17 return function()
15 local action = Http.request.parameters.action 18 local action = Http.request.parameters.action
16 if action == "gc" then 19 if action == "gc" then
27 local used = total - free; 30 local used = total - free;
28 31
29 local loadAverage = uri("os:uptime").read_text() 32 local loadAverage = uri("os:uptime").read_text()
30 --local loadAverage = new String(result).replaceAll(".*average:",""); 33 --local loadAverage = new String(result).replaceAll(".*average:","");
31 34
32 local threadPool = Server.threadPool
33 local threads = threadPool.getPoolSize() 35 local threads = threadPool.getPoolSize()
34 local active_threads = threadPool.getActiveCount() 36 local active_threads = threadPool.getActiveCount()
37
38 local scheduler_threads = scheduler.getPoolSize()
39 local scheduler_active_threads = scheduler.getActiveCount()
35 %> 40 %>
36 <!doctype html> 41 <!doctype html>
37 <html lang="en"> 42 <html lang="en">
38 <body> 43 <body>
39 44
55 <tr> 60 <tr>
56 <td>Load Average</td> 61 <td>Load Average</td>
57 <td><%=loadAverage%></td> 62 <td><%=loadAverage%></td>
58 </tr> 63 </tr>
59 <tr> 64 <tr>
60 <td>Threads</td> 65 <td>Server Threads</td>
61 <td><%= active_threads %> active, <%= threads - active_threads %> idle</td> 66 <td><%= active_threads %> active, <%= threads - active_threads %> idle</td>
67 </tr>
68 <tr>
69 <td>Scheduler Threads</td>
70 <td><%= scheduler_active_threads %> active, <%= scheduler_threads - scheduler_active_threads %> idle</td>
62 </tr> 71 </tr>
63 <table> 72 <table>
64 73
65 <p><a href="admin.html?action=gc">Run GC</a></p> 74 <p><a href="admin.html?action=gc">Run GC</a></p>
66 75