From 7286b2518ec8e4398b512ce95def9166a7af2e4a Mon Sep 17 00:00:00 2001 From: Deepak S Date: Thu, 13 Jul 2017 21:26:50 -0700 Subject: Adding PROX(Packet pROcessing eXecution engine) VNF to sampleVNF JIRA: SAMPLEVNF-55 PROX is a DPDK-based application implementing Telco use-cases such as a simplified BRAS/BNG, light-weight AFTR... It also allows configuring finer grained network functions like QoS, Routing, load-balancing... (We are moving PROX version v039 to sampleVNF https://01.org/intel-data-plane-performance-demonstrators/prox-overview) Change-Id: Ia3cb02cf0e49ac5596e922c197ff7e010293d033 Signed-off-by: Deepak S --- VNFs/DPPD-PROX/stats.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 VNFs/DPPD-PROX/stats.c (limited to 'VNFs/DPPD-PROX/stats.c') diff --git a/VNFs/DPPD-PROX/stats.c b/VNFs/DPPD-PROX/stats.c new file mode 100644 index 00000000..2418826f --- /dev/null +++ b/VNFs/DPPD-PROX/stats.c @@ -0,0 +1,100 @@ +/* +// Copyright (c) 2010-2017 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 + +#include "prox_malloc.h" +#include "prox_cfg.h" +#include "stats.h" +#include "stats_port.h" +#include "stats_mempool.h" +#include "stats_ring.h" +#include "stats_l4gen.h" +#include "stats_latency.h" +#include "stats_global.h" +#include "stats_core.h" +#include "stats_task.h" +#include "stats_prio_task.h" +#include "stats_latency.h" + +/* Stores all readed values from the cores, displaying is done afterwards because + displaying introduces overhead. If displaying was done right after the values + are read, inaccuracy is introduced for later cores */ +int last_stat; /* 0 or 1 to track latest 2 measurements */ + +void stats_reset(void) +{ + stats_task_reset(); + stats_prio_task_reset(); + stats_port_reset(); + stats_latency_reset(); + stats_global_reset(); +} + +void stats_init(unsigned avg_start, unsigned duration) +{ + stats_lcore_init(); + stats_task_init(); + stats_prio_task_init(); + stats_port_init(); + stats_mempool_init(); + stats_latency_init(); + stats_l4gen_init(); + stats_ring_init(); + stats_global_init(avg_start, duration); +} + +void stats_update(uint16_t flag_cons) +{ + /* Keep track of last 2 measurements. */ + last_stat = !last_stat; + + if (flag_cons & STATS_CONS_F_TASKS) + stats_task_update(); + + if (flag_cons & STATS_CONS_F_PRIO_TASKS) + stats_prio_task_update(); + + if (flag_cons & STATS_CONS_F_LCORE) + stats_lcore_update(); + + if (flag_cons & STATS_CONS_F_PORTS) + stats_port_update(); + + if (flag_cons & STATS_CONS_F_MEMPOOLS) + stats_mempool_update(); + + if (flag_cons & STATS_CONS_F_LATENCY) + stats_latency_update(); + + if (flag_cons & STATS_CONS_F_L4GEN) + stats_l4gen_update(); + + if (flag_cons & STATS_CONS_F_RINGS) + stats_ring_update(); + + if (flag_cons & STATS_CONS_F_LCORE) + stats_lcore_post_proc(); + + if (flag_cons & STATS_CONS_F_TASKS) + stats_task_post_proc(); + + if (flag_cons & STATS_CONS_F_PRIO_TASKS) + stats_prio_task_post_proc(); + + if (flag_cons & STATS_CONS_F_GLOBAL) + stats_global_post_proc(); +} -- cgit 1.2.3-korg