diff options
author | Erich Eckner <git@eckner.net> | 2017-12-20 16:00:29 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-12-20 16:00:29 +0100 |
commit | 9ee3af54d87bef75607e73979f65761ce6f0bf54 (patch) | |
tree | 45d0724733e4866edf9315f393f9c8f39582319f | |
parent | 16f30472a2d042517180e62c3c83255957309e74 (diff) | |
download | units-9ee3af54d87bef75607e73979f65761ce6f0bf54.tar.xz |
systemunit.pas: argMax neu
-rw-r--r-- | systemunit.pas | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/systemunit.pas b/systemunit.pas index a10229b..f511f87 100644 --- a/systemunit.pas +++ b/systemunit.pas @@ -21,13 +21,16 @@ procedure shellExpand(var sa: tMyStringList); overload; function mkTemp(s: string): string; function myReadLink(s: string): string; function pwd: string; +function argMax: longestOrdinal; inline; implementation uses process; -var _cpuLastUsed,_cpuLastIdle: int64; +var + _cpuLastUsed,_cpuLastIdle: int64; + _argMax: longestOrdinal; function cpuUtilization: extended; var @@ -310,9 +313,25 @@ begin result:=trim(result); end; +function argMax: longestOrdinal; +var + args: array of string; + s: string; +begin + if _argMax<0 then begin + setLength(args,1); + args[0]:='ARG_MAX'; + if not runCommand('getconf',args,s) then + raise exception.create('Fehler beim Ausführen von ''getconf ARG_MAX''!'); + _argMax:=strToInt(trim(s)); + end; + result:=_argMax; +end; + begin _cpuLastUsed:=0; _cpuLastIdle:=0; + _argMax:=-1; cpuUtilization; end. |