1 /* timestats.h
2  * Routines and definitions for time statistics
3  * Copyright 2003 Lars Roland
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef __TIMESTATS_H__
13 #define __TIMESTATS_H__
14 
15 #include <glib.h>
16 #include "epan/packet_info.h"
17 #include "wsutil/nstime.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /* __cplusplus */
22 
23  /* Summary of time statistics*/
24 typedef struct _timestat_t {
25 	guint32 num;	 /* number of samples */
26 	guint32	min_num; /* frame number of minimum */
27 	guint32	max_num; /* frame number of maximum */
28 	nstime_t min;
29 	nstime_t max;
30 	nstime_t tot;
31 	gdouble variance;
32 } timestat_t;
33 
34 /* functions */
35 
36 /* Initialize a timestat_t struct */
37 WS_DLL_PUBLIC void time_stat_init(timestat_t *stats);
38 
39 /* Update a timestat_t struct with a new sample */
40 WS_DLL_PUBLIC void time_stat_update(timestat_t *stats, const nstime_t *delta, packet_info *pinfo);
41 
42 WS_DLL_PUBLIC gdouble get_average(const nstime_t *sum, guint32 num);
43 
44 #ifdef __cplusplus
45 }
46 #endif /* __cplusplus */
47 
48 #endif /* __TIMESTATS_H__ */
49