home *** CD-ROM | disk | FTP | other *** search
- unit CounterProps;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- MiTeC_PerfLibNT, MiTeC_PerfLib9x, StdCtrls, ExtCtrls, ComCtrls;
-
- type
- TpropCounter = class(TFrame)
- pc: TPageControl;
- tsGeneral: TTabSheet;
- Panel1: TPanel;
- Bevel3: TBevel;
- lType: TLabel;
- lLevel: TLabel;
- lScale: TLabel;
- lSize: TLabel;
- stLevel: TStaticText;
- stName: TEdit;
- stType: TStaticText;
- stScale: TStaticText;
- stSize: TStaticText;
- lName: TLabel;
- Memo: TMemo;
- Label1: TLabel;
- Bevel1: TBevel;
- tsObject: TTabSheet;
- Bevel2: TBevel;
- lCntr: TLabel;
- lLevel1: TLabel;
- lInst: TLabel;
- lPage: TLabel;
- stLevel1: TStaticText;
- stObjName: TStaticText;
- stCntr: TStaticText;
- stInst: TStaticText;
- stPage: TStaticText;
- lObjname: TLabel;
- Memo1: TMemo;
- Label7: TLabel;
- Bevel4: TBevel;
- lCtrs: TLabel;
- stCtrs: TStaticText;
- Bevel5: TBevel;
- Bevel6: TBevel;
- lTime: TLabel;
- stTime: TStaticText;
- lFreq: TLabel;
- stFreq: TStaticText;
- private
- FCounter: TObject;
- FPerfLib9x: TPerfLib9x;
- public
- property Counter: TObject read FCounter write FCounter;
- property PerfLib9x: TPerfLib9x read FPerfLib9x write FPerfLib9x;
- procedure Refresh;
- end;
-
- implementation
-
- uses MiTeC_Routines;
-
- {$R *.DFM}
-
- { TpropCounter }
-
- procedure TpropCounter.Refresh;
- var
- po: TPerfObject;
- sc,so: string;
- i: integer;
- begin
- if IsNT then begin
- if Counter is TPerfCounter then begin
- pc.ActivePage:=tsGeneral;
- po:=TPerfCounter(Counter).ParentObject;
- end else begin
- pc.ActivePage:=tsObject;
- tsGeneral.TabVisible:=False;
- po:=TPerfObject(Counter);
- end;
- if Counter is TPerfCounter then
- with TPerfCounter(Counter) do begin
- stName.Text:=Name;
- stType.Caption:=GetCounterTypeStr(CounterType);
- stScale.Caption:=Format('%d',[DefaultScale]);
- stSize.Caption:=Format('%d',[CounterSize]);
- stLevel.Caption:=GetDetailLevelStr(DetailLevel);
- Memo.Text:=Description;
- end;
- with po do begin
- stObjName.Caption:=Name;
- stCntr.Caption:=Format('%d',[DefaultCounter]);
- stPage.Caption:=Format('%d',[CodePage]);
- stLevel1.Caption:=GetDetailLevelStr(DetailLevel);
- if InstanceCount>-1 then
- stInst.Caption:=Format('%d',[InstanceCount])
- else
- stInst.Caption:='0';
- stCtrs.Caption:=Format('%d',[CounterCount]);
- stTime.Caption:=FormatSeconds(PerfTime.QuadPart div timer100n,True,False,True);
- stFreq.Caption:=FormatFloat('#,#0',PerfFreq.QuadPart);
- Memo1.Text:=Description;
- end;
- end else begin
- sc:=StrPas(PChar(Counter));
- i:=Pos('\',sc);
- if i>0 then begin
- pc.ActivePage:=tsGeneral;
- so:=Copy(sc,1,i-1);
- end else begin
- pc.ActivePage:=tsObject;
- tsGeneral.TabVisible:=False;
- so:=sc;
- end;
- with PerfLib9x do begin
- if i>0 then begin
- stName.Text:=SysDataName[sc];
- Memo.Text:=SysDataDesc[sc];
- end;
- stObjName.Caption:=SysDataName[so];
- Memo1.Text:=SysDataDesc[so];
- end;
- end;
- end;
-
- end.
-