Changeset 801ad184 in rtems for cpukit/sapi


Ignore:
Timestamp:
Oct 24, 2014, 5:09:31 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
092b8c5
Parents:
17889b2
Message:

sapi: Use an interrupt lock for test extension

Ensure to report only once on SMP machines and ensure that the report is
output completely.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/src/testextension.c

    r17889b2 r801ad184  
    2020#include <rtems/profiling.h>
    2121
    22 #if defined(RTEMS_SMP)
    23 #include <rtems/score/smpimpl.h>
    24 #endif
     22static bool report_done;
    2523
    26 #if defined(RTEMS_PROFILING)
    27 static bool should_report(
    28   rtems_fatal_source source,
    29   rtems_fatal_code code
    30 )
    31 {
    32 #if defined(RTEMS_SMP)
    33   return source != RTEMS_FATAL_SOURCE_SMP
    34     || code != SMP_FATAL_SHUTDOWN_RESPONSE;
    35 #else
    36   (void) source;
    37   (void) code;
    38 
    39   return true;
    40 #endif
    41 }
    42 #endif
     24static rtems_interrupt_lock report_lock =
     25  RTEMS_INTERRUPT_LOCK_INITIALIZER( "test report" );
    4326
    4427void rtems_test_fatal_extension(
     
    4831)
    4932{
    50   (void) is_internal;
     33#if defined(RTEMS_PROFILING)
     34  rtems_interrupt_lock_context lock_context;
    5135
    52 #if defined(RTEMS_PROFILING)
    53   if ( should_report( source, code ) ) {
     36  /*
     37   * Ensures to report only once on SMP machines and ensures that the report is
     38   * output completely.
     39   */
     40  rtems_interrupt_lock_acquire( &report_lock, &lock_context );
     41
     42  if ( !report_done ) {
     43    report_done = true;
     44
    5445    printk(
    5546      "\n*** PROFILING REPORT BEGIN %s ***\n",
     
    7061    );
    7162  }
     63
     64  rtems_interrupt_lock_release( &report_lock, &lock_context );
    7265#endif
     66
     67  (void) source;
     68  (void) is_internal;
     69  (void) code;
    7370}
Note: See TracChangeset for help on using the changeset viewer.