2 // Copyright (c) 2010-2019 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #ifndef _STATS_LATENCY_H_
18 #define _STATS_LATENCY_H_
22 #include "handle_lat.h"
24 struct stats_latency {
25 struct time_unit_err avg;
26 struct time_unit_err min;
27 struct time_unit_err max;
28 struct time_unit_err stddev;
30 struct time_unit accuracy_limit;
31 uint64_t lost_packets;
33 uint64_t tot_all_packets;
36 uint32_t stats_latency_get_core_id(uint32_t i);
37 uint32_t stats_latency_get_task_id(uint32_t i);
38 struct stats_latency *stats_latency_get(uint32_t i);
39 uint64_t *stats_latency_get_bucket(uint32_t i);
40 uint64_t *stats_latency_get_tot_bucket(uint32_t i);
41 struct stats_latency *stats_latency_find(uint32_t lcore_id, uint32_t task_id);
43 struct stats_latency *stats_latency_tot_get(uint32_t i);
44 struct stats_latency *stats_latency_tot_find(uint32_t lcore_id, uint32_t task_id);
46 void stats_latency_init(void);
47 void stats_latency_update(void);
48 void stats_latency_reset(void);
50 int stats_get_n_latency(void);
51 int stats_get_latency_bucket_size(void);
53 #ifdef LATENCY_HISTOGRAM
54 void stats_core_lat_histogram(uint8_t lcore_id, uint8_t task_id, uint64_t **buckets);
57 #endif /* _STATS_LATENCY_H_ */