Changeset 47746a2 for libcfa/src
- Timestamp:
- Jul 8, 2020, 2:01:05 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 69237cd
- Parents:
- b9237fe
- Location:
- libcfa/src/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
rb9237fe r47746a2 191 191 struct io_uring_params params; 192 192 memset(¶ms, 0, sizeof(params)); 193 if( io_flags & CFA_CLUSTER_IO_KERNEL_POLL_SUBMITS ) params.flags |= IORING_SETUP_SQPOLL; 194 if( io_flags & CFA_CLUSTER_IO_KERNEL_POLL_COMPLETES ) params.flags |= IORING_SETUP_IOPOLL; 193 195 194 196 uint32_t nentries = entries_per_cluster(); … … 264 266 } 265 267 } 268 269 (sq.lock){}; 266 270 267 271 if( io_flags & ( CFA_CLUSTER_IO_POLLER_THREAD_SUBMITS | CFA_CLUSTER_IO_EAGER_SUBMITS ) ) { … … 457 461 458 462 // update statistics 459 #if !defined(__CFA_NO_STATISTICS__)463 __STATS__( true, 460 464 if( to_submit > 0 ) { 461 __tls_stats()->io.submit_q.submit_avg.rdy += to_submit;462 __tls_stats()->io.submit_q.submit_avg.csm += ret;463 __tls_stats()->io.submit_q.submit_avg.cnt += 1;464 } 465 #endif465 io.submit_q.submit_avg.rdy += to_submit; 466 io.submit_q.submit_avg.csm += ret; 467 io.submit_q.submit_avg.cnt += 1; 468 } 469 ) 466 470 467 471 // Drain the queue … … 543 547 544 548 // Update statistics 545 #if !defined(__CFA_NO_STATISTICS__)546 __tls_stats()->io.complete_q.completed_avg.val += count;547 __tls_stats()->io.complete_q.completed_avg.slow_cnt += 1;548 #endif549 __STATS__( true, 550 io.complete_q.completed_avg.val += count; 551 io.complete_q.completed_avg.slow_cnt += 1; 552 ) 549 553 550 554 if(again) { … … 563 567 564 568 // Update statistics 565 #if !defined(__CFA_NO_STATISTICS__)566 __tls_stats()->io.complete_q.completed_avg.val += count;567 __tls_stats()->io.complete_q.completed_avg.slow_cnt += 1;568 #endif569 __STATS__( true, 570 io.complete_q.completed_avg.val += count; 571 io.complete_q.completed_avg.slow_cnt += 1; 572 ) 569 573 } 570 574 } … … 603 607 604 608 // Update statistics 605 #if !defined(__CFA_NO_STATISTICS__)606 __tls_stats()->io.complete_q.completed_avg.val += count;607 __tls_stats()->io.complete_q.completed_avg.fast_cnt += 1;608 #endif609 __STATS__( true, 610 io.complete_q.completed_avg.val += count; 611 io.complete_q.completed_avg.fast_cnt += 1; 612 ) 609 613 enable_interrupts( __cfaabi_dbg_ctx ); 610 614 … … 683 687 { 684 688 // update statistics 685 #if !defined(__CFA_NO_STATISTICS__) 686 disable_interrupts(); 687 __tls_stats()->io.submit_q.alloc_avg.val += len; 688 __tls_stats()->io.submit_q.alloc_avg.block += block; 689 __tls_stats()->io.submit_q.alloc_avg.cnt += 1; 690 enable_interrupts( __cfaabi_dbg_ctx ); 691 #endif 689 __STATS__( false, 690 io.submit_q.alloc_avg.val += len; 691 io.submit_q.alloc_avg.block += block; 692 io.submit_q.alloc_avg.cnt += 1; 693 ) 692 694 693 695 … … 736 738 737 739 // update statistics 738 #if !defined(__CFA_NO_STATISTICS__) 739 disable_interrupts(); 740 __tls_stats()->io.submit_q.look_avg.val += len; 741 __tls_stats()->io.submit_q.look_avg.block += block; 742 __tls_stats()->io.submit_q.look_avg.cnt += 1; 743 enable_interrupts( __cfaabi_dbg_ctx ); 744 #endif 740 __STATS__( false, 741 io.submit_q.look_avg.val += len; 742 io.submit_q.look_avg.block += block; 743 io.submit_q.look_avg.cnt += 1; 744 ) 745 745 746 746 return picked; … … 770 770 #warning ABA problem 771 771 if( ring.submit_q.ready[picked] != idx ) { 772 #if !defined(__CFA_NO_STATISTICS__) 773 disable_interrupts(); 774 __tls_stats()->io.submit_q.helped += 1; 775 enable_interrupts( __cfaabi_dbg_ctx ); 776 #endif 772 __STATS__( false, 773 io.submit_q.helped += 1; 774 ) 777 775 return; 778 776 } 779 777 780 778 if( try_lock(ring.submit_q.lock __cfaabi_dbg_ctx2) ) { 781 #if !defined(__CFA_NO_STATISTICS__)782 __tls_stats()->io.submit_q.leader += 1;783 #endif779 __STATS__( false, 780 io.submit_q.leader += 1; 781 ) 784 782 break; 785 783 } 786 784 787 #if !defined(__CFA_NO_STATISTICS__) 788 disable_interrupts(); 789 __tls_stats()->io.submit_q.busy += 1; 790 enable_interrupts( __cfaabi_dbg_ctx ); 791 #endif 785 __STATS__( false, 786 io.submit_q.busy += 1; 787 ) 792 788 } 793 789 … … 817 813 818 814 // update statistics 819 #if !defined(__CFA_NO_STATISTICS__)820 __tls_stats()->io.submit_q.submit_avg.rdy += to_submit;821 __tls_stats()->io.submit_q.submit_avg.csm += ret;822 __tls_stats()->io.submit_q.submit_avg.cnt += 1;823 #endif815 __STATS__( true, 816 io.submit_q.submit_avg.rdy += to_submit; 817 io.submit_q.submit_avg.csm += ret; 818 io.submit_q.submit_avg.cnt += 1; 819 ) 824 820 825 821 unlock(ring.submit_q.lock); … … 846 842 847 843 // update statistics 848 #if !defined(__CFA_NO_STATISTICS__) 849 disable_interrupts(); 850 abort(); 851 __tls_stats()->io.submit_q.submit_avg.csm += 1; 852 __tls_stats()->io.submit_q.submit_avg.cnt += 1; 853 enable_interrupts( __cfaabi_dbg_ctx ); 854 #endif 844 __STATS__( false, 845 io.submit_q.submit_avg.csm += 1; 846 io.submit_q.submit_avg.cnt += 1; 847 ) 855 848 856 849 ring.submit_q.sqes[ idx & mask ].user_data = 0; -
libcfa/src/concurrency/kernel.hfa
rb9237fe r47746a2 129 129 struct __io_data; 130 130 131 #define CFA_CLUSTER_IO_POLLER_USER_THREAD 1 << 0 // 0x1 132 #define CFA_CLUSTER_IO_POLLER_THREAD_SUBMITS 1 << 1 // 0x2 133 #define CFA_CLUSTER_IO_EAGER_SUBMITS 1 << 2 // 0x4 131 #define CFA_CLUSTER_IO_POLLER_USER_THREAD (1 << 0) // 0x01 132 #define CFA_CLUSTER_IO_POLLER_THREAD_SUBMITS (1 << 1) // 0x02 133 #define CFA_CLUSTER_IO_EAGER_SUBMITS (1 << 2) // 0x04 134 #define CFA_CLUSTER_IO_KERNEL_POLL_SUBMITS (1 << 3) // 0x08 135 #define CFA_CLUSTER_IO_KERNEL_POLL_COMPLETES (1 << 4) // 0x10 134 136 #define CFA_CLUSTER_IO_BUFFLEN_OFFSET 16 135 137 -
libcfa/src/concurrency/kernel_private.hfa
rb9237fe r47746a2 286 286 // Statics call at the end of each thread to register statistics 287 287 #if !defined(__CFA_NO_STATISTICS__) 288 static inline struct __stats_t * __tls_stats() { 289 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 290 /* paranoid */ verify( kernelTLS.this_stats ); 291 return kernelTLS.this_stats; 292 } 288 static inline struct __stats_t * __tls_stats() { 289 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 290 /* paranoid */ verify( kernelTLS.this_stats ); 291 return kernelTLS.this_stats; 292 } 293 294 #define __STATS__(in_kernel, ...) { \ 295 if( !(in_kernel) ) disable_interrupts(); \ 296 with( *__tls_stats() ) { \ 297 __VA_ARGS__ \ 298 } \ 299 if( !(in_kernel) ) enable_interrupts( __cfaabi_dbg_ctx ); \ 300 } 301 #else 302 #define __STATS__(in_kernel, ...) 293 303 #endif 294 304
Note: See TracChangeset
for help on using the changeset viewer.