Changeset 149 for MicroThreading/Demo
- Timestamp:
- Jan 26, 2011, 7:12:08 PM (14 years ago)
- Location:
- MicroThreading/Demo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
MicroThreading/Demo/Demo.lpi
r148 r149 31 31 </local> 32 32 </RunParams> 33 <RequiredPackages Count=" 3">33 <RequiredPackages Count="2"> 34 34 <Item1> 35 <PackageName Value=" ExceptionLogger"/>35 <PackageName Value="Microthreading"/> 36 36 </Item1> 37 37 <Item2> 38 <PackageName Value=" Microthreading"/>38 <PackageName Value="LCL"/> 39 39 </Item2> 40 <Item3>41 <PackageName Value="LCL"/>42 </Item3>43 40 </RequiredPackages> 44 <Units Count=" 48">41 <Units Count="51"> 45 42 <Unit0> 46 43 <Filename Value="Demo.lpr"/> 47 44 <IsPartOfProject Value="True"/> 48 45 <UnitName Value="Demo"/> 46 <IsVisibleTab Value="True"/> 47 <EditorIndex Value="1"/> 49 48 <WindowIndex Value="0"/> 50 49 <TopLine Value="1"/> 51 <CursorPos X="1" Y="15"/> 52 <UsageCount Value="53"/> 50 <CursorPos X="10" Y="7"/> 51 <UsageCount Value="58"/> 52 <Loaded Value="True"/> 53 53 </Unit0> 54 54 <Unit1> … … 60 60 <EditorIndex Value="0"/> 61 61 <WindowIndex Value="0"/> 62 <TopLine Value=" 70"/>63 <CursorPos X=" 18" Y="80"/>64 <UsageCount Value="5 3"/>62 <TopLine Value="1"/> 63 <CursorPos X="20" Y="226"/> 64 <UsageCount Value="58"/> 65 65 <Loaded Value="True"/> 66 66 <LoadedDesigner Value="True"/> … … 69 69 <Filename Value="../UMicroThreading.pas"/> 70 70 <UnitName Value="UMicroThreading"/> 71 <IsVisibleTab Value="True"/> 72 <EditorIndex Value="4"/> 73 <WindowIndex Value="0"/> 74 <TopLine Value="621"/> 75 <CursorPos X="1" Y="621"/> 76 <UsageCount Value="30"/> 71 <EditorIndex Value="3"/> 72 <WindowIndex Value="0"/> 73 <TopLine Value="352"/> 74 <CursorPos X="1" Y="367"/> 75 <UsageCount Value="32"/> 77 76 <Loaded Value="True"/> 78 77 </Unit2> … … 111 110 <Filename Value="../../ExceptionLogger/UExceptionLogger.pas"/> 112 111 <UnitName Value="UExceptionLogger"/> 113 <WindowIndex Value="0"/> 114 <TopLine Value="8"/> 115 <CursorPos X="1" Y="1"/> 116 <UsageCount Value="8"/> 112 <EditorIndex Value="4"/> 113 <WindowIndex Value="0"/> 114 <TopLine Value="1"/> 115 <CursorPos X="1" Y="8"/> 116 <UsageCount Value="10"/> 117 <Loaded Value="True"/> 117 118 <DefaultSyntaxHighlighter Value="Delphi"/> 118 119 </Unit7> … … 145 146 <Unit11> 146 147 <Filename Value="/usr/share/fpcsrc/2.4.0/rtl/inc/systemh.inc"/> 147 <WindowIndex Value="0"/> 148 <TopLine Value="886"/> 149 <CursorPos X="20" Y="900"/> 150 <UsageCount Value="8"/> 148 <EditorIndex Value="2"/> 149 <WindowIndex Value="0"/> 150 <TopLine Value="479"/> 151 <CursorPos X="3" Y="494"/> 152 <UsageCount Value="11"/> 153 <Loaded Value="True"/> 151 154 </Unit11> 152 155 <Unit12> … … 195 198 <Unit18> 196 199 <Filename Value="/usr/share/fpcsrc/2.4.0/rtl/objpas/classes/classesh.inc"/> 197 <WindowIndex Value="0"/> 198 <TopLine Value="1368"/> 199 <CursorPos X="3" Y="1385"/> 200 <UsageCount Value="10"/> 200 <EditorIndex Value="6"/> 201 <WindowIndex Value="0"/> 202 <TopLine Value="1425"/> 203 <CursorPos X="25" Y="1443"/> 204 <UsageCount Value="12"/> 205 <Loaded Value="True"/> 201 206 </Unit18> 202 207 <Unit19> … … 238 243 <Unit24> 239 244 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/objpas/sysutils/datih.inc"/> 240 <EditorIndex Value="7"/>241 245 <WindowIndex Value="0"/> 242 246 <TopLine Value="106"/> 243 247 <CursorPos X="10" Y="119"/> 244 248 <UsageCount Value="19"/> 245 <Loaded Value="True"/>246 249 </Unit24> 247 250 <Unit25> … … 298 301 <Unit32> 299 302 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/> 300 <EditorIndex Value="8"/>301 303 <WindowIndex Value="0"/> 302 304 <TopLine Value="1504"/> 303 305 <CursorPos X="1" Y="1510"/> 304 306 <UsageCount Value="16"/> 305 <Loaded Value="True"/>306 307 </Unit32> 307 308 <Unit33> … … 328 329 <Unit36> 329 330 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/objpas/classes/classes.inc"/> 330 <EditorIndex Value="9"/>331 331 <WindowIndex Value="0"/> 332 332 <TopLine Value="109"/> 333 333 <CursorPos X="3" Y="111"/> 334 334 <UsageCount Value="16"/> 335 <Loaded Value="True"/>336 335 </Unit36> 337 336 <Unit37> 338 337 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/inc/objpash.inc"/> 339 <EditorIndex Value="1"/>340 338 <WindowIndex Value="0"/> 341 339 <TopLine Value="181"/> 342 340 <CursorPos X="21" Y="194"/> 343 341 <UsageCount Value="13"/> 344 <Loaded Value="True"/>345 342 </Unit37> 346 343 <Unit38> … … 388 385 <Unit44> 389 386 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/lcl/include/spinedit.inc"/> 390 <EditorIndex Value="3"/>391 387 <WindowIndex Value="0"/> 392 388 <TopLine Value="221"/> 393 389 <CursorPos X="1" Y="235"/> 394 390 <UsageCount Value="13"/> 395 <Loaded Value="True"/>396 391 </Unit44> 397 392 <Unit45> 398 393 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/lcl/interfaces/win32/win32object.inc"/> 399 <EditorIndex Value="6"/>400 394 <WindowIndex Value="0"/> 401 395 <TopLine Value="387"/> 402 396 <CursorPos X="1" Y="400"/> 403 397 <UsageCount Value="13"/> 404 <Loaded Value="True"/>405 398 </Unit45> 406 399 <Unit46> 407 400 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/win/wininc/struct.inc"/> 408 <EditorIndex Value="5"/>409 401 <WindowIndex Value="0"/> 410 402 <TopLine Value="6081"/> 411 403 <CursorPos X="6" Y="6094"/> 412 404 <UsageCount Value="13"/> 413 <Loaded Value="True"/>414 405 </Unit46> 415 406 <Unit47> 416 407 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/inc/objpas.inc"/> 417 <EditorIndex Value="2"/>418 408 <WindowIndex Value="0"/> 419 409 <TopLine Value="160"/> 420 410 <CursorPos X="12" Y="163"/> 421 411 <UsageCount Value="10"/> 422 <Loaded Value="True"/>423 412 </Unit47> 413 <Unit48> 414 <Filename Value="../UPlatform.pas"/> 415 <UnitName Value="UPlatform"/> 416 <EditorIndex Value="7"/> 417 <WindowIndex Value="0"/> 418 <TopLine Value="1"/> 419 <CursorPos X="24" Y="9"/> 420 <UsageCount Value="12"/> 421 <Loaded Value="True"/> 422 </Unit48> 423 <Unit49> 424 <Filename Value="../../../../lazarus/lcl/interfaces/gtk2/gtk2winapi.inc"/> 425 <WindowIndex Value="0"/> 426 <TopLine Value="9153"/> 427 <CursorPos X="8" Y="9166"/> 428 <UsageCount Value="10"/> 429 </Unit49> 430 <Unit50> 431 <Filename Value="/usr/share/fpcsrc/2.4.0/rtl/unix/sysutils.pp"/> 432 <UnitName Value="sysutils"/> 433 <EditorIndex Value="5"/> 434 <WindowIndex Value="0"/> 435 <TopLine Value="1"/> 436 <CursorPos X="1" Y="1"/> 437 <UsageCount Value="10"/> 438 <Loaded Value="True"/> 439 </Unit50> 424 440 </Units> 425 441 <JumpHistory Count="30" HistoryIndex="29"> 426 442 <Position1> 427 443 <Filename Value="../UMicroThreading.pas"/> 428 <Caret Line="5 51" Column="1" TopLine="537"/>444 <Caret Line="524" Column="1" TopLine="509"/> 429 445 </Position1> 430 446 <Position2> 431 447 <Filename Value="../UMicroThreading.pas"/> 432 <Caret Line="5 52" Column="1" TopLine="537"/>448 <Caret Line="530" Column="28" TopLine="515"/> 433 449 </Position2> 434 450 <Position3> 435 451 <Filename Value="../UMicroThreading.pas"/> 436 <Caret Line="5 55" Column="1" TopLine="537"/>452 <Caret Line="547" Column="1" TopLine="532"/> 437 453 </Position3> 438 454 <Position4> 439 455 <Filename Value="../UMicroThreading.pas"/> 440 <Caret Line="5 58" Column="1" TopLine="537"/>456 <Caret Line="570" Column="1" TopLine="555"/> 441 457 </Position4> 442 458 <Position5> 443 459 <Filename Value="../UMicroThreading.pas"/> 444 <Caret Line=" 563" Column="1" TopLine="540"/>460 <Caret Line="661" Column="1" TopLine="646"/> 445 461 </Position5> 446 462 <Position6> 447 463 <Filename Value="../UMicroThreading.pas"/> 448 <Caret Line="6 23" Column="1" TopLine="610"/>464 <Caret Line="662" Column="1" TopLine="646"/> 449 465 </Position6> 450 466 <Position7> 451 467 <Filename Value="../UMicroThreading.pas"/> 452 <Caret Line=" 550" Column="1" TopLine="537"/>468 <Caret Line="663" Column="1" TopLine="646"/> 453 469 </Position7> 454 470 <Position8> 455 471 <Filename Value="../UMicroThreading.pas"/> 456 <Caret Line="5 51" Column="1" TopLine="537"/>472 <Caret Line="570" Column="1" TopLine="555"/> 457 473 </Position8> 458 474 <Position9> 459 475 <Filename Value="../UMicroThreading.pas"/> 460 <Caret Line="5 52" Column="1" TopLine="537"/>476 <Caret Line="571" Column="1" TopLine="555"/> 461 477 </Position9> 462 478 <Position10> 463 479 <Filename Value="../UMicroThreading.pas"/> 464 <Caret Line="5 56" Column="1" TopLine="537"/>480 <Caret Line="572" Column="1" TopLine="555"/> 465 481 </Position10> 466 482 <Position11> 467 483 <Filename Value="../UMicroThreading.pas"/> 468 <Caret Line="5 58" Column="1" TopLine="537"/>484 <Caret Line="573" Column="1" TopLine="555"/> 469 485 </Position11> 470 486 <Position12> 471 487 <Filename Value="../UMicroThreading.pas"/> 472 <Caret Line="5 61" Column="1" TopLine="539"/>488 <Caret Line="574" Column="1" TopLine="555"/> 473 489 </Position12> 474 490 <Position13> 475 491 <Filename Value="../UMicroThreading.pas"/> 476 <Caret Line="5 59" Column="3" TopLine="543"/>492 <Caret Line="575" Column="1" TopLine="555"/> 477 493 </Position13> 478 494 <Position14> 479 495 <Filename Value="../UMicroThreading.pas"/> 480 <Caret Line=" 564" Column="1" TopLine="543"/>496 <Caret Line="20" Column="3" TopLine="1"/> 481 497 </Position14> 482 498 <Position15> 483 499 <Filename Value="../UMicroThreading.pas"/> 484 <Caret Line="5 62" Column="1" TopLine="543"/>500 <Caret Line="573" Column="1" TopLine="558"/> 485 501 </Position15> 486 502 <Position16> 487 503 <Filename Value="../UMicroThreading.pas"/> 488 <Caret Line=" 563" Column="1" TopLine="543"/>504 <Caret Line="664" Column="1" TopLine="649"/> 489 505 </Position16> 490 506 <Position17> 491 507 <Filename Value="../UMicroThreading.pas"/> 492 <Caret Line=" 564" Column="1" TopLine="543"/>508 <Caret Line="665" Column="1" TopLine="649"/> 493 509 </Position17> 494 510 <Position18> 495 511 <Filename Value="../UMicroThreading.pas"/> 496 <Caret Line=" 562" Column="1" TopLine="543"/>512 <Caret Line="666" Column="1" TopLine="649"/> 497 513 </Position18> 498 514 <Position19> 499 515 <Filename Value="../UMicroThreading.pas"/> 500 <Caret Line="5 63" Column="1" TopLine="543"/>516 <Caret Line="573" Column="1" TopLine="558"/> 501 517 </Position19> 502 518 <Position20> 503 519 <Filename Value="../UMicroThreading.pas"/> 504 <Caret Line="5 64" Column="1" TopLine="543"/>520 <Caret Line="574" Column="1" TopLine="558"/> 505 521 </Position20> 506 522 <Position21> 507 523 <Filename Value="../UMicroThreading.pas"/> 508 <Caret Line="5 62" Column="1" TopLine="543"/>524 <Caret Line="575" Column="1" TopLine="558"/> 509 525 </Position21> 510 526 <Position22> 511 527 <Filename Value="../UMicroThreading.pas"/> 512 <Caret Line="5 63" Column="1" TopLine="543"/>528 <Caret Line="576" Column="1" TopLine="558"/> 513 529 </Position22> 514 530 <Position23> 515 531 <Filename Value="../UMicroThreading.pas"/> 516 <Caret Line="5 64" Column="1" TopLine="543"/>532 <Caret Line="577" Column="1" TopLine="558"/> 517 533 </Position23> 518 534 <Position24> 519 535 <Filename Value="../UMicroThreading.pas"/> 520 <Caret Line="5 62" Column="1" TopLine="543"/>536 <Caret Line="578" Column="1" TopLine="558"/> 521 537 </Position24> 522 538 <Position25> 523 539 <Filename Value="../UMicroThreading.pas"/> 524 <Caret Line=" 564" Column="1" TopLine="543"/>540 <Caret Line="20" Column="16" TopLine="1"/> 525 541 </Position25> 526 542 <Position26> 527 <Filename Value="../ UMicroThreading.pas"/>528 <Caret Line="1 41" Column="44" TopLine="127"/>543 <Filename Value="../../ExceptionLogger/UExceptionLogger.pas"/> 544 <Caret Line="15" Column="8" TopLine="1"/> 529 545 </Position26> 530 546 <Position27> 531 547 <Filename Value="../UMicroThreading.pas"/> 532 <Caret Line=" 580" Column="25" TopLine="568"/>548 <Caret Line="14" Column="15" TopLine="1"/> 533 549 </Position27> 534 550 <Position28> 535 <Filename Value=" ../UMicroThreading.pas"/>536 <Caret Line=" 151" Column="27" TopLine="134"/>551 <Filename Value="Demo.lpr"/> 552 <Caret Line="8" Column="34" TopLine="1"/> 537 553 </Position28> 538 554 <Position29> 539 555 <Filename Value="../UMicroThreading.pas"/> 540 <Caret Line=" 150" Column="47" TopLine="135"/>556 <Caret Line="573" Column="1" TopLine="558"/> 541 557 </Position29> 542 558 <Position30> 543 559 <Filename Value="../UMicroThreading.pas"/> 544 <Caret Line=" 118" Column="59" TopLine="112"/>560 <Caret Line="649" Column="11" TopLine="649"/> 545 561 </Position30> 546 562 </JumpHistory> … … 560 576 <RangeChecks Value="True"/> 561 577 <OverflowChecks Value="True"/> 562 <StackChecks Value="True"/>563 578 </Checks> 564 <VerifyObjMethodCallValidity Value="True"/>565 579 </CodeGeneration> 566 580 <Linking> … … 582 596 </CompilerOptions> 583 597 <Debugging> 584 <BreakPoints Count=" 5">598 <BreakPoints Count="6"> 585 599 <Item1> 586 600 <Source Value="../Coroutine.pas"/> … … 601 615 <Item5> 602 616 <Source Value="../UMicroThreading.pas"/> 603 <Line Value="5 54"/>617 <Line Value="560"/> 604 618 </Item5> 619 <Item6> 620 <Source Value="../UMicroThreading.pas"/> 621 <Line Value="540"/> 622 </Item6> 605 623 </BreakPoints> 606 624 <Exceptions Count="3"> -
MicroThreading/Demo/Demo.lpr
r148 r149 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UMainForm, MicroThreading, ExceptionLogger 11 { you can add units after this }; 10 Forms, UMainForm, MicroThreading; 12 11 13 12 {$R *.res} -
MicroThreading/Demo/UMainForm.lfm
r148 r149 1 1 object MainForm: TMainForm 2 Left = 2 633 Height = 5 104 Top = 1 565 Width = 7982 Left = 232 3 Height = 557 4 Top = 116 5 Width = 863 6 6 Caption = 'MicroThreading demo' 7 ClientHeight = 5 108 ClientWidth = 7987 ClientHeight = 557 8 ClientWidth = 863 9 9 OnClose = FormClose 10 10 OnCreate = FormCreate 11 11 OnDestroy = FormDestroy 12 OnShow = FormShow 12 13 LCLVersion = '0.9.31' 13 object ButtonSchedulerStartStop: TButton 14 Left = 9 15 Height = 25 16 Top = 13 17 Width = 103 18 Caption = 'Start scheduler' 19 OnClick = ButtonSchedulerStartStopClick 14 object PageControl1: TPageControl 15 Left = 8 16 Height = 543 17 Top = 8 18 Width = 849 19 ActivePage = TabSheet2 20 Anchors = [akTop, akLeft, akRight, akBottom] 21 TabIndex = 1 20 22 TabOrder = 0 23 object TabSheet1: TTabSheet 24 Caption = 'Job control' 25 ClientHeight = 516 26 ClientWidth = 845 27 object ButtonAddWorkers: TButton 28 Left = 10 29 Height = 25 30 Top = 7 31 Width = 104 32 Caption = 'Add workers' 33 OnClick = ButtonAddWorkersClick 34 TabOrder = 0 35 end 36 object ButtonClearMicroThreads: TButton 37 Left = 10 38 Height = 25 39 Top = 37 40 Width = 140 41 Caption = 'Clear microthreads' 42 OnClick = ButtonClearMicroThreadsClick 43 TabOrder = 1 44 end 45 object Label4: TLabel 46 Left = 120 47 Height = 14 48 Top = 14 49 Width = 104 50 Caption = 'Microthread count:' 51 ParentColor = False 52 end 53 object SpinEdit1: TSpinEdit 54 Left = 224 55 Height = 21 56 Top = 11 57 Width = 74 58 MaxValue = 100000 59 MinValue = 1 60 TabOrder = 2 61 Value = 200 62 end 63 object Memo1: TMemo 64 Left = 382 65 Height = 267 66 Top = 14 67 Width = 294 68 Anchors = [akTop, akLeft, akBottom] 69 ScrollBars = ssAutoBoth 70 TabOrder = 3 71 end 72 end 73 object TabSheet2: TTabSheet 74 Caption = 'Scheduler state' 75 ClientHeight = 516 76 ClientWidth = 845 77 object ListView1: TListView 78 Left = 222 79 Height = 483 80 Top = 24 81 Width = 569 82 Anchors = [akTop, akLeft, akRight, akBottom] 83 Columns = < 84 item 85 Caption = 'Id' 86 Width = 40 87 end 88 item 89 Caption = 'Name' 90 end 91 item 92 Caption = 'Usage' 93 end 94 item 95 Caption = 'Priority' 96 end 97 item 98 Caption = 'State' 99 Width = 60 100 end 101 item 102 Caption = 'Execution time' 103 Width = 70 104 end 105 item 106 Caption = 'Completion' 107 end 108 item 109 Caption = 'Used stack' 110 Width = 178 111 end> 112 OwnerData = True 113 ReadOnly = True 114 RowSelect = True 115 TabOrder = 0 116 ViewStyle = vsReport 117 OnData = ListView1Data 118 end 119 object Label1: TLabel 120 Left = 222 121 Height = 14 122 Top = 7 123 Width = 85 124 Caption = 'Microthread list' 125 ParentColor = False 126 end 127 object GroupBox1: TGroupBox 128 Left = 6 129 Height = 81 130 Top = 143 131 Width = 205 132 Caption = 'State' 133 ClientHeight = 66 134 ClientWidth = 201 135 TabOrder = 1 136 object Label5: TLabel 137 Left = 9 138 Height = 14 139 Top = 4 140 Width = 135 141 Caption = 'Logical processor count:' 142 ParentColor = False 143 end 144 object Label6: TLabel 145 Left = 150 146 Height = 14 147 Top = 4 148 Width = 13 149 Caption = ' ' 150 ParentColor = False 151 end 152 object Label7: TLabel 153 Left = 8 154 Height = 14 155 Top = 20 156 Width = 78 157 Caption = 'Thread count:' 158 ParentColor = False 159 end 160 object Label8: TLabel 161 Left = 9 162 Height = 14 163 Top = 36 164 Width = 107 165 Caption = 'Micro thread count:' 166 ParentColor = False 167 end 168 object Label9: TLabel 169 Left = 150 170 Height = 14 171 Top = 20 172 Width = 13 173 Caption = ' ' 174 ParentColor = False 175 end 176 object Label10: TLabel 177 Left = 151 178 Height = 14 179 Top = 36 180 Width = 13 181 Caption = ' ' 182 ParentColor = False 183 end 184 end 185 object GroupBox2: TGroupBox 186 Left = 6 187 Height = 126 188 Top = 7 189 Width = 206 190 Caption = 'Control' 191 ClientHeight = 111 192 ClientWidth = 202 193 TabOrder = 2 194 object ButtonSchedulerStartStop: TButton 195 Left = 8 196 Height = 25 197 Top = 7 198 Width = 103 199 Caption = 'Start scheduler' 200 OnClick = ButtonSchedulerStartStopClick 201 TabOrder = 0 202 end 203 object Label3: TLabel 204 Left = 8 205 Height = 14 206 Top = 46 207 Width = 78 208 Caption = 'Thread count:' 209 ParentColor = False 210 end 211 object SpinEdit2: TSpinEdit 212 Left = 96 213 Height = 21 214 Top = 39 215 Width = 74 216 OnChange = SpinEdit2Change 217 TabOrder = 1 218 end 219 end 220 end 221 object TabSheet3: TTabSheet 222 Caption = 'Testing' 223 ClientHeight = 516 224 ClientWidth = 845 225 object ButtonShowThreadId: TButton 226 Left = 14 227 Height = 25 228 Top = 47 229 Width = 147 230 Caption = 'Show thread id' 231 OnClick = ButtonShowThreadIdClick 232 TabOrder = 0 233 end 234 object ButtonGetMaxThread: TButton 235 Left = 14 236 Height = 25 237 Top = 79 238 Width = 147 239 Caption = 'Get max TThread count' 240 OnClick = ButtonGetMaxThreadClick 241 TabOrder = 1 242 end 243 object Label2: TLabel 244 Left = 78 245 Height = 14 246 Top = 135 247 Width = 38 248 Caption = 'Label2' 249 ParentColor = False 250 end 251 object Button2: TButton 252 Left = 14 253 Height = 25 254 Top = 15 255 Width = 147 256 Caption = 'Read stack frame info' 257 OnClick = Button2Click 258 TabOrder = 2 259 end 260 end 21 261 end 22 object ListView1: TListView 23 Left = 310 24 Height = 483 25 Top = 24 26 Width = 481 27 Anchors = [akTop, akLeft, akRight, akBottom] 28 Columns = < 29 item 30 Caption = 'Id' 31 Width = 40 32 end 33 item 34 Caption = 'Name' 35 end 36 item 37 Caption = 'Usage' 38 end 39 item 40 Caption = 'Priority' 41 end 42 item 43 Caption = 'State' 44 Width = 60 45 end 46 item 47 Caption = 'Execution time' 48 Width = 70 49 end 50 item 51 Caption = 'Completion' 52 end> 53 OwnerData = True 54 ReadOnly = True 55 RowSelect = True 56 TabOrder = 1 57 ViewStyle = vsReport 58 OnData = ListView1Data 262 object TimerRedraw: TTimer 263 Interval = 100 264 OnTimer = TimerRedrawTimer 265 left = 427 266 top = 115 59 267 end 60 object Label1: TLabel 61 Left = 312 62 Height = 14 63 Top = 8 64 Width = 74 65 Caption = 'Microthread list' 66 ParentColor = False 67 end 68 object Memo1: TMemo 69 Left = 10 70 Height = 267 71 Top = 240 72 Width = 294 73 Anchors = [akTop, akLeft, akBottom] 74 ScrollBars = ssAutoBoth 75 TabOrder = 2 76 end 77 object Button2: TButton 78 Left = 224 79 Height = 25 80 Top = 208 81 Width = 75 82 Caption = 'Button2' 83 OnClick = Button2Click 84 TabOrder = 3 85 end 86 object Label2: TLabel 87 Left = 10 88 Height = 14 89 Top = 192 90 Width = 32 91 Caption = 'Label2' 92 ParentColor = False 93 end 94 object ButtonAddWorkers: TButton 95 Left = 10 96 Height = 25 97 Top = 72 98 Width = 104 99 Caption = 'Add workers' 100 OnClick = ButtonAddWorkersClick 101 TabOrder = 4 102 end 103 object SpinEdit1: TSpinEdit 104 Left = 224 105 Height = 21 106 Top = 76 107 Width = 74 108 MaxValue = 100000 109 MinValue = 1 110 TabOrder = 5 111 Value = 200 112 end 113 object ButtonGetMaxThread: TButton 114 Left = 168 115 Height = 25 116 Top = 160 117 Width = 131 118 Caption = 'Get max TThread count' 119 OnClick = ButtonGetMaxThreadClick 120 TabOrder = 6 121 end 122 object ButtonShowThreadId: TButton 123 Left = 40 124 Height = 25 125 Top = 160 126 Width = 123 127 Caption = 'Show thread id' 128 OnClick = ButtonShowThreadIdClick 129 TabOrder = 7 130 end 131 object SpinEdit2: TSpinEdit 132 Left = 224 133 Height = 21 134 Top = 13 135 Width = 74 136 OnChange = SpinEdit2Change 137 TabOrder = 8 138 Value = 1 139 end 140 object Label3: TLabel 141 Left = 120 142 Height = 14 143 Top = 20 144 Width = 69 145 Caption = 'Thread count:' 146 ParentColor = False 147 end 148 object Label4: TLabel 149 Left = 120 150 Height = 14 151 Top = 79 152 Width = 92 153 Caption = 'Microthread count:' 154 ParentColor = False 155 end 156 object Label5: TLabel 157 Left = 120 158 Height = 14 159 Top = 40 160 Width = 117 161 Caption = 'Logical processor count:' 162 ParentColor = False 163 end 164 object Label6: TLabel 165 Left = 248 166 Height = 14 167 Top = 40 168 Width = 13 169 Caption = ' ' 170 ParentColor = False 171 end 172 object ButtonClearMicroThreads: TButton 173 Left = 10 174 Height = 25 175 Top = 102 176 Width = 104 177 Caption = 'Clear microthreads' 178 OnClick = ButtonClearMicroThreadsClick 179 TabOrder = 9 180 end 181 object Timer1: TTimer 182 Interval = 100 183 OnTimer = Timer1Timer 184 left = 399 185 top = 87 268 object TimerSchedulerStart: TTimer 269 Interval = 10 270 OnTimer = TimerSchedulerStartTimer 271 left = 429 272 top = 163 186 273 end 187 274 end -
MicroThreading/Demo/UMainForm.pas
r148 r149 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, ExtCtrls, Spin, UMicroThreading, Coroutine, DateUtils ;9 ComCtrls, ExtCtrls, Spin, UMicroThreading, Coroutine, DateUtils, UPlatform; 10 10 11 11 type … … 14 14 15 15 TMainForm = class(TForm) 16 ButtonSchedulerStartStop: TButton;17 16 Button2: TButton; 18 17 ButtonAddWorkers: TButton; 18 ButtonClearMicroThreads: TButton; 19 19 ButtonGetMaxThread: TButton; 20 ButtonSchedulerStartStop: TButton; 20 21 ButtonShowThreadId: TButton; 21 ButtonClearMicroThreads: TButton; 22 GroupBox1: TGroupBox; 23 GroupBox2: TGroupBox; 22 24 Label1: TLabel; 25 Label10: TLabel; 23 26 Label2: TLabel; 24 27 Label3: TLabel; … … 26 29 Label5: TLabel; 27 30 Label6: TLabel; 31 Label7: TLabel; 32 Label8: TLabel; 33 Label9: TLabel; 28 34 ListView1: TListView; 29 35 Memo1: TMemo; 36 PageControl1: TPageControl; 30 37 SpinEdit1: TSpinEdit; 31 38 SpinEdit2: TSpinEdit; 32 Timer1: TTimer; 39 TabSheet1: TTabSheet; 40 TabSheet2: TTabSheet; 41 TabSheet3: TTabSheet; 42 TimerRedraw: TTimer; 43 TimerSchedulerStart: TTimer; 33 44 procedure ButtonSchedulerStartStopClick(Sender: TObject); 34 45 procedure Button2Click(Sender: TObject); … … 40 51 procedure FormCreate(Sender: TObject); 41 52 procedure FormDestroy(Sender: TObject); 53 procedure FormShow(Sender: TObject); 42 54 procedure ListView1Data(Sender: TObject; Item: TListItem); 43 55 procedure SpinEdit2Change(Sender: TObject); 44 procedure Timer1Timer(Sender: TObject); 56 procedure TimerRedrawTimer(Sender: TObject); 57 procedure TimerSchedulerStartTimer(Sender: TObject); 45 58 private 46 59 procedure Worker(MicroThread: TMicroThread); … … 65 78 DoubleBuffered := True; 66 79 ListView1.DoubleBuffered := True; 67 Label6.Caption := IntToStr( Scheduler.GetCPUCoreCount);80 Label6.Caption := IntToStr(GetLogicalProcessorCount); 68 81 end; 69 82 … … 185 198 end; 186 199 200 procedure TMainForm.FormShow(Sender: TObject); 201 begin 202 end; 203 187 204 procedure TMainForm.ListView1Data(Sender: TObject; Item: TListItem); 188 205 begin … … 198 215 Item.SubItems.Add(FloatToStr(ExecutionTime)); 199 216 Item.SubItems.Add(IntToStr(Trunc(Completion * 100)) + '%'); 217 Item.SubItems.Add(IntToStr(StackUsed)); 200 218 end; 201 219 finally … … 209 227 end; 210 228 211 procedure TMainForm.Timer 1Timer(Sender: TObject);229 procedure TMainForm.TimerRedrawTimer(Sender: TObject); 212 230 begin 213 231 ListView1.Items.Count := Scheduler.MicroThreadCount; 214 232 ListView1.Items[-1]; 215 233 ListView1.Refresh; 216 Label2.Caption := DateTimeToStr(Scheduler.GetNow) + ' ' + 217 FloatToStr(Frac(Scheduler.GetNow / OneSecond)); 234 Label2.Caption := DateTimeToStr(NowPrecise) + ' ' + 235 FloatToStr(Frac(NowPrecise / OneSecond)); 236 Label9.Caption := IntToStr(Scheduler.ThreadPoolCount); 237 Label10.Caption := IntToStr(Scheduler.MicroThreadCount); 238 end; 239 240 procedure TMainForm.TimerSchedulerStartTimer(Sender: TObject); 241 begin 242 TimerSchedulerStart.Enabled := False; 243 ButtonAddWorkers.Click; 244 ButtonSchedulerStartStop.Click; 218 245 end; 219 246 … … 226 253 begin 227 254 with MicroThread do begin 228 Memo1.Lines.Add('Worker ' + IntToStr(Id));255 //Memo1.Lines.Add('Worker ' + IntToStr(Id)); 229 256 for I := 0 to TotalSteps - 1 do begin 230 257 Q := 0; 231 while Q < 10000 00do Inc(Q);258 while Q < 10000 do Inc(Q); 232 259 //Memo1.Lines.Add(IntToStr(Id) + ': ' + IntToStr(I) + ' ' + 233 260 // FloatToStr(ExecutionTime));
Note:
See TracChangeset
for help on using the changeset viewer.