claude-finops 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/finops/procs.py +19 -2
- package/package.json +1 -1
package/finops/procs.py
CHANGED
|
@@ -71,10 +71,27 @@ def _is_claude(p):
|
|
|
71
71
|
return base in ("claude", "claude.exe", "claude.cmd") or cmd.endswith("/claude")
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
def _proc_starttime(pid):
|
|
75
|
+
"""Linux: a process's start time in clock ticks since boot (field 22 of /proc/<pid>/stat)."""
|
|
76
|
+
try:
|
|
77
|
+
with open(f"/proc/{int(pid)}/stat") as fh:
|
|
78
|
+
stat = fh.read()
|
|
79
|
+
except (OSError, TypeError, ValueError):
|
|
80
|
+
return None
|
|
81
|
+
fields = stat[stat.rfind(")") + 2:].split() # the name in (...) may contain spaces
|
|
82
|
+
return fields[19] if len(fields) > 19 else None
|
|
83
|
+
|
|
84
|
+
|
|
74
85
|
def _same_start(reg, p):
|
|
75
86
|
"""True unless the registry's procStart names a different start time than ps reports.
|
|
76
|
-
Whitespace is normalised: the registry pads single-digit days ("Oct 9"), ps output is re-joined ("Oct 9").
|
|
77
|
-
|
|
87
|
+
Whitespace is normalised: the registry pads single-digit days ("Oct 9"), ps output is re-joined ("Oct 9").
|
|
88
|
+
On Linux, Claude Code records clock ticks since boot ("119623") instead, read from /proc."""
|
|
89
|
+
start = reg.get("procStart")
|
|
90
|
+
if not start:
|
|
91
|
+
return True
|
|
92
|
+
if start.strip().isdigit():
|
|
93
|
+
return _proc_starttime(reg.get("pid")) == start.strip()
|
|
94
|
+
return start.split() == p["lstart"].split()
|
|
78
95
|
|
|
79
96
|
|
|
80
97
|
def _ancestors(pid, procs):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-finops",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Local FinOps dashboard for Claude Code: what you used, what it cost, why it cost that much, and what to change. Reads your own transcripts, no API key, no data leaves the machine.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"claude-finops": "bin/claude-finops.js"
|