From 9ee3af54d87bef75607e73979f65761ce6f0bf54 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 20 Dec 2017 16:00:29 +0100 Subject: systemunit.pas: argMax neu --- systemunit.pas | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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. -- cgit v1.2.3-70-g09d2