diff options
-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. |