Changeset 162 for MicroThreading/UMicroThreadList.pas
- Timestamp:
- Feb 7, 2011, 1:04:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MicroThreading/UMicroThreadList.pas
r159 r162 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 ExtCtrls ;9 ExtCtrls, StdCtrls, DateUtils; 10 10 11 11 type … … 14 14 15 15 TMicroThreadListForm = class(TForm) 16 Label1: TLabel; 17 Label2: TLabel; 16 18 ListView1: TListView; 19 ListView2: TListView; 20 Panel1: TPanel; 21 Panel2: TPanel; 22 Splitter1: TSplitter; 17 23 TimerRedraw: TTimer; 18 24 procedure FormHide(Sender: TObject); 19 25 procedure FormShow(Sender: TObject); 20 26 procedure ListView1Data(Sender: TObject; Item: TListItem); 27 procedure ListView2Data(Sender: TObject; Item: TListItem); 21 28 procedure TimerRedrawTimer(Sender: TObject); 22 29 private … … 36 43 37 44 procedure TMicroThreadListForm.TimerRedrawTimer(Sender: TObject); 45 var 46 ThreadCount: Integer; 38 47 begin 39 48 if ListView1.Items.Count <> MainScheduler.MicroThreadCount then … … 41 50 ListView1.Items[-1]; 42 51 ListView1.Refresh; 52 53 ThreadCount := MainScheduler.ThreadPoolCount; 54 if MainScheduler.UseMainThread then Inc(ThreadCount); 55 if ListView2.Items.Count <> ThreadCount then 56 ListView2.Items.Count := ThreadCount; 57 ListView2.Items[-1]; 58 ListView2.Refresh; 43 59 end; 44 60 … … 66 82 end; 67 83 84 procedure TMicroThreadListForm.ListView2Data(Sender: TObject; Item: TListItem); 85 var 86 Increment: Integer; 87 begin 88 if MainScheduler.UseMainThread then Increment := 1 89 else Increment := 0; 90 91 if Item.Index < (MainScheduler.ThreadPoolCount + Increment) then begin 92 if MainScheduler.UseMainThread and (Item.Index = 0) then begin 93 Item.Caption := IntToStr(MainThreadID); 94 Item.SubItems.Add(''); 95 Item.SubItems.Add(IntToStr(MainScheduler.MainThreadManager.GetCurrentMicroThreadId)); 96 Item.SubItems.Add(FloatToStr(MainScheduler.MainThreadManager.LoopDuration / OneMillisecond) + ' ms'); 97 end else 98 try 99 MainScheduler.ThreadPoolLock.Acquire; 100 with TMicroThreadThread(MainScheduler.ThreadPool[Item.Index - Increment]) do begin 101 Item.Caption := IntToStr(ThreadID); 102 Item.SubItems.Add(MicroThreadThreadStateText[State]); 103 Item.SubItems.Add(IntToStr(Manager.GetCurrentMicroThreadId)); 104 Item.SubItems.Add(FloatToStr(Manager.LoopDuration / OneMillisecond) + ' ms'); 105 end; 106 finally 107 MainScheduler.ThreadPoolLock.Release; 108 end; 109 end; 110 end; 111 68 112 procedure TMicroThreadListForm.FormShow(Sender: TObject); 69 113 begin
Note:
See TracChangeset
for help on using the changeset viewer.