diff options
author | Erich Eckner <git@eckner.net> | 2015-12-10 15:07:21 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2015-12-10 16:40:35 +0100 |
commit | 108e58400e41f0b0c58fead12ad9c581e02a7217 (patch) | |
tree | 0d3bb7a37481cc9b48c6978fb58eda158a1256e9 | |
parent | c5786fd8d78676ec352e92726149732eb137edd0 (diff) | |
download | units-108e58400e41f0b0c58fead12ad9c581e02a7217.tar.xz |
Funktionen aus lowlevelunit.pas entfernt, die in systemunit.pas sind
-rw-r--r-- | lowlevelunit.pas | 133 |
1 files changed, 1 insertions, 132 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas index aa17bf2..17ac70b 100644 --- a/lowlevelunit.pas +++ b/lowlevelunit.pas @@ -39,12 +39,7 @@ type function signSqr(x: extended): extended; inline; function mpfToStr(f: mpf_t): string; function myTimeToStr(t: extended): string; -function cpuUtilization: extended; -function numCpus: int64; -function momentanFreieCpus: int64; function mpfMyRoot(rad: mpf_t; wzlExp: int64): extended; -function belegterSpeicher: int64; -function minCache: int64; function cmpStr(s1,s2: string): longint; function mitte(s1,s2: string): string; function myFloatToStr(x: extended): string; overload; @@ -66,7 +61,6 @@ function wertZuFarbe(x: extended; p: tRGBArray): tRGB; function tFPColor2tRgb(c: tFPColor): tRGB; function tRgb2tFPColor(c: tRGB): tFPColor; procedure myDebugLnThreadLog(s: string); -function belegterSpeicher: longint; procedure cleanupLogs; procedure cleanupLog(tid: PtrUInt); procedure raiseAndDumpExceptionCallStack(msg: string); @@ -108,9 +102,7 @@ const implementation -uses matheunit; - -var _cpuLastUsed,_cpuLastIdle: int64; +uses matheunit, systemunit; // allgemeine Funktionen ******************************************************* @@ -166,61 +158,6 @@ begin result:=inttostr(tim)+'Woche'+result; end; -function cpuUtilization: extended; -var - procstat: textfile; - s: string; - used,idle: int64; - i: integer; -begin - result:=0; - s:=''; - assignfile(procstat,'/proc/stat'); - reset(procstat); - while not eof(procstat) do begin - readln(procstat,s); - if pos('cpu ',s)=1 then break; - end; - closefile(procstat); - if pos('cpu ',s)<>1 then exit; - delete(s,1,pos(' ',s)); - s:=trim(s); - used:=0; - idle:=0; - for i:=0 to 3 do begin - used:=used+idle; - idle:=strtoint(copy(s,1,pos(' ',s)-1)); - delete(s,1,pos(' ',s)); - s:=trim(s); - end; - result:=(used-_cpuLastUsed)/max(1,used-_cpuLastUsed + idle-_cpuLastIdle); - _cpuLastUsed:=used; - _cpuLastIdle:=idle; -end; - -function numCpus: int64; -var - procstat: textfile; - s: string; -begin - result:=0; - s:=''; - assignfile(procstat,'/proc/stat'); - reset(procstat); - while not eof(procstat) do begin - readln(procstat,s); - if (pos('cpu',s)=1) and - (pos('cpu ',s)<>1) then - inc(result); - end; - closefile(procstat); -end; - -function momentanFreieCpus: int64; -begin - result:=floor(numCpus*(1-cpuUtilization)); -end; - function mpfMyRoot(rad: mpf_t; wzlExp: int64): extended; var ex: mp_exp_t; @@ -229,49 +166,6 @@ begin result:=result*power(2,ex/wzlExp); end; -function belegterSpeicher: int64; -var f: textFile; - s: string; -begin - s:='/proc/'+inttostr(getProcessId)+'/smaps'; - result:=0; - if not fileexists(s) then exit; - assignfile(f,s); - reset(f); - while not eof(f) do begin - readln(f,s); - if (leftStr(s,4)='Rss:') and (rightStr(s,3)=' kB') then begin - delete(s,1,4); - delete(s,length(s)-2,3); - s:=trim(s); - result:=result+strtoint(s); - end; - end; - closefile(f); -end; - -function minCache: int64; -var f: textFile; - s: string; -begin - s:='/proc/cpuinfo'; - result:=0; - if not fileexists(s) then exit; - assignfile(f,s); - reset(f); - while not eof(f) do begin - readln(f,s); - if (leftStr(s,10)='cache size') and (rightStr(s,3)=' kB') then begin - delete(s,1,pos(':',s)); - delete(s,length(s)-2,3); - s:=trim(s); - if result=0 then result:=strtoint(s) - else result:=min(result,strtoint(s)); - end; - end; - closefile(f); -end; - function cmpStr(s1,s2: string): longint; var i: longint; @@ -574,27 +468,6 @@ begin closefile(f); end; -function belegterSpeicher: longint; -var f: textFile; - s: string; -begin - s:='/proc/'+inttostr(getProcessId)+'/smaps'; - result:=0; - if not fileexists(s) then exit; - assignfile(f,s); - reset(f); - while not eof(f) do begin - readln(f,s); - if (leftStr(s,4)='Rss:') and (rightStr(s,3)=' kB') then begin - delete(s,1,4); - delete(s,length(s)-2,3); - s:=trim(s); - result:=result+strtoint(s); - end; - end; - closefile(f); -end; - procedure cleanupLogs; var sr: tSearchRec; err: longint; @@ -961,10 +834,6 @@ end; var b: byte; begin - _cpuLastUsed:=0; - _cpuLastIdle:=0; - cpuUtilization; - for b:=0 to 25 do begin base64Chars[b]:= char(b+ord('A')); base64Chars[b+26]:=char(b+ord('a')); |