Improve portable launch, forge persistence, and operator auth UX.
Persist build extra_files for Build Manager history, print dashboard login on every start, add libp2p for Mesh P2P forge, defer WebSocket until login, and split devrun.bat from LAUNCH.bat with USB deck auto-detection.
This commit is contained in:
@@ -18,17 +18,24 @@ func (r *Reporter) memoryStatus() (total, avail uint64) {
|
||||
if err != nil {
|
||||
return total, total / 2
|
||||
}
|
||||
// Rough available estimate from vm_stat free pages
|
||||
var pageSize uint64 = 4096
|
||||
var freePages uint64
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
avail = parseVmStatFreeBytes(string(out))
|
||||
return total, avail
|
||||
}
|
||||
|
||||
func parseVmStatFreeBytes(out string) uint64 {
|
||||
const pageSize uint64 = 4096
|
||||
return parseVmStatFreePages(out) * pageSize
|
||||
}
|
||||
|
||||
func parseVmStatFreePages(out string) uint64 {
|
||||
for _, line := range strings.Split(out, "\n") {
|
||||
if strings.Contains(line, "Pages free") {
|
||||
parts := strings.Fields(line)
|
||||
if len(parts) >= 3 {
|
||||
freePages, _ = strconv.ParseUint(strings.Trim(parts[2], "."), 10, 64)
|
||||
v, _ := strconv.ParseUint(strings.Trim(parts[2], "."), 10, 64)
|
||||
return v
|
||||
}
|
||||
}
|
||||
}
|
||||
avail = freePages * pageSize
|
||||
return total, avail
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user