summaryrefslogtreecommitdiffstats
path: root/src/svm/fifo_segment.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-06-09 09:24:33 -0700
committerFlorin Coras <fcoras@cisco.com>2019-06-09 09:25:24 -0700
commit5368bb016f5a0d8888456140ba2bf49371e6985c (patch)
tree19dd239a8c387f4d60271d0bb87045ac82c7dd0d /src/svm/fifo_segment.c
parent7681b1c469eda79003eef550fda460f48e5a08d7 (diff)
svm: improve fifo segment show
Type: refactor Change-Id: I6933205cfb04bc31cabe6e3b1a8044cace93f84c Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/svm/fifo_segment.c')
-rw-r--r--src/svm/fifo_segment.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index 04b3f5aadbe..6d62d37933b 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -824,21 +824,45 @@ format_fifo_segment_type (u8 * s, va_list * args)
u8 *
format_fifo_segment (u8 * s, va_list * args)
{
- fifo_segment_t *sp = va_arg (*args, fifo_segment_t *);
+ fifo_segment_t *fs = va_arg (*args, fifo_segment_t *);
int verbose __attribute__ ((unused)) = va_arg (*args, int);
- fifo_segment_header_t *fsh = sp->h;
- u32 count, indent;
+ fifo_segment_header_t *fsh;
svm_fifo_chunk_t *c;
+ u32 count, indent;
+ u32 active_fifos;
+ u32 free_fifos;
+ char *address;
+ size_t size;
int i;
indent = format_get_indent (s) + 2;
#if USE_DLMALLOC == 0
s = format (s, "%U segment heap: %U\n", format_white_space, indent,
- format_mheap, svm_fifo_segment_heap (sp), verbose);
+ format_mheap, svm_fifo_segment_heap (fs), verbose);
s = format (s, "%U segment has %u active fifos\n",
- format_white_space, indent, fifo_segment_num_fifos (sp));
+ format_white_space, indent, fifo_segment_num_fifos (fs));
#endif
+ if (fs == 0)
+ {
+ s = format (s, "%-15s%15s%15s%15s%15s%15s", "Name", "Type",
+ "HeapSize (M)", "ActiveFifos", "FreeFifos", "Address");
+ return s;
+ }
+
+ fsh = fs->h;
+ fifo_segment_info (fs, &address, &size);
+ active_fifos = fifo_segment_num_fifos (fs);
+ free_fifos = fifo_segment_num_free_fifos (fs);
+
+ s = format (s, "%-15v%15U%15llu%15u%15u%15llx", ssvm_name (&fs->ssvm),
+ format_fifo_segment_type, fs, size >> 20ULL, active_fifos,
+ free_fifos, address);
+
+ if (!verbose)
+ return s;
+
+ s = format (s, "\n");
for (i = 0; i < vec_len (fsh->free_chunks); i++)
{
c = fsh->free_chunks[i];
@@ -851,11 +875,13 @@ format_fifo_segment (u8 * s, va_list * args)
count++;
}
- s = format (s, "%U%-5u Kb: %u free",
- format_white_space, indent + 2,
+ s = format (s, "%U%-5u Kb: %u free", format_white_space, indent + 2,
1 << (i + max_log2 (FIFO_SEGMENT_MIN_FIFO_SIZE) - 10),
count);
}
+ s = format (s, "%Ufree bytes %U", format_white_space, indent + 2,
+ format_memory_size, fsh->n_free_bytes);
+
return s;
}
} /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2017 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __included_tw_timer_1t_3w_1024sl_ov_h__
#define __included_tw_timer_1t_3w_1024sl_ov_h__

/* ... So that a client app can create multiple wheel geometries */
#undef TW_TIMER_WHEELS
#undef TW_SLOTS_PER_RING
#undef TW_RING_SHIFT
#undef TW_RING_MASK
#undef TW_TIMERS_PER_OBJECT
#undef LOG2_TW_TIMERS_PER_OBJECT
#undef TW_SUFFIX
#undef TW_OVERFLOW_VECTOR
#undef TW_FAST_WHEEL_BITMAP
#undef TW_TIMER_ALLOW_DUPLICATE_STOP
#undef TW_START_STOP_TRACE_SIZE

#define TW_TIMER_WHEELS 3
#define TW_SLOTS_PER_RING 1024
#define TW_RING_SHIFT 10
#define TW_RING_MASK (TW_SLOTS_PER_RING -1)
#define TW_TIMERS_PER_OBJECT 1
#define LOG2_TW_TIMERS_PER_OBJECT 0
#define TW_SUFFIX _1t_3w_1024sl_ov
#define TW_OVERFLOW_VECTOR 1
#define TW_FAST_WHEEL_BITMAP 1
#define TW_TIMER_ALLOW_DUPLICATE_STOP 1

#include <vppinfra/tw_timer_template.h>

#endif /* __included_tw_timer_1t_3w_1024sl_ov_h__ */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */