Changeset c9ec301


Ignore:
Timestamp:
Apr 5, 2021, 3:12:16 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
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
Message:

Fix debug printing with alarms

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/alarm.cfa

    r8e85344 rc9ec301  
    1515
    1616#define __cforall_thread__
     17// #define __CFA_DEBUG_PRINT_PREEMPTION__
    1718
    1819#include <errno.h>
     
    107108                bool first = ! & alarms`first;
    108109
     110                __cfadbg_print_safe( preemption, " KERNEL: alarm inserting %p (%lu).\n", this, this->alarm.tn );
    109111                insert( &alarms, this );
    110112                if( first ) {
  • libcfa/src/concurrency/preemption.cfa

    r8e85344 rc9ec301  
    117117        //Loop throught every thing expired
    118118        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);
    120120                Duration period = node->period;
    121121                if( period == 0) {
     
    123123                }
    124124
     125                __cfadbg_print_buffer_local( preemption, " KERNEL: alarm ticking node %p.\n", node );
     126
     127
    125128                // Check if this is a kernel
    126129                if( node->type == Kernel ) {
     
    128131                }
    129132                else if( node->type == User ) {
     133                        __cfadbg_print_buffer_local( preemption, " KERNEL: alarm unparking %p.\n", node->thrd );
    130134                        timeout( node->thrd );
    131135                }
     
    136140                // Check if this is a periodic alarm
    137141                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 );
    139143                        node->alarm = currtime + period;    // Alarm is periodic, add currtime to it (used cached current time)
    140144                        insert( alarms, node );             // Reinsert the node for the next time it triggers
     
    712716static void * alarm_loop( __attribute__((unused)) void * args ) {
    713717        __processor_id_t id;
    714         id.full_proc = false;
    715718        id.id = doregister(&id);
    716719        __cfaabi_tls.this_proc_id = &id;
    717720
    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         #endif
    723721
    724722        // Block sigalrms to control when they arrive
     
    781779        unregister(&id);
    782780
    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         #endif
     781        // #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
    788786        return 0p;
    789787}
Note: See TracChangeset for help on using the changeset viewer.