interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / crates / aien-platform-linux / src / telemetry.rs

73 lines · 2441 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Telemetry source for Linux and DGX Spark GB10.
17
18use aien_platform::{PlatformError, TelemetrySnapshot, TelemetrySource};
19use std::fs;
20
21pub struct LinuxTelemetrySource;
22
23impl LinuxTelemetrySource {
24 pub fn new() -> Self {
25 Self
26 }
27}
28
29impl Default for LinuxTelemetrySource {
30 fn default() -> Self {
31 Self::new()
32 }
33}
34
35impl TelemetrySource for LinuxTelemetrySource {
36 fn snapshot(&self) -> Result<TelemetrySnapshot, PlatformError> {
37 let mut total_mem = 0usize;
38 let mut avail_mem = 0usize;
39
40 if let Ok(meminfo) = fs::read_to_string("/proc/meminfo") {
41 for line in meminfo.lines() {
42 if line.starts_with("MemTotal:") {
43 if let Some(val) = line.split_whitespace().nth(1) {
44 total_mem = val.parse::<usize>().unwrap_or(0) * 1024;
45 }
46 } else if line.starts_with("MemAvailable:") {
47 if let Some(val) = line.split_whitespace().nth(1) {
48 avail_mem = val.parse::<usize>().unwrap_or(0) * 1024;
49 }
50 }
51 }
52 }
53
54 let used_mem = total_mem.saturating_sub(avail_mem);
55 let target = if cfg!(target_arch = "aarch64") {
56 "gb10"
57 } else {
58 "x86_64-linux"
59 };
60
61 Ok(TelemetrySnapshot {
62 architecture: std::env::consts::ARCH.to_string(),
63 target: target.to_string(),
64 clock_ticks: std::time::SystemTime::now()
65 .duration_since(std::time::UNIX_EPOCH)
66 .map(|d| d.as_millis() as u64)
67 .unwrap_or(0),
68 memory_used_bytes: used_mem,
69 memory_total_bytes: total_mem,
70 active_sequences: 0,
71 })
72 }
73}