Changeset 254b7db0 in rtems


Ignore:
Timestamp:
Sep 8, 2014, 2:47:13 PM (6 years ago)
Author:
Jennifer Averett <jennifer.averett@…>
Branches:
4.11, 5, master
Children:
6031da4
Parents:
05e4e599
git-author:
Jennifer Averett <jennifer.averett@…> (09/08/14 14:47:13)
git-committer:
Jennifer Averett <jennifer.averett@…> (10/27/14 19:02:36)
Message:

capture01: Remove capture task tracking.

This involved adding a new variable record to the capture buffer
and modifing the trace method to read those records.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/capture01/init.c

    r05e4e599 r254b7db0  
    114114}
    115115
     116/*
     117 * rtems_catpure_cli_print_uptime
     118 *
     119 *  DESCRIPTION::148
     120 *
     121 *
     122 * This function prints the nanosecond uptime to stdout.
     123 */
     124static void
     125rtems_capture_cli_print_timestamp (uint64_t uptime)
     126{
     127  uint32_t hours;
     128  uint32_t minutes;
     129  uint32_t seconds;
     130  uint32_t nanosecs;
     131
     132  seconds  = uptime / 1000000000LLU;
     133  minutes  = seconds / 60;
     134  hours    = minutes / 60;
     135  minutes  = minutes % 60;
     136  seconds  = seconds % 60;
     137  nanosecs = uptime % 1000000000;
     138
     139  fprintf (stdout, "%5lu:%02lu:%02lu.%09lu", hours, minutes, seconds, nanosecs);
     140}
     141static void
     142rtems_caputre_cli_print_record_task(rtems_capture_record_t* rec)
     143{
     144  rtems_capture_task_record_t* task_rec = (rtems_capture_task_record_t*) rec;
     145
     146  rtems_capture_cli_print_timestamp (rec->time);
     147  fprintf (stdout, "           ");
     148  rtems_monitor_dump_id (rec->task_id);
     149   fprintf (stdout, " %c%c%c%c",
     150            (char) (task_rec->name >> 24) & 0xff,
     151            (char) (task_rec->name >> 16) & 0xff,
     152            (char) (task_rec->name >> 8) & 0xff,
     153            (char) (task_rec->name >> 0) & 0xff);
     154   fprintf (stdout, " %3" PRId32   " %3" PRId32 "\n",
     155            task_rec->start_priority,
     156            task_rec->stack_size);
     157}
     158
     159static void
     160rtems_caputure_cli_print_record_std(rtems_capture_record_t* rec, uint64_t diff)
     161{
     162  uint32_t                     event;
     163  int                          e;
     164
     165  event = rec->events >> RTEMS_CAPTURE_EVENT_START;
     166
     167  for (e = RTEMS_CAPTURE_EVENT_START; e < RTEMS_CAPTURE_EVENT_END; e++)
     168  {
     169    if (event & 1)
     170    {
     171      rtems_capture_cli_print_timestamp (rec->time);
     172      fprintf (stdout, " %9" PRId64 " ", diff);
     173      rtems_monitor_dump_id (rec->task_id);
     174      fprintf(stdout, "      %3" PRId32 " %3" PRId32 " %s\n",
     175             (rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff,
     176             (rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff,
     177             rtems_capture_event_text (e));
     178    }
     179    event >>= 1;
     180  }
     181}
     182
    116183static void ctrace()
    117184{
     
    123190  uint32_t                read;
    124191  rtems_capture_record_t* rec;
     192  uint8_t*                ptr;
     193  rtems_capture_time_t    last_t = 0;
    125194
    126195  total = dump_total;
     
    149218
    150219    count = total < read ? total : read;
    151 
     220    ptr = (uint8_t *) rec;
    152221    while (count--)
    153222    {
     223      rec = (rtems_capture_record_t*) ptr;
     224
    154225      if (csv)
    155         fprintf (stdout, "%08" PRIxPTR ",%03" PRIu32
     226        fprintf (stdout, "%08" PRIu32 ",%03" PRIu32
    156227                   ",%03" PRIu32 ",%04" PRIx32 ",%" PRId64 "\n",
    157                  (uintptr_t) rec->task,
     228                 rec->task_id,
    158229                 (rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff,
    159230                 (rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff,
    160231                 (rec->events >> RTEMS_CAPTURE_EVENT_START),
    161232                 (uint64_t) rec->time);
    162       else
    163       {
    164         uint32_t event;
    165         int      e;
    166 
    167         event = rec->events >> RTEMS_CAPTURE_EVENT_START;
    168 
    169         for (e = RTEMS_CAPTURE_EVENT_START; e <= RTEMS_CAPTURE_EVENT_END; e++)
    170         {
    171           if (event & 1)
    172           {
    173             rtems_monitor_dump_id (rtems_capture_task_id (rec->task));
    174             fprintf (stdout, " %c%c%c%c",
    175                      (char) (rec->task->name >> 24) & 0xff,
    176                      (char) (rec->task->name >> 16) & 0xff,
    177                      (char) (rec->task->name >> 8) & 0xff,
    178                      (char) (rec->task->name >> 0) & 0xff);
    179             fprintf (stdout, " %3" PRId32 " %3" PRId32 " %s\n",
    180                     (rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff,
    181                     (rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff,
    182                     rtems_capture_event_text (e));
    183           }
    184           event >>= 1;
     233      else {
     234        if ((rec->events >> RTEMS_CAPTURE_EVENT_START) == 0)
     235          rtems_caputre_cli_print_record_task( rec );
     236        else {
     237          uint64_t diff = 0;
     238          if (last_t)
     239            diff = rec->time - last_t;
     240          last_t = rec->time;
     241
     242          rtems_caputure_cli_print_record_std( rec, diff );
    185243        }
    186244      }
    187       rec++;
     245      ptr += rec->size;
    188246    }
    189247
Note: See TracChangeset for help on using the changeset viewer.