LCOV - code coverage report
Current view: top level - spdk/app/trace - trace.cpp (source / functions) Hit Total Coverage
Test: Combined Lines: 103 254 40.6 %
Date: 2024-07-12 17:08:57 Functions: 11 18 61.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 64 264 24.2 %

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2016 Intel Corporation.
       3                 :            :  *   All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include "spdk/stdinc.h"
       7                 :            : #include "spdk/env.h"
       8                 :            : #include "spdk/json.h"
       9                 :            : #include "spdk/likely.h"
      10                 :            : #include "spdk/string.h"
      11                 :            : #include "spdk/util.h"
      12                 :            : 
      13                 :            : #include <map>
      14                 :            : 
      15                 :            : extern "C" {
      16                 :            : #include "spdk/trace_parser.h"
      17                 :            : #include "spdk/util.h"
      18                 :            : }
      19                 :            : 
      20                 :            : static struct spdk_trace_parser *g_parser;
      21                 :            : static const struct spdk_trace_flags *g_flags;
      22                 :            : static struct spdk_json_write_ctx *g_json;
      23                 :            : static bool g_print_tsc = false;
      24                 :            : 
      25                 :            : /* This is a bit ugly, but we don't want to include env_dpdk in the app, while spdk_util, which we
      26                 :            :  * do need, uses some of the functions implemented there.  We're not actually using the functions
      27                 :            :  * that depend on those, so just define them as no-ops to allow the app to link.
      28                 :            :  */
      29                 :            : extern "C" {
      30                 :            :         void *
      31                 :          0 :         spdk_realloc(void *buf, size_t size, size_t align)
      32                 :            :         {
      33                 :          0 :                 assert(false);
      34                 :            : 
      35                 :            :                 return NULL;
      36                 :            :         }
      37                 :            : 
      38                 :            :         void
      39                 :          0 :         spdk_free(void *buf)
      40                 :            :         {
      41                 :          0 :                 assert(false);
      42                 :            :         }
      43                 :            : 
      44                 :            :         uint64_t
      45                 :          0 :         spdk_get_ticks(void)
      46                 :            :         {
      47                 :          0 :                 return 0;
      48                 :            :         }
      49                 :            : } /* extern "C" */
      50                 :            : 
      51                 :            : static void usage(void);
      52                 :            : 
      53                 :            : static char *g_exe_name;
      54                 :            : 
      55                 :            : static float
      56                 :    1499700 : get_us_from_tsc(uint64_t tsc, uint64_t tsc_rate)
      57                 :            : {
      58                 :    1499700 :         return ((float)tsc) * 1000 * 1000 / tsc_rate;
      59                 :            : }
      60                 :            : 
      61                 :            : static const char *
      62                 :    1192350 : format_argname(const char *name)
      63                 :            : {
      64                 :            :         static char namebuf[16];
      65                 :            : 
      66         [ -  + ]:    1192350 :         snprintf(namebuf, sizeof(namebuf), "%s: ", name);
      67                 :    1192350 :         return namebuf;
      68                 :            : }
      69                 :            : 
      70                 :            : static void
      71                 :     230360 : print_ptr(const char *arg_string, uint64_t arg)
      72                 :            : {
      73         [ -  + ]:     230360 :         printf("%-7.7s0x%-14jx ", format_argname(arg_string), arg);
      74                 :     230360 : }
      75                 :            : 
      76                 :            : static void
      77                 :     383252 : print_uint64(const char *arg_string, uint64_t arg)
      78                 :            : {
      79                 :            :         /*
      80                 :            :          * Print arg as signed, since -1 is a common value especially
      81                 :            :          *  for FLUSH WRITEBUF when writev() returns -1 due to full
      82                 :            :          *  socket buffer.
      83                 :            :          */
      84         [ -  + ]:     383252 :         printf("%-7.7s%-16jd ", format_argname(arg_string), arg);
      85                 :     383252 : }
      86                 :            : 
      87                 :            : static void
      88                 :      75690 : print_string(const char *arg_string, const char *arg)
      89                 :            : {
      90         [ -  + ]:      75690 :         printf("%-7.7s%-16.16s ", format_argname(arg_string), arg);
      91                 :      75690 : }
      92                 :            : 
      93                 :            : static void
      94                 :     996652 : print_size(uint32_t size)
      95                 :            : {
      96         [ +  + ]:     996652 :         if (size > 0) {
      97         [ -  + ]:     546100 :                 printf("size: %6u ", size);
      98                 :            :         } else {
      99         [ -  + ]:     450552 :                 printf("%13s", " ");
     100                 :            :         }
     101                 :     996652 : }
     102                 :            : 
     103                 :            : static void
     104                 :     810200 : print_object_id(const struct spdk_trace_tpoint *d, struct spdk_trace_parser_entry *entry)
     105                 :            : {
     106                 :            :         /* Set size to 128 and 256 bytes to make sure we can fit all the characters we need */
     107                 :     810200 :         char related_id[128] = {'\0'};
     108                 :     810200 :         char ids[256] = {'\0'};
     109                 :            : 
     110         [ -  + ]:     810200 :         if (entry->related_type != OBJECT_NONE) {
     111                 :          0 :                 snprintf(related_id, sizeof(related_id), " (%c%jd)",
     112         [ #  # ]:          0 :                          g_flags->object[entry->related_type].id_prefix,
     113                 :            :                          entry->related_index);
     114                 :            :         }
     115                 :            : 
     116         [ -  + ]:     810200 :         snprintf(ids, sizeof(ids), "%c%jd%s", g_flags->object[d->object_type].id_prefix,
     117                 :            :                  entry->object_index, related_id);
     118   [ -  +  +  - ]:     810200 :         printf("id:    %-17s", ids);
     119                 :     810200 : }
     120                 :            : 
     121                 :            : static void
     122                 :     503048 : print_float(const char *arg_string, float arg)
     123                 :            : {
     124         [ -  + ]:     503048 :         printf("%-7s%-16.3f ", format_argname(arg_string), arg);
     125                 :     503048 : }
     126                 :            : 
     127                 :            : static void
     128                 :     996652 : print_event(struct spdk_trace_parser_entry *entry, uint64_t tsc_rate, uint64_t tsc_offset)
     129                 :            : {
     130                 :     996652 :         struct spdk_trace_entry         *e = entry->entry;
     131                 :            :         const struct spdk_trace_tpoint  *d;
     132                 :            :         float                           us;
     133                 :            :         size_t                          i;
     134                 :            : 
     135                 :     996652 :         d = &g_flags->tpoint[e->tpoint_id];
     136                 :     996652 :         us = get_us_from_tsc(e->tsc - tsc_offset, tsc_rate);
     137                 :            : 
     138         [ -  + ]:     996652 :         printf("%2d: %10.3f ", entry->lcore, us);
     139   [ -  +  -  + ]:     996652 :         if (g_print_tsc) {
     140         [ #  # ]:          0 :                 printf("(%9ju) ", e->tsc - tsc_offset);
     141                 :            :         }
     142         [ +  + ]:     996652 :         if (g_flags->owner[d->owner_type].id_prefix) {
     143         [ -  + ]:     994578 :                 printf("%c%02d ", g_flags->owner[d->owner_type].id_prefix, e->poller_id);
     144                 :            :         } else {
     145         [ -  + ]:       2074 :                 printf("%4s", " ");
     146                 :            :         }
     147                 :            : 
     148         [ -  + ]:     996652 :         printf("%-*s ", (int)sizeof(d->name), d->name);
     149                 :     996652 :         print_size(e->size);
     150                 :            : 
     151         [ +  + ]:     996652 :         if (d->new_object) {
     152                 :     307152 :                 print_object_id(d, entry);
     153         [ +  + ]:     689500 :         } else if (d->object_type != OBJECT_NONE) {
     154         [ +  - ]:     503048 :                 if (entry->object_index != UINT64_MAX) {
     155                 :     503048 :                         us = get_us_from_tsc(e->tsc - entry->object_start, tsc_rate);
     156                 :     503048 :                         print_object_id(d, entry);
     157                 :     503048 :                         print_float("time", us);
     158                 :            :                 } else {
     159         [ #  # ]:          0 :                         printf("id:    %-17s", "N/A");
     160                 :            :                 }
     161         [ +  + ]:     186452 :         } else if (e->object_id != 0) {
     162                 :       2074 :                 print_ptr("object", e->object_id);
     163                 :            :         }
     164                 :            : 
     165         [ +  + ]:    1683880 :         for (i = 0; i < d->num_args; ++i) {
     166   [ +  +  +  - ]:     687228 :                 switch (d->args[i].type) {
     167                 :     228286 :                 case SPDK_TRACE_ARG_TYPE_PTR:
     168                 :     228286 :                         print_ptr(d->args[i].name, (uint64_t)entry->args[i].pointer);
     169                 :     228286 :                         break;
     170                 :     383252 :                 case SPDK_TRACE_ARG_TYPE_INT:
     171                 :     383252 :                         print_uint64(d->args[i].name, entry->args[i].integer);
     172                 :     383252 :                         break;
     173                 :      75690 :                 case SPDK_TRACE_ARG_TYPE_STR:
     174                 :      75690 :                         print_string(d->args[i].name, entry->args[i].string);
     175                 :      75690 :                         break;
     176                 :            :                 }
     177                 :            :         }
     178                 :     996652 :         printf("\n");
     179                 :     996652 : }
     180                 :            : 
     181                 :            : static void
     182                 :          0 : print_event_json(struct spdk_trace_parser_entry *entry, uint64_t tsc_rate, uint64_t tsc_offset)
     183                 :            : {
     184                 :          0 :         struct spdk_trace_entry *e = entry->entry;
     185                 :            :         const struct spdk_trace_tpoint *d;
     186                 :            :         size_t i;
     187                 :            : 
     188                 :          0 :         d = &g_flags->tpoint[e->tpoint_id];
     189                 :            : 
     190                 :          0 :         spdk_json_write_object_begin(g_json);
     191                 :          0 :         spdk_json_write_named_uint64(g_json, "lcore", entry->lcore);
     192                 :          0 :         spdk_json_write_named_uint64(g_json, "tpoint", e->tpoint_id);
     193                 :          0 :         spdk_json_write_named_uint64(g_json, "tsc", e->tsc);
     194                 :            : 
     195         [ #  # ]:          0 :         if (g_flags->owner[d->owner_type].id_prefix) {
     196                 :          0 :                 spdk_json_write_named_string_fmt(g_json, "poller", "%c%02d",
     197                 :          0 :                                                  g_flags->owner[d->owner_type].id_prefix,
     198                 :          0 :                                                  e->poller_id);
     199                 :            :         }
     200         [ #  # ]:          0 :         if (e->size != 0) {
     201                 :          0 :                 spdk_json_write_named_uint32(g_json, "size", e->size);
     202                 :            :         }
     203   [ #  #  #  #  :          0 :         if (d->new_object || d->object_type != OBJECT_NONE || e->object_id != 0) {
                   #  # ]
     204                 :            :                 char object_type;
     205                 :            : 
     206                 :          0 :                 spdk_json_write_named_object_begin(g_json, "object");
     207         [ #  # ]:          0 :                 if (d->new_object) {
     208                 :          0 :                         object_type =  g_flags->object[d->object_type].id_prefix;
     209                 :          0 :                         spdk_json_write_named_string_fmt(g_json, "id", "%c%" PRIu64, object_type,
     210                 :            :                                                          entry->object_index);
     211         [ #  # ]:          0 :                 } else if (d->object_type != OBJECT_NONE) {
     212                 :          0 :                         object_type =  g_flags->object[d->object_type].id_prefix;
     213         [ #  # ]:          0 :                         if (entry->object_index != UINT64_MAX) {
     214                 :          0 :                                 spdk_json_write_named_string_fmt(g_json, "id", "%c%" PRIu64,
     215                 :            :                                                                  object_type,
     216                 :            :                                                                  entry->object_index);
     217                 :          0 :                                 spdk_json_write_named_uint64(g_json, "time",
     218                 :          0 :                                                              e->tsc - entry->object_start);
     219                 :            :                         }
     220                 :            :                 }
     221                 :          0 :                 spdk_json_write_named_uint64(g_json, "value", e->object_id);
     222                 :          0 :                 spdk_json_write_object_end(g_json);
     223                 :            :         }
     224                 :            : 
     225                 :            :         /* Print related objects array */
     226         [ #  # ]:          0 :         if (entry->related_index != UINT64_MAX) {
     227                 :          0 :                 spdk_json_write_named_string_fmt(g_json, "related", "%c%" PRIu64,
     228                 :          0 :                                                  g_flags->object[entry->related_type].id_prefix,
     229                 :            :                                                  entry->related_index);
     230                 :            :         }
     231                 :            : 
     232         [ #  # ]:          0 :         if (d->num_args > 0) {
     233                 :          0 :                 spdk_json_write_named_array_begin(g_json, "args");
     234         [ #  # ]:          0 :                 for (i = 0; i < d->num_args; ++i) {
     235   [ #  #  #  # ]:          0 :                         switch (d->args[i].type) {
     236                 :          0 :                         case SPDK_TRACE_ARG_TYPE_PTR:
     237                 :          0 :                                 spdk_json_write_uint64(g_json, (uint64_t)entry->args[i].pointer);
     238                 :          0 :                                 break;
     239                 :          0 :                         case SPDK_TRACE_ARG_TYPE_INT:
     240                 :          0 :                                 spdk_json_write_uint64(g_json, entry->args[i].integer);
     241                 :          0 :                                 break;
     242                 :          0 :                         case SPDK_TRACE_ARG_TYPE_STR:
     243                 :          0 :                                 spdk_json_write_string(g_json, entry->args[i].string);
     244                 :          0 :                                 break;
     245                 :            :                         }
     246                 :            :                 }
     247                 :          0 :                 spdk_json_write_array_end(g_json);
     248                 :            :         }
     249                 :            : 
     250                 :          0 :         spdk_json_write_object_end(g_json);
     251                 :          0 : }
     252                 :            : 
     253                 :            : static void
     254                 :     996652 : process_event(struct spdk_trace_parser_entry *e, uint64_t tsc_rate, uint64_t tsc_offset)
     255                 :            : {
     256         [ +  - ]:     996652 :         if (g_json == NULL) {
     257                 :     996652 :                 print_event(e, tsc_rate, tsc_offset);
     258                 :            :         } else {
     259                 :          0 :                 print_event_json(e, tsc_rate, tsc_offset);
     260                 :            :         }
     261                 :     996652 : }
     262                 :            : 
     263                 :            : static void
     264                 :          0 : print_tpoint_definitions(void)
     265                 :            : {
     266                 :            :         const struct spdk_trace_tpoint *tpoint;
     267                 :            :         size_t i, j;
     268                 :            : 
     269                 :            :         /* We only care about these when printing JSON */
     270         [ #  # ]:          0 :         if (!g_json) {
     271                 :          0 :                 return;
     272                 :            :         }
     273                 :            : 
     274                 :          0 :         spdk_json_write_named_uint64(g_json, "tsc_rate", g_flags->tsc_rate);
     275                 :          0 :         spdk_json_write_named_array_begin(g_json, "tpoints");
     276                 :            : 
     277         [ #  # ]:          0 :         for (i = 0; i < SPDK_COUNTOF(g_flags->tpoint); ++i) {
     278                 :          0 :                 tpoint = &g_flags->tpoint[i];
     279         [ #  # ]:          0 :                 if (tpoint->tpoint_id == 0) {
     280                 :          0 :                         continue;
     281                 :            :                 }
     282                 :            : 
     283                 :          0 :                 spdk_json_write_object_begin(g_json);
     284                 :          0 :                 spdk_json_write_named_string(g_json, "name", tpoint->name);
     285                 :          0 :                 spdk_json_write_named_uint32(g_json, "id", tpoint->tpoint_id);
     286                 :          0 :                 spdk_json_write_named_bool(g_json, "new_object", tpoint->new_object);
     287                 :            : 
     288                 :          0 :                 spdk_json_write_named_array_begin(g_json, "args");
     289         [ #  # ]:          0 :                 for (j = 0; j < tpoint->num_args; ++j) {
     290                 :          0 :                         spdk_json_write_object_begin(g_json);
     291                 :          0 :                         spdk_json_write_named_string(g_json, "name", tpoint->args[j].name);
     292                 :          0 :                         spdk_json_write_named_uint32(g_json, "type", tpoint->args[j].type);
     293                 :          0 :                         spdk_json_write_named_uint32(g_json, "size", tpoint->args[j].size);
     294                 :          0 :                         spdk_json_write_object_end(g_json);
     295                 :            :                 }
     296                 :          0 :                 spdk_json_write_array_end(g_json);
     297                 :          0 :                 spdk_json_write_object_end(g_json);
     298                 :            :         }
     299                 :            : 
     300                 :          0 :         spdk_json_write_array_end(g_json);
     301                 :            : }
     302                 :            : 
     303                 :            : static int
     304                 :          0 : print_json(void *cb_ctx, const void *data, size_t size)
     305                 :            : {
     306                 :            :         ssize_t rc;
     307                 :            : 
     308         [ #  # ]:          0 :         while (size > 0) {
     309                 :          0 :                 rc = write(STDOUT_FILENO, data, size);
     310         [ #  # ]:          0 :                 if (rc < 0) {
     311         [ #  # ]:          0 :                         fprintf(stderr, "%s: %s\n", g_exe_name, spdk_strerror(errno));
     312                 :          0 :                         abort();
     313                 :            :                 }
     314                 :            : 
     315                 :          0 :                 size -= rc;
     316                 :            :         }
     317                 :            : 
     318                 :          0 :         return 0;
     319                 :            : }
     320                 :            : 
     321                 :            : static void
     322                 :          0 : usage(void)
     323                 :            : {
     324   [ #  #  #  # ]:          0 :         fprintf(stderr, "usage:\n");
     325   [ #  #  #  # ]:          0 :         fprintf(stderr, "   %s <option> <lcore#>\n", g_exe_name);
     326   [ #  #  #  # ]:          0 :         fprintf(stderr, "                 '-c' to display single lcore history\n");
     327   [ #  #  #  # ]:          0 :         fprintf(stderr, "                 '-t' to display TSC offset for each event\n");
     328   [ #  #  #  # ]:          0 :         fprintf(stderr, "                 '-s' to specify spdk_trace shm name for a\n");
     329   [ #  #  #  # ]:          0 :         fprintf(stderr, "                      currently running process\n");
     330   [ #  #  #  # ]:          0 :         fprintf(stderr, "                 '-i' to specify the shared memory ID\n");
     331   [ #  #  #  # ]:          0 :         fprintf(stderr, "                 '-p' to specify the trace PID\n");
     332   [ #  #  #  # ]:          0 :         fprintf(stderr, "                      (If -s is specified, then one of\n");
     333   [ #  #  #  # ]:          0 :         fprintf(stderr, "                       -i or -p must be specified)\n");
     334   [ #  #  #  # ]:          0 :         fprintf(stderr, "                 '-f' to specify a tracepoint file name\n");
     335   [ #  #  #  # ]:          0 :         fprintf(stderr, "                      (-s and -f are mutually exclusive)\n");
     336   [ #  #  #  # ]:          0 :         fprintf(stderr, "                 '-j' to use JSON to format the output\n");
     337                 :          0 : }
     338                 :            : 
     339                 :            : int
     340                 :          2 : main(int argc, char **argv)
     341                 :            : {
     342                 :          0 :         struct spdk_trace_parser_opts   opts;
     343                 :          0 :         struct spdk_trace_parser_entry  entry;
     344                 :          2 :         int                             lcore = SPDK_TRACE_MAX_LCORE;
     345                 :            :         uint64_t                        tsc_offset, entry_count;
     346                 :          2 :         const char                      *app_name = NULL;
     347                 :          2 :         const char                      *file_name = NULL;
     348                 :            :         int                             op, i;
     349                 :          0 :         char                            shm_name[64];
     350                 :          2 :         int                             shm_id = -1, shm_pid = -1;
     351                 :          2 :         bool                            json = false;
     352                 :            : 
     353                 :          2 :         g_exe_name = argv[0];
     354   [ -  +  +  + ]:          4 :         while ((op = getopt(argc, argv, "c:f:i:jp:s:t")) != -1) {
     355   [ -  -  -  -  :          2 :                 switch (op) {
             +  -  -  - ]
     356                 :          0 :                 case 'c':
     357         [ #  # ]:          0 :                         lcore = atoi(optarg);
     358         [ #  # ]:          0 :                         if (lcore > SPDK_TRACE_MAX_LCORE) {
     359   [ #  #  #  # ]:          0 :                                 fprintf(stderr, "Selected lcore: %d "
     360                 :            :                                         "exceeds maximum %d\n", lcore,
     361                 :            :                                         SPDK_TRACE_MAX_LCORE);
     362                 :          0 :                                 exit(1);
     363                 :            :                         }
     364                 :          0 :                         break;
     365                 :          0 :                 case 'i':
     366         [ #  # ]:          0 :                         shm_id = atoi(optarg);
     367                 :          0 :                         break;
     368                 :          0 :                 case 'p':
     369         [ #  # ]:          0 :                         shm_pid = atoi(optarg);
     370                 :          0 :                         break;
     371                 :          0 :                 case 's':
     372                 :          0 :                         app_name = optarg;
     373                 :          0 :                         break;
     374                 :          2 :                 case 'f':
     375                 :          2 :                         file_name = optarg;
     376                 :          2 :                         break;
     377                 :          0 :                 case 't':
     378                 :          0 :                         g_print_tsc = true;
     379                 :          0 :                         break;
     380                 :          0 :                 case 'j':
     381                 :          0 :                         json = true;
     382                 :          0 :                         break;
     383                 :          0 :                 default:
     384         [ #  # ]:          0 :                         usage();
     385                 :          0 :                         exit(1);
     386                 :            :                 }
     387                 :            :         }
     388                 :            : 
     389   [ +  -  -  + ]:          2 :         if (file_name != NULL && app_name != NULL) {
     390   [ #  #  #  # ]:          0 :                 fprintf(stderr, "-f and -s are mutually exclusive\n");
     391         [ #  # ]:          0 :                 usage();
     392                 :          0 :                 exit(1);
     393                 :            :         }
     394                 :            : 
     395   [ -  +  -  - ]:          2 :         if (file_name == NULL && app_name == NULL) {
     396   [ #  #  #  # ]:          0 :                 fprintf(stderr, "One of -f and -s must be specified\n");
     397         [ #  # ]:          0 :                 usage();
     398                 :          0 :                 exit(1);
     399                 :            :         }
     400                 :            : 
     401         [ -  + ]:          2 :         if (json) {
     402         [ #  # ]:          0 :                 g_json = spdk_json_write_begin(print_json, NULL, 0);
     403         [ #  # ]:          0 :                 if (g_json == NULL) {
     404   [ #  #  #  # ]:          0 :                         fprintf(stderr, "Failed to allocate JSON write context\n");
     405                 :          0 :                         exit(1);
     406                 :            :                 }
     407                 :            :         }
     408                 :            : 
     409         [ -  + ]:          2 :         if (!file_name) {
     410         [ #  # ]:          0 :                 if (shm_id >= 0) {
     411                 :          0 :                         snprintf(shm_name, sizeof(shm_name), "/%s_trace.%d", app_name, shm_id);
     412                 :            :                 } else {
     413                 :          0 :                         snprintf(shm_name, sizeof(shm_name), "/%s_trace.pid%d", app_name, shm_pid);
     414                 :            :                 }
     415                 :          0 :                 file_name = shm_name;
     416                 :            :         }
     417                 :            : 
     418                 :          2 :         opts.filename = file_name;
     419                 :          2 :         opts.lcore = lcore;
     420                 :          2 :         opts.mode = app_name == NULL ? SPDK_TRACE_PARSER_MODE_FILE : SPDK_TRACE_PARSER_MODE_SHM;
     421         [ +  - ]:          2 :         g_parser = spdk_trace_parser_init(&opts);
     422         [ -  + ]:          2 :         if (g_parser == NULL) {
     423   [ #  #  #  # ]:          0 :                 fprintf(stderr, "Failed to initialize trace parser\n");
     424                 :          0 :                 exit(1);
     425                 :            :         }
     426                 :            : 
     427         [ +  - ]:          2 :         g_flags = spdk_trace_parser_get_flags(g_parser);
     428         [ +  - ]:          2 :         if (!g_json) {
     429         [ +  - ]:          2 :                 printf("TSC Rate: %ju\n", g_flags->tsc_rate);
     430                 :            :         } else {
     431         [ #  # ]:          0 :                 spdk_json_write_object_begin(g_json);
     432         [ #  # ]:          0 :                 print_tpoint_definitions();
     433         [ #  # ]:          0 :                 spdk_json_write_named_array_begin(g_json, "entries");
     434                 :            :         }
     435                 :            : 
     436         [ +  + ]:        258 :         for (i = 0; i < SPDK_TRACE_MAX_LCORE; ++i) {
     437   [ -  +  -  - ]:        256 :                 if (lcore == SPDK_TRACE_MAX_LCORE || i == lcore) {
     438         [ +  - ]:        256 :                         entry_count = spdk_trace_parser_get_entry_count(g_parser, i);
     439         [ +  + ]:        256 :                         if (entry_count > 0) {
     440         [ +  - ]:          8 :                                 printf("Trace Size of lcore (%d): %ju\n", i, entry_count);
     441                 :            :                         }
     442                 :            :                 }
     443                 :            :         }
     444                 :            : 
     445         [ +  - ]:          2 :         tsc_offset = spdk_trace_parser_get_tsc_offset(g_parser);
     446   [ +  -  +  + ]:     996660 :         while (spdk_trace_parser_next_entry(g_parser, &entry)) {
     447         [ +  + ]:     996658 :                 if (entry.entry->tsc < tsc_offset) {
     448                 :          6 :                         continue;
     449                 :            :                 }
     450         [ +  - ]:     996652 :                 process_event(&entry, g_flags->tsc_rate, tsc_offset);
     451                 :            :         }
     452                 :            : 
     453         [ -  + ]:          2 :         if (g_json != NULL) {
     454         [ #  # ]:          0 :                 spdk_json_write_array_end(g_json);
     455         [ #  # ]:          0 :                 spdk_json_write_object_end(g_json);
     456         [ #  # ]:          0 :                 spdk_json_write_end(g_json);
     457                 :            :         }
     458                 :            : 
     459         [ +  - ]:          2 :         spdk_trace_parser_cleanup(g_parser);
     460                 :            : 
     461                 :          2 :         return (0);
     462                 :            : }

Generated by: LCOV version 1.14