Changeset 3d5bcded in rtems


Ignore:
Timestamp:
10/03/14 19:01:44 (9 years ago)
Author:
Jennifer Averett <jennifer.averett@…>
Branches:
4.11, 5, master
Children:
04a13bd
Parents:
f7d2795
git-author:
Jennifer Averett <jennifer.averett@…> (10/03/14 19:01:44)
git-committer:
Jennifer Averett <jennifer.averett@…> (11/24/14 20:04:53)
Message:

capture: Move logging of task record to occur after filter check.

The catpture task record is now logged just prior to the first
log entry using that task instead of the first time the task
is seen. This involved splitting the record task method into
an initialize task and a record task.

Location:
cpukit/libmisc/capture
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/capture/capture.c

    rf7d2795 r3d5bcded  
    314314}
    315315
    316 void rtems_capture_record_task( rtems_tcb* tcb )
     316void rtems_capture_initialize_task( rtems_tcb* tcb )
    317317{
    318318  rtems_capture_control_t*    control;
    319   rtems_capture_task_record_t rec;
    320   void*                       ptr;
    321 
    322   rtems_object_get_classic_name( tcb->Object.id, &rec.name );
     319  rtems_name                  name;
    323320
    324321  /*
     
    327324   */
    328325
     326  rtems_object_get_classic_name( tcb->Object.id, &name );
     327
    329328  if (tcb->Capture.control == NULL) {
    330329    for (control = capture_controls; control != NULL; control = control->next)
    331330      if (rtems_capture_match_name_id (control->name, control->id,
    332                                        rec.name, tcb->Object.id))
     331                                       name, tcb->Object.id))
    333332        tcb->Capture.control = control;
    334333  }
    335334
     335  tcb->Capture.flags |= RTEMS_CAPTURE_INIT_TASK;
     336}
     337
     338void rtems_capture_record_task( rtems_tcb* tcb )
     339{
     340  rtems_capture_task_record_t rec;
     341  void*                       ptr;
     342
     343  rtems_object_get_classic_name( tcb->Object.id, &rec.name );
     344   
    336345  rec.stack_size = tcb->Start.Initial_stack.size;
    337346  rec.start_priority = _RTEMS_tasks_Priority_from_Core(
     
    12251234  uint32_t                     counted;
    12261235  size_t                       ptr_size = 0;
     1236  size_t                       rel_size = 0;
     1237  rtems_status_code            ret_val = RTEMS_SUCCESSFUL;
    12271238
    12281239  rtems_interrupt_lock_acquire (&capture_lock, &lock_context);
     
    12381249  _Assert(ptr_size >= (count * sizeof(*rec) ));
    12391250
    1240   ptr_size = 0;
     1251  rel_size = 0;
    12411252  while (counted--)
    1242   { 
     1253  {
    12431254    rec = (rtems_capture_record_t*) ptr;
    1244     ptr_size += rec->size;
     1255    rel_size += rec->size;
     1256    _Assert( rel_size <= ptr_size );
    12451257    ptr += rec->size;
    12461258  }
     
    12481260  rtems_interrupt_lock_acquire (&capture_lock, &lock_context);
    12491261
     1262  if (rel_size > ptr_size ) {
     1263    ret_val = RTEMS_INVALID_NUMBER;
     1264    rel_size = ptr_size;
     1265  }
     1266
    12501267  capture_count -= count;
    12511268
    12521269  if (count)
    1253     rtems_capture_buffer_free( &capture_records, ptr_size );
     1270    rtems_capture_buffer_free( &capture_records, rel_size );
    12541271
    12551272  capture_flags &= ~RTEMS_CAPTURE_READER_ACTIVE;
     
    12571274  rtems_interrupt_lock_release (&capture_lock, &lock_context);
    12581275
    1259   return RTEMS_SUCCESSFUL;
     1276  return ret_val;
    12601277}
    12611278
  • cpukit/libmisc/capture/capture.h

    rf7d2795 r3d5bcded  
    142142 */
    143143#define RTEMS_CAPTURE_TRACED      (1U << 0)
    144 #define RTEMS_CAPTURE_RECORD_TASK (1U << 1)
     144#define RTEMS_CAPTURE_INIT_TASK   (1U << 1)
     145#define RTEMS_CAPTURE_RECORD_TASK (1U << 2)
    145146
    146147/*
     
    599600
    600601/**
     602 * @brief Capture initialize task
     603 *
     604 * This function initializes capture control in the tcb.
     605 *
     606 * @param[in] tcb is the task control block for the task
     607 */
     608void rtems_capture_initialize_task( rtems_tcb* tcb );
     609
     610/**
    601611 * @brief Capture record task.
    602612 *
     
    617627static inline bool rtems_capture_task_recorded( rtems_tcb* tcb ) {
    618628  return ( (tcb->Capture.flags & RTEMS_CAPTURE_RECORD_TASK) != 0 );
     629}
     630
     631/**
     632 * @brief Capture task initialized
     633 *
     634 * This function returns true if this task information has been
     635 * initialized.
     636 *
     637 * @param[in] tcb is the task control block for the task
     638 */
     639static inline bool rtems_capture_task_initialized( rtems_tcb* tcb ) {
     640  return ( (tcb->Capture.flags & RTEMS_CAPTURE_INIT_TASK) != 0 );
    619641}
    620642
  • cpukit/libmisc/capture/capture_user_extension.c

    rf7d2795 r3d5bcded  
    9696  if (rtems_capture_filter( tcb, events) )
    9797    return;
     98 
     99  if (!rtems_capture_task_recorded (tcb))
     100    rtems_capture_record_task (tcb);
    98101
    99102  rtems_capture_begin_add_record (tcb, events, size, &ptr);
     
    142145   */
    143146
    144   if (!rtems_capture_task_recorded (ct))
    145     rtems_capture_record_task (ct);
     147  if (!rtems_capture_task_initialized (ct))
     148    rtems_capture_initialize_task (ct);
    146149
    147150  /*
    148151   * Create the new task's capture control block.
    149152   */
    150   rtems_capture_record_task (nt);
     153  rtems_capture_initialize_task (nt);
    151154
    152155  if (rtems_capture_trigger (ct, nt, RTEMS_CAPTURE_CREATE))
     
    171174   */
    172175
    173   if (!rtems_capture_task_recorded (ct))
    174     rtems_capture_record_task (ct);
     176  if (!rtems_capture_task_initialized (ct))
     177    rtems_capture_initialize_task (ct);
    175178
    176179  if (st == NULL)
    177     rtems_capture_record_task (st);
     180    rtems_capture_initialize_task (st);
    178181
    179182  if (rtems_capture_trigger (ct, st, RTEMS_CAPTURE_START))
     
    196199   */
    197200
    198   if (!rtems_capture_task_recorded (ct))
    199     rtems_capture_record_task (ct);
    200 
    201   if (!rtems_capture_task_recorded (rt))
    202     rtems_capture_record_task (rt);
     201  if (!rtems_capture_task_initialized (ct))
     202    rtems_capture_initialize_task (ct);
     203
     204  if (!rtems_capture_task_initialized (rt))
     205    rtems_capture_initialize_task (rt);
    203206
    204207  if (rtems_capture_trigger (ct, rt, RTEMS_CAPTURE_RESTART))
     
    216219                           rtems_tcb* dt)
    217220{
    218   if (!rtems_capture_task_recorded (ct))
    219     rtems_capture_record_task (ct);
    220 
    221   if (!rtems_capture_task_recorded (dt))
    222     rtems_capture_record_task (dt);
     221  if (!rtems_capture_task_initialized (ct))
     222    rtems_capture_initialize_task (ct);
     223
     224  if (!rtems_capture_task_initialized (dt))
     225    rtems_capture_initialize_task (dt);
    223226
    224227  if (rtems_capture_trigger (ct, dt, RTEMS_CAPTURE_DELETE))
     
    240243   */
    241244
    242   if (!rtems_capture_task_recorded (bt))
    243     rtems_capture_record_task (bt);
     245  if (!rtems_capture_task_initialized (bt))
     246    rtems_capture_initialize_task (bt);
    244247
    245248  if (rtems_capture_trigger (NULL, bt, RTEMS_CAPTURE_BEGIN))
     
    259262   */
    260263
    261   if (!rtems_capture_task_recorded (et))
    262     rtems_capture_record_task (et);
     264  if (!rtems_capture_task_initialized (et))
     265    rtems_capture_initialize_task (et);
    263266
    264267  if (rtems_capture_trigger (NULL, et, RTEMS_CAPTURE_EXITTED))
     
    277280   */
    278281
    279   if (!rtems_capture_task_recorded (tt))
    280     rtems_capture_record_task (tt);
     282  if (!rtems_capture_task_initialized (tt))
     283    rtems_capture_initialize_task (tt);
    281284
    282285  if (rtems_capture_trigger (NULL, tt, RTEMS_CAPTURE_TERMINATED))
     
    301304    rtems_capture_time_t time;
    302305
    303     if (!rtems_capture_task_recorded (ct))
    304       rtems_capture_record_task (ct);
    305 
    306     if (!rtems_capture_task_recorded (ht))
    307       rtems_capture_record_task (ht);
     306    if (!rtems_capture_task_initialized (ct))
     307      rtems_capture_initialize_task (ct);
     308
     309    if (!rtems_capture_task_initialized (ht))
     310      rtems_capture_initialize_task (ht);
    308311
    309312    /*
Note: See TracChangeset for help on using the changeset viewer.