灵符lingfu

LingSys

↓ 0 downloads

Your machine's memory, GPU, motherboard and network, drawn and played in the Ling design system: LingSys, a small build for USB liquid-cooler displays, LingNet for IPv4/IPv6, DNS and packets, and a LingOS edition. 64-bit and 32-bit Windows builds included.

Keywords system-monitor, visualization, network, ipv6, gpu, lcd, lingos, ling
lingfu install LingSys
LicenseMIT
AuthorsLing Lin <taellinglin@gmail.com>
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (48)

run.ps1
# Start the samplers, run HatchSYS, stop the samplers when the window closes.
#   .\run.ps1            live data from this machine (memory, GPU, board, network)
#   .\run.ps1 sim        no samplers, a made-up machine
#   .\run.ps1 full       borderless fullscreen (args combine: .\run.ps1 full)
#   .\run.ps1 memonly    the original single-screen HatchMEM (hatchmem.ling), memory sampler only
#   .\run.ps1 mini 320x240   the small build for a liquid-cooler LCD (hatchmini.ling); any WxH, e.g. 240x320
#   .\run.ps1 jit        run on the fast JIT backend (60 fps) instead of the interpreter
#
# WARNING: Ling 2030.1.48's JIT never frees heap values (lists, strings), so this program grows by about
# 3 GB a minute on it and runs out of memory in 10-15 minutes. The interpreter does not leak (about 20 fps),
# so it is the default. Use `jit` only for short sessions.
#   \run.ps1 net         LingNet: the network in detail, split by adapter, IPv4 and IPv6, DNS, packets (hatchnet.ling)
#   .\run.ps1 lcd [rotate=270]   hatchmini on a Thermalright-style USB LCD (closes TRCC, mirrors the mini window to the display, restarts TRCC)
param([Parameter(ValueFromRemainingArguments = $true)][string[]]$Rest)
Set-Location $PSScriptRoot
$program = 'hatchsys.ling'
$engine = @('--interp')
if ($Rest -contains 'mini') {
    $program = 'hatchmini.ling'
    $Rest = @($Rest | Where-Object { $_ -ne 'mini' })
}
if ($Rest -contains 'jit') {
    $engine = @()
    $Rest = @($Rest | Where-Object { $_ -ne 'jit' })
}
$kinds = @('mem', 'gpu', 'board', 'net')
$lcd = $false
$rotate = '90'
if ($Rest -contains 'lcd') {
    $lcd = $true
    $program = 'hatchmini.ling'
    $Rest = @($Rest | Where-Object { $_ -ne 'lcd' })
    foreach ($a in $Rest) { if ($a -match '^rotate=(0|90|180|270)$') { $rotate = $Matches[1] } }
    $Rest = @($Rest | Where-Object { $_ -notmatch '^rotate=' })
    if (-not ($Rest | Where-Object { $_ -match '^[0-9]+x[0-9]+$' })) { $Rest = @($Rest) + '320x240' }
}
if ($Rest -contains 'net') {
    $program = 'hatchnet.ling'
    $kinds = @('netx')
    $Rest = @($Rest | Where-Object { $_ -ne 'net' })
}
if ($Rest -contains 'memonly') {
    $program = 'hatchmem.ling'
    $kinds = @('mem')
    $Rest = @($Rest | Where-Object { $_ -ne 'memonly' })
}
$samplers = @()
if ($Rest -notcontains 'sim') {
    Remove-Item -ErrorAction SilentlyContinue mem.snap, gpu.snap, board.snap, net.snap, netx.snap
    foreach ($k in $kinds) {
        if ($k -eq 'mem') { $script = @('-File', (Join-Path $PSScriptRoot 'sampler.ps1')) }
        else { $script = @('-File', (Join-Path $PSScriptRoot 'sampler_hw.ps1'), '-Kind', $k) }
        $samplers += Start-Process powershell -WindowStyle Hidden -PassThru -ArgumentList (@('-NoProfile', '-ExecutionPolicy', 'Bypass') + $script)
    }
}
$sender = $null
$trccWas = $false
if ($lcd) {
    # only one program can own the display: stop TRCC and its USB helpers, put TRCC back afterwards
    $trccWas = @(Get-Process TRCC -ErrorAction SilentlyContinue).Count -gt 0
    Get-Process TRCC, USBLCD, USBLCDNEW -ErrorAction SilentlyContinue | Stop-Process -Force
    Start-Sleep -Seconds 1
    $sender = Start-Process python -WindowStyle Hidden -PassThru -ArgumentList @((Join-Path $PSScriptRoot 'tools\lcd_sender.py'), '--rotate', $rotate)
}
try { & ling run @engine $program @Rest }
finally {
    foreach ($p in $samplers) { Stop-Process -Id $p.Id -ErrorAction SilentlyContinue }
    if ($sender) { Stop-Process -Id $sender.Id -ErrorAction SilentlyContinue }
    if ($trccWas) { Start-Process 'C:\Program Files\TRCCCAP\TRCC.exe' -WorkingDirectory 'C:\Program Files\TRCCCAP' }
    Remove-Item -ErrorAction SilentlyContinue *.snap, *.snap.tmp
}

← Back to index