Changeset c9ec301
- Timestamp:
- Apr 5, 2021, 3:12:16 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5cb51502
- Parents:
- 8e85344
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/alarm.cfa
r8e85344 rc9ec301 15 15 16 16 #define __cforall_thread__ 17 // #define __CFA_DEBUG_PRINT_PREEMPTION__ 17 18 18 19 #include <errno.h> … … 107 108 bool first = ! & alarms`first; 108 109 110 __cfadbg_print_safe( preemption, " KERNEL: alarm inserting %p (%lu).\n", this, this->alarm.tn ); 109 111 insert( &alarms, this ); 110 112 if( first ) { -
libcfa/src/concurrency/preemption.cfa
r8e85344 rc9ec301 117 117 //Loop throught every thing expired 118 118 while( node = get_expired( alarms, currtime ) ) { 119 // __cfaabi_dbg_print_buffer_decl( " KERNEL: preemption tick.\n");119 __cfadbg_print_buffer_decl( preemption, " KERNEL: preemption tick %lu\n", currtime.tn); 120 120 Duration period = node->period; 121 121 if( period == 0) { … … 123 123 } 124 124 125 __cfadbg_print_buffer_local( preemption, " KERNEL: alarm ticking node %p.\n", node ); 126 127 125 128 // Check if this is a kernel 126 129 if( node->type == Kernel ) { … … 128 131 } 129 132 else if( node->type == User ) { 133 __cfadbg_print_buffer_local( preemption, " KERNEL: alarm unparking %p.\n", node->thrd ); 130 134 timeout( node->thrd ); 131 135 } … … 136 140 // Check if this is a periodic alarm 137 141 if( period > 0 ) { 138 // __cfaabi_dbg_print_buffer_local( " KERNEL: alarm period is %lu.\n", period.tv);142 __cfadbg_print_buffer_local( preemption, " KERNEL: alarm period is %lu.\n", period`ns ); 139 143 node->alarm = currtime + period; // Alarm is periodic, add currtime to it (used cached current time) 140 144 insert( alarms, node ); // Reinsert the node for the next time it triggers … … 712 716 static void * alarm_loop( __attribute__((unused)) void * args ) { 713 717 __processor_id_t id; 714 id.full_proc = false;715 718 id.id = doregister(&id); 716 719 __cfaabi_tls.this_proc_id = &id; 717 720 718 #if !defined(__CFA_NO_STATISTICS__)719 struct __stats_t local_stats;720 __cfaabi_tls.this_stats = &local_stats;721 __init_stats( &local_stats );722 #endif723 721 724 722 // Block sigalrms to control when they arrive … … 781 779 unregister(&id); 782 780 783 #if !defined(__CFA_NO_STATISTICS__)784 if( 0 != __print_alarm_stats ) {785 __print_stats( &local_stats, __print_alarm_stats, "Alarm", "Thread", 0p );786 }787 #endif781 // #if !defined(__CFA_NO_STATISTICS__) 782 // if( 0 != __print_alarm_stats ) { 783 // __print_stats( &local_stats, __print_alarm_stats, "Alarm", "Thread", 0p ); 784 // } 785 // #endif 788 786 return 0p; 789 787 }
Note: See TracChangeset
for help on using the changeset viewer.