Changeset c8a0210 for libcfa/src/concurrency/kernel
- Timestamp:
- Apr 16, 2021, 2:28:09 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 665edf40
- Parents:
- 857a1c6 (diff), 5f6a172 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
libcfa/src/concurrency/kernel/startup.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/startup.cfa
r857a1c6 rc8a0210 268 268 __print_stats( st, mainProcessor->print_stats, "Processor ", mainProcessor->name, (void*)mainProcessor ); 269 269 } 270 #if defined(CFA_STATS_ARRAY) 271 __flush_stat( st, "Processor", mainProcessor ); 272 #endif 270 273 #endif 271 274 … … 348 351 __print_stats( &local_stats, proc->print_stats, "Processor ", proc->name, (void*)proc ); 349 352 } 353 #if defined(CFA_STATS_ARRAY) 354 __flush_stat( &local_stats, "Processor", proc ); 355 #endif 350 356 #endif 351 357 … … 463 469 this.name = name; 464 470 this.cltr = &_cltr; 471 this.rdq.its = 0; 472 this.rdq.itr = 0; 473 this.rdq.id = -1u; 474 this.rdq.target = -1u; 475 this.rdq.cutoff = -1ull; 465 476 do_terminate = false; 466 477 preemption_alarm = 0p; … … 483 494 #endif 484 495 485 lock( this.cltr->idles ); 486 int target = this.cltr->idles.total += 1u; 487 unlock( this.cltr->idles ); 488 489 id = doregister((__processor_id_t*)&this); 490 496 // Register and Lock the RWlock so no-one pushes/pops while we are changing the queue 497 uint_fast32_t last_size = ready_mutate_register((__processor_id_t*)&this); 498 this.cltr->procs.total += 1u; 499 insert_last(this.cltr->procs.actives, this); 500 501 // Adjust the ready queue size 502 ready_queue_grow( cltr ); 503 504 // Unlock the RWlock 505 ready_mutate_unlock( last_size ); 506 507 __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this); 508 } 509 510 // Not a ctor, it just preps the destruction but should not destroy members 511 static void deinit(processor & this) { 491 512 // Lock the RWlock so no-one pushes/pops while we are changing the queue 492 513 uint_fast32_t last_size = ready_mutate_lock(); 514 this.cltr->procs.total -= 1u; 515 remove(this); 493 516 494 517 // Adjust the ready queue size 495 this.cltr_id = ready_queue_grow( cltr, target ); 496 497 // Unlock the RWlock 498 ready_mutate_unlock( last_size ); 499 500 __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this); 501 } 502 503 // Not a ctor, it just preps the destruction but should not destroy members 504 static void deinit(processor & this) { 505 lock( this.cltr->idles ); 506 int target = this.cltr->idles.total -= 1u; 507 unlock( this.cltr->idles ); 508 509 // Lock the RWlock so no-one pushes/pops while we are changing the queue 510 uint_fast32_t last_size = ready_mutate_lock(); 511 512 // Adjust the ready queue size 513 ready_queue_shrink( this.cltr, target ); 514 515 // Unlock the RWlock 516 ready_mutate_unlock( last_size ); 517 518 // Finally we don't need the read_lock any more 519 unregister((__processor_id_t*)&this); 518 ready_queue_shrink( this.cltr ); 519 520 // Unlock the RWlock and unregister: we don't need the read_lock any more 521 ready_mutate_unregister((__processor_id_t*)&this, last_size ); 520 522 521 523 close(this.idle); … … 560 562 //----------------------------------------------------------------------------- 561 563 // Cluster 562 static void ?{}(__cluster_ idles& this) {564 static void ?{}(__cluster_proc_list & this) { 563 565 this.lock = 0; 564 566 this.idle = 0; 565 567 this.total = 0; 566 (this.list){};567 568 } 568 569 … … 590 591 591 592 // Adjust the ready queue size 592 ready_queue_grow( &this , 0);593 ready_queue_grow( &this ); 593 594 594 595 // Unlock the RWlock … … 605 606 606 607 // Adjust the ready queue size 607 ready_queue_shrink( &this , 0);608 ready_queue_shrink( &this ); 608 609 609 610 // Unlock the RWlock … … 615 616 __print_stats( this.stats, this.print_stats, "Cluster", this.name, (void*)&this ); 616 617 } 618 #if defined(CFA_STATS_ARRAY) 619 __flush_stat( this.stats, "Cluster", &this ); 620 #endif 617 621 free( this.stats ); 618 622 #endif
Note:
See TracChangeset
for help on using the changeset viewer.