diff options
Diffstat (limited to 'systemunit.pas')
-rw-r--r-- | systemunit.pas | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/systemunit.pas b/systemunit.pas index 1d28924..cb09456 100644 --- a/systemunit.pas +++ b/systemunit.pas @@ -29,27 +29,27 @@ var _cpuLastUsed,_cpuLastIdle: int64; function cpuUtilization: extended; var - procstat: textfile; + procstat: textFile; s: string; used,idle: int64; i: integer; begin result:=0; s:=''; - assignfile(procstat,'/proc/stat'); + assignFile(procstat,'/proc/stat'); reset(procstat); while not eof(procstat) do begin readln(procstat,s); if startetMit('cpu ',s) then break; s:=''; end; - closefile(procstat); + closeFile(procstat); if s='' then exit; used:=0; idle:=0; for i:=0 to 3 do begin used:=used+idle; - idle:=strtoint(erstesArgument(s)); + idle:=strToInt(erstesArgument(s)); end; result:=(used-_cpuLastUsed)/max(1,used-_cpuLastUsed + idle-_cpuLastIdle); _cpuLastUsed:=used; @@ -58,12 +58,12 @@ end; function numCpus: int64; var - procstat: textfile; + procstat: textFile; s: string; begin result:=0; s:=''; - assignfile(procstat,'/proc/stat'); + assignFile(procstat,'/proc/stat'); reset(procstat); while not eof(procstat) do begin readln(procstat,s); @@ -71,7 +71,7 @@ begin startetMit('cpu',s) then inc(result); end; - closefile(procstat); + closeFile(procstat); end; function momentanFreieCpus: int64; @@ -84,17 +84,17 @@ var f: textFile; s: string; begin - s:='/proc/'+inttostr(getProcessId)+'/smaps'; + s:='/proc/'+intToStr(getProcessId)+'/smaps'; result:=0; - if not fileexists(s) then exit; - assignfile(f,s); + if not fileExists(s) then exit; + assignFile(f,s); reset(f); while not eof(f) do begin readln(f,s); if startetMit('Rss:',s) and (endetMit('kB',s) or endetMit('KB',s)) then - result:=result+strtoint(s); + result:=result+strToInt(s); end; - closefile(f); + closeFile(f); end; function minCache: int64; @@ -104,17 +104,17 @@ var begin s:='/proc/cpuinfo'; result:=0; - if not fileexists(s) then exit; - assignfile(f,s); + if not fileExists(s) then exit; + assignFile(f,s); reset(f); while not eof(f) do begin readln(f,s); if startetMit('cache',s) and startetMit('size',s) and startetMit(':',s) and (endetMit('KB',s) or endetMit('kB',s)) then begin - if result=0 then result:=strtoint(s) - else result:=min(result,strtoint(s)); + if result=0 then result:=strToInt(s) + else result:=min(result,strToInt(s)); end; end; - closefile(f); + closeFile(f); end; function shellSubst(s: string): string; @@ -189,7 +189,7 @@ begin if (ebene=0) and (copy(s,j,2)='..') then begin if iStart<>low(longint) then fehler('''..'' darf nicht mehrmals hintereinander auftauchen - in '''+sa[i]+''' ist das aber der Fall!'); - iStart:=strtoint(trim(leftStr(s,j-1))); + iStart:=strToInt(trim(leftStr(s,j-1))); delete(s,1,j+1); j:=1; continue; @@ -204,10 +204,10 @@ begin continue; end else begin // eine Zähliteration - iStopp:=strtoint(trim(leftStr(s,j-1))); + iStopp:=strToInt(trim(leftStr(s,j-1))); delete(s,1,j); for j:=iStart to iStopp do - sa.insert(i+insOff+j-iStart,start+inttostr(j)+ende); + sa.insert(i+insOff+j-iStart,start+intToStr(j)+ende); inc(insOff,iStopp-iStart+1); iStart:=low(longint); j:=1; @@ -226,9 +226,9 @@ function mkTemp(s: string): string; var args: array of string; begin - setlength(args,0); + setLength(args,0); while s<>'' do begin - setlength(args,length(args)+1); + setLength(args,length(args)+1); args[length(args)-1]:=erstesArgument(s); end; result:=''; @@ -241,7 +241,7 @@ function myReadLink(s: string): string; var args: array of string; begin - setlength(args,3); + setLength(args,3); args[0]:='-f'; args[1]:='-n'; args[2]:=s; @@ -255,7 +255,7 @@ function pwd: string; var args: array of string; begin - setlength(args,0); + setLength(args,0); result:=''; if not runCommand('pwd',args,result) then raise exception.create('Fehler beim Ausführen von ''pwd''!'); |