summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/display_irq.c
blob: 5cf347d77237830aa5144bc4ac7167e779bb97ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #c
/*
// Copyright (c) 2010-2018 Intel Corporation
//
// 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.
*/

#include "display_irq.h"
#include "stats_irq.h"
#include "display.h"
#include "lconf.h"

static struct display_page display_page_irq;
static struct display_column *stats_irq[IRQ_BUCKETS_COUNT];
static struct display_column *stats_max;
static struct display_column *core_col;
static struct display_column *name_col;

static void display_irq_draw_frame(struct screen_state *state)
{
  	uint32_t n_tasks = stats_get_n_irq_tasks();
	struct lcore_cfg *lconf = NULL;
	struct task_args *targ;
	char name[32];
	char *ptr;

	display_page_init(&display_page_irq);

	struct display_table *core_name = display_page_add_table(&display_page_irq);

	display_table_init(core_name, "Core/task");
	core_col = display_table_add_col(core_name);
	name_col = display_table_add_col(core_name);
	display_column_init(core_col, "Nb", 4);
	display_column_init(name_col, "Name", 5);

	struct display_table *stats = display_page_add_table(&display_page_irq);
	if (state->toggle == 0) {
		display_table_init(stats, "Statistics per second");

		char title[64];
		stats_max = display_table_add_col(stats);
		snprintf(title, sizeof(title), " MAXIMUM(mic)");
		display_column_init(stats_max, title, 11);

		stats_irq[0] = display_table_add_col(stats);
		if (irq_bucket_maxtime_micro[0] < 1000)
			snprintf(title, sizeof(title), " %d-%ld mic", 0, irq_bucket_maxtime_micro[0]);
		else
			snprintf(title, sizeof(title), " %d-%ld ms", 0, irq_bucket_maxtime_micro[0] / 1000);
		display_column_init(stats_irq[0], title, 9);
		for (uint i = 1; i < IRQ_BUCKETS_COUNT - 1; ++i) {
			stats_irq[i] = display_table_add_col(stats);
			if (irq_bucket_maxtime_micro[i-1] < 1000)
				snprintf(title, sizeof(title), " %ld-%ld mic", irq_bucket_maxtime_micro[i-1], irq_bucket_maxtime_micro[i]);
			else
				snprintf(title, sizeof(title), " %ld-%ld ms", irq_bucket_maxtime_micro[i-1] / 1000, irq_bucket_maxtime_micro[i] / 1000);
			display_column_init(stats_irq[i], title, 9);
		}
		stats_irq[IRQ_BUCKETS_COUNT - 1] = display_table_add_col(stats);
		if (irq_bucket_maxtime_micro[IRQ_BUCKETS_COUNT - 2] < 1000)
			snprintf(title, sizeof(title), "  > %ld mic ", irq_bucket_maxtime_micro[IRQ_BUCKETS_COUNT - 2]);
		else
			snprintf(title, sizeof(title), " > %ld ms   ", irq_bucket_maxtime_micro[IRQ_BUCKETS_COUNT - 2] / 1000);
		display_column_init(stats_irq[IRQ_BUCKETS_COUNT - 1], title, 9);
	} else {
		display_table_init(stats, "Total statistics");

		char title[64];
		stats_max = display_table_add_col(stats);
		snprintf(title, sizeof(title), " MAXIMUM(mic)");
		display_column_init(stats_max, title, 9);

		stats_irq[0] = display_table_add_col(stats);
		if (irq_bucket_maxtime_micro[0] < 1000)
			snprintf(title, sizeof(title), " %d-%ld   ", 0, irq_bucket_maxtime_micro[0]);
		else
			snprintf(title, sizeof(title), " %d-%ld ms", 0, irq_bucket_maxtime_micro[0] / 1000);
		display_column_init(stats_irq[0], title, 9);
		for (uint i = 1; i < IRQ_BUCKETS_COUNT - 1; ++i) {
			stats_irq[i] = display_table_add_col(stats);
			if (irq_bucket_maxtime_micro[i-1] < 1000)
				snprintf(title, sizeof(title), " %ld-%ld  ", irq_bucket_maxtime_micro[i-1], irq_bucket_maxtime_micro[i]);
			else
				snprintf(title, sizeof(title), " %ld-%ld ms", irq_bucket_maxtime_micro[i-1] / 1000, irq_bucket_maxtime_micro[i] / 1000);
			display_column_init(stats_irq[i], title, 9);
		}
		stats_irq[IRQ_BUCKETS_COUNT - 1] = display_table_add_col(stats);
		if (irq_bucket_maxtime_micro[IRQ_BUCKETS_COUNT - 2] < 1000)
			snprintf(title, sizeof(title), " > %ld ", irq_bucket_maxtime_micro[IRQ_BUCKETS_COUNT - 2]);
		else
			snprintf(title, sizeof(title), " > %ld  ", irq_bucket_maxtime_micro[IRQ_BUCKETS_COUNT - 2] / 1000);
		display_column_init(stats_irq[IRQ_BUCKETS_COUNT - 1], title, 9);
	}

	display_page_draw_frame(&display_page_irq, n_tasks);

	uint32_t count = 0;
	lconf = NULL;
	while (core_targ_next(&lconf, &targ, 0) == 0) {
		if (strcmp(targ->task_init->mode_str, "irq") == 0) {
			display_column_print_core_task(core_col, count, lconf, targ);
			if (targ->id == 0)
				display_column_print(name_col, count, "%s", lconf->name);
			count++;
		}
	}
}

static void display_irq_draw_stats(struct screen_state *state)
{
	struct lcore_cfg *lconf = NULL;
	struct task_args *targ;
	const uint32_t n_stats_irq = stats_get_n_irq_tasks();

	if (state->toggle == 0) {
		for (uint32_t count = 0; count < n_stats_irq; ++count) {
			struct irq_sample *last = get_irq_sample(count, 1);
			struct irq_sample *prev = get_irq_sample(count, 0);

			display_column_print(stats_max, count, "%9lu", (last->max_irq * 1000000L) / rte_get_tsc_hz());
			for (uint i = 0; i < IRQ_BUCKETS_COUNT; ++i) {
				display_column_print(stats_irq[i], count, "%9lu", last->irq[i] - prev->irq[i]);
			}
		}
	} else {
		for (uint32_t count = 0; count < n_stats_irq; ++count) {
			display_column_print(stats_max, count, "%9lu", get_max_irq_stats(count));
			for (uint i = 0; i < IRQ_BUCKETS_COUNT; ++i) {
				display_column_print(stats_irq[i], count, "%9lu", get_irq_stats(count, i));
			}
		}
	}
}

static int display_irq_get_height(void)
{
	return stats_get_n_irq_tasks();
}

static struct display_screen display_screen_irq = {
	.draw_frame = display_irq_draw_frame,
	.draw_stats = display_irq_draw_stats,
	.get_height = display_irq_get_height,
	.title = "irq",
};

struct display_screen *display_irq(void)
{
	return &display_screen_irq;
}