Changeset dca6184 in rtems


Ignore:
Timestamp:
Apr 28, 2018, 9:36:11 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
03cdd5ea
Parents:
f0ae613b
git-author:
Sebastian Huber <sebastian.huber@…> (04/28/18 09:36:11)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/29/19 12:51:33)
Message:

Add low level event recording support

Add low level event recording infrastructure for system and user
defined events. The infrastructure is able to record high frequency
events such as

  • SMP lock acquire/release,
  • interrupt entry/exit,
  • thread switches,
  • UMA zone allocate/free, and
  • Ethernet packet input/output, etc.

It allows post-mortem analysis in fatal error handlers, e.g. the last
events are in the record buffer, the newest event overwrites the oldest
event. It is possible to detect record buffer overflows for consumers
that expect a continuous stream of events, e.g. to display the system
state in real-time.

The implementation supports high-end SMP machines (more than 1GHz
processor frequency, more than four processors).

Add a new API instead. The implementation uses per-processor data
structures and no atomic read-modify-write operations. It is uses
per-processor ring buffers to record the events.

The CPU counter is used to get the time of events. It is combined with
periodic uptime events to synchronize it with CLOCK_REALTIME.

The existing capture engine tries to solve this problem also, but its
performance is not good enough for high-end production systems. The
main issues are the variable-size buffers and the use of SMP locks for
synchronization. To fix this, the API would change significantly.

Update #3665.

Files:
15 added
7 edited

Legend:

Unmodified
Added
Removed
  • cpukit/Makefile.am

    rf0ae613b rdca6184  
    477477librtemscpu_a_SOURCES += libstdthreads/thrd.c
    478478librtemscpu_a_SOURCES += libstdthreads/tss.c
     479librtemscpu_a_SOURCES += libtrace/record/record.c
     480librtemscpu_a_SOURCES += libtrace/record/record-client.c
     481librtemscpu_a_SOURCES += libtrace/record/record-server.c
     482librtemscpu_a_SOURCES += libtrace/record/record-sysinit.c
     483librtemscpu_a_SOURCES += libtrace/record/record-text.c
     484librtemscpu_a_SOURCES += libtrace/record/record-userext.c
    479485librtemscpu_a_SOURCES += posix/src/adjtime.c
    480486librtemscpu_a_SOURCES += posix/src/aio_suspend.c
  • cpukit/headers.am

    rf0ae613b rdca6184  
    137137include_rtems_HEADERS += include/rtems/rbheap.h
    138138include_rtems_HEADERS += include/rtems/rbtree.h
     139include_rtems_HEADERS += include/rtems/record.h
     140include_rtems_HEADERS += include/rtems/recordclient.h
     141include_rtems_HEADERS += include/rtems/recorddata.h
    139142include_rtems_HEADERS += include/rtems/ringbuf.h
    140143include_rtems_HEADERS += include/rtems/rtc.h
  • cpukit/include/rtems/confdefs.h

    rf0ae613b rdca6184  
    21242124    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
    21252125  static const rtems_extensions_table Configuration_Initial_Extensions[] = {
     2126    #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0 && \
     2127      defined(CONFIGURE_RECORD_EXTENSIONS_ENABLED)
     2128      RECORD_EXTENSION,
     2129    #endif
    21262130    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
    21272131      RTEMS_NEWLIB_EXTENSION,
     
    29662970    #endif
    29672971  };
     2972
     2973  #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
     2974    #include <rtems/record.h>
     2975
     2976    #if (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS & (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS - 1)) != 0
     2977      #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be a power of two"
     2978    #endif
     2979
     2980    #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS < 16
     2981      #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16"
     2982    #endif
     2983
     2984    const unsigned int _Record_Item_count = CONFIGURE_RECORD_PER_PROCESSOR_ITEMS;
     2985
     2986    struct Record_Configured_control {
     2987      Record_Control    Control;
     2988      rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ];
     2989    };
     2990
     2991    PER_CPU_DATA_ITEM( Record_Configured_control, _Record_Per_CPU );
     2992
     2993    RTEMS_SYSINIT_ITEM(
     2994      _Record_Initialize,
     2995      RTEMS_SYSINIT_RECORD,
     2996      RTEMS_SYSINIT_ORDER_MIDDLE
     2997    );
     2998  #endif
    29682999#endif
    29693000
  • cpukit/include/rtems/score/percpu.h

    rf0ae613b rdca6184  
    6969
    7070#if !defined( ASM )
     71
     72struct Record_Control;
    7173
    7274struct _Thread_Control;
     
    514516  #endif
    515517
     518  struct Record_Control *record;
     519
    516520  Per_CPU_Stats Stats;
    517521} Per_CPU_Control;
  • cpukit/include/rtems/sysinit.h

    rf0ae613b rdca6184  
    3434#define RTEMS_SYSINIT_DATA_STRUCTURES            000600
    3535#define RTEMS_SYSINIT_MP                         000700
     36#define RTEMS_SYSINIT_RECORD                     000800
    3637#define RTEMS_SYSINIT_USER_EXTENSIONS            000900
    3738#define RTEMS_SYSINIT_CLASSIC_TASKS              000a00
  • testsuites/libtests/Makefile.am

    rf0ae613b rdca6184  
    994994realloc_norun_SOURCES = POSIX/realloc.c
    995995realloc_norun_LDADD = $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a $(LDADD)
     996endif
     997
     998if TEST_record01
     999lib_tests += record01
     1000lib_screens += record01/record01.scn
     1001lib_docs += record01/record01.doc
     1002record01_SOURCES = record01/init.c
     1003record01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_record01) \
     1004        $(support_includes) -I$(RTEMS_SOURCE_ROOT)/cpukit/libnetworking
     1005endif
     1006
     1007if TEST_record02
     1008lib_tests += record02
     1009lib_screens += record02/record02.scn
     1010lib_docs += record02/record02.doc
     1011record02_SOURCES = record02/init.c
     1012record02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_record02) \
     1013        $(support_includes)
    9961014endif
    9971015
  • testsuites/libtests/configure.ac

    rf0ae613b rdca6184  
    190190RTEMS_TEST_CHECK([readv])
    191191RTEMS_TEST_CHECK([realloc])
     192RTEMS_TEST_CHECK([record01])
     193RTEMS_TEST_CHECK([record02])
    192194RTEMS_TEST_CHECK([rtmonuse])
    193195RTEMS_TEST_CHECK([setjmp])
Note: See TracChangeset for help on using the changeset viewer.