Integrate the Design Creations license and refine the monitor
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Independent telemetry providers."""
|
||||
import logging
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
import logging
|
||||
import re
|
||||
from collections import Counter, defaultdict
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
# The client sends a single dot for each observation over the existing channel.
|
||||
export LC_ALL=C
|
||||
os=$(uname -sr)
|
||||
nvidia=$(command -v nvidia-smi || :)
|
||||
sample() {
|
||||
printf '@arm-begin\nos\t%s\n' "$os"
|
||||
if read -r uptime _ < /proc/uptime; then
|
||||
printf 'uptime\t%s\n' "$uptime"
|
||||
fi
|
||||
while read -r name value; do
|
||||
case "$name" in
|
||||
cpu|cpu[0-9]*) printf 'cpu\t%s\t%s\n' "$name" "$value";;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Windows performance data and adapter identity."""
|
||||
import ctypes as ct
|
||||
from ctypes import wintypes as w
|
||||
@@ -9,6 +16,13 @@ import winreg
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def uptime_counter():
|
||||
counter = ct.WinDLL("kernel32").GetTickCount64
|
||||
counter.argtypes = ()
|
||||
counter.restype = ct.c_uint64
|
||||
return counter
|
||||
|
||||
|
||||
class _Double(ct.Structure):
|
||||
_fields_ = [("status", w.DWORD), ("value", ct.c_double)]
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
import base64
|
||||
import csv
|
||||
import hashlib
|
||||
@@ -295,7 +302,9 @@ class LinuxParser:
|
||||
sensors = [row for row in sections["cpusensor"] if len(row) == 2]
|
||||
temperatures = [val for temp, _ in sensors if (val := num(temp, .001)) is not None]
|
||||
powers = [val for _, power in sensors if (val := num(power, .000001)) is not None]
|
||||
uptime = next((num(row[0]) for row in sections["uptime"] if len(row) == 1), None)
|
||||
items.extend(readings(machine, stamp, TOTAL, {
|
||||
"system.uptime": (uptime if uptime is not None and uptime >= 0 else None, "s"),
|
||||
"cpu.util": (usage(*cpu_values.get("cpu", (None, None))), "%"),
|
||||
"cpu.physical": (len(core_map) or None, "count"),
|
||||
"cpu.logical": (sum(key != "cpu" for key in cpu_values) if cpu_values else None, "count"),
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
import logging
|
||||
import platform
|
||||
from time import perf_counter as monotonic, time
|
||||
@@ -5,7 +12,7 @@ from time import perf_counter as monotonic, time
|
||||
import psutil
|
||||
|
||||
from . import Provider
|
||||
from .native import Pdh, commit, cpu_identity, interface_info, pagefiles, physical_cores
|
||||
from .native import Pdh, commit, cpu_identity, interface_info, pagefiles, physical_cores, uptime_counter
|
||||
from ..model import (
|
||||
LOCAL, TOTAL, Availability, Device, Reading, Sample, aggregate, rate, readings, usage,
|
||||
)
|
||||
@@ -21,6 +28,7 @@ class Cpu(Provider):
|
||||
self.last = {}
|
||||
self.name = cpu_identity()
|
||||
self.cores = physical_cores()
|
||||
self.uptime = uptime_counter()
|
||||
self.stamp = 0
|
||||
|
||||
@staticmethod
|
||||
@@ -52,6 +60,7 @@ class Cpu(Provider):
|
||||
self.last, self.stamp = times, now
|
||||
frequency = psutil.cpu_freq()
|
||||
items.extend(readings(LOCAL, stamp, TOTAL, {
|
||||
"system.uptime": (self.uptime() / 1000, "s"),
|
||||
"cpu.util": (cpu_group(values, times), "%"),
|
||||
"cpu.frequency": (frequency.current if frequency else None, "MHz"),
|
||||
"cpu.physical": (len(cores) or psutil.cpu_count(logical=False), "count"),
|
||||
|
||||
Reference in New Issue
Block a user