14 #ifndef __IO_GRAPH_ITEM_H__
15 #define __IO_GRAPH_ITEM_H__
26 IOG_ITEM_UNIT_PACKETS = IOG_ITEM_UNIT_FIRST,
29 IOG_ITEM_UNIT_CALC_SUM,
30 IOG_ITEM_UNIT_CALC_FRAMES,
31 IOG_ITEM_UNIT_CALC_FIELDS,
32 IOG_ITEM_UNIT_CALC_MAX,
33 IOG_ITEM_UNIT_CALC_MIN,
34 IOG_ITEM_UNIT_CALC_AVERAGE,
35 IOG_ITEM_UNIT_CALC_LOAD,
36 IOG_ITEM_UNIT_LAST = IOG_ITEM_UNIT_CALC_LOAD,
38 } io_graph_item_unit_t;
66 uint32_t first_frame_in_invl;
67 uint32_t min_frame_in_invl;
68 uint32_t max_frame_in_invl;
69 uint32_t last_frame_in_invl;
78 reset_io_graph_items(
io_graph_item_t *items,
size_t count,
int hf_index _U_) {
82 for (i = 0; i < count; i++) {
88 item->first_frame_in_invl = 0;
89 item->min_frame_in_invl = 0;
90 item->max_frame_in_invl = 0;
91 item->last_frame_in_invl = 0;
118 item->double_tot = 0;
131 item->double_tot = 0;
136 item->double_max = 0;
137 item->double_min = 0;
138 item->double_tot = 0;
141 case FT_RELATIVE_TIME:
178 GString *
check_field_unit(
const char *field_name,
int *hf_index, io_graph_item_unit_t item_unit);
211 if (item->first_frame_in_invl == 0) {
212 item->first_frame_in_invl = pinfo->
num;
214 item->last_frame_in_invl = pinfo->
num;
216 if (edt && hf_index >= 0) {
227 for (i=0; i < gp->len; i++) {
239 new_uint64 = fvalue_get_uinteger(((
field_info *)gp->pdata[i])->value);
241 if ((new_uint64 > item->uint_max) || (item->fields == 0)) {
242 item->uint_max = new_uint64;
243 item->max_frame_in_invl = pinfo->
num;
245 if ((new_uint64 < item->uint_min) || (item->fields == 0)) {
246 item->uint_min = new_uint64;
247 item->min_frame_in_invl = pinfo->
num;
249 item->double_tot += (double)new_uint64;
256 new_int64 = fvalue_get_sinteger(((
field_info *)gp->pdata[i])->value);
257 if ((new_int64 > item->int_max) || (item->fields == 0)) {
258 item->int_max = new_int64;
259 item->max_frame_in_invl = pinfo->
num;
261 if ((new_int64 < item->int_min) || (item->fields == 0)) {
262 item->int_min = new_int64;
263 item->min_frame_in_invl = pinfo->
num;
265 item->double_tot += (double)new_int64;
272 new_uint64 = fvalue_get_uinteger64(((
field_info *)gp->pdata[i])->value);
273 if ((new_uint64 > item->uint_max) || (item->fields == 0)) {
274 item->uint_max = new_uint64;
275 item->max_frame_in_invl = pinfo->
num;
277 if ((new_uint64 < item->uint_min) || (item->fields == 0)) {
278 item->uint_min = new_uint64;
279 item->min_frame_in_invl = pinfo->
num;
281 item->double_tot += (double)new_uint64;
288 new_int64 = fvalue_get_sinteger64(((
field_info *)gp->pdata[i])->value);
289 if ((new_int64 > item->int_max) || (item->fields == 0)) {
290 item->int_max = new_int64;
291 item->max_frame_in_invl = pinfo->
num;
293 if ((new_int64 < item->int_min) || (item->fields == 0)) {
294 item->int_min = new_int64;
295 item->min_frame_in_invl = pinfo->
num;
297 item->double_tot += (double)new_int64;
301 new_float = (float)fvalue_get_floating(((
field_info *)gp->pdata[i])->value);
302 if ((new_float > item->double_max) || (item->fields == 0)) {
303 item->double_max = new_float;
304 item->max_frame_in_invl = pinfo->
num;
306 if ((new_float < item->double_min) || (item->fields == 0)) {
307 item->double_min = new_float;
308 item->min_frame_in_invl = pinfo->
num;
310 item->double_tot += new_float;
314 new_double = fvalue_get_floating(((
field_info *)gp->pdata[i])->value);
315 if ((new_double > item->double_max) || (item->fields == 0)) {
316 item->double_max = new_double;
317 item->max_frame_in_invl = pinfo->
num;
319 if ((new_double < item->double_min) || (item->fields == 0)) {
320 item->double_min = new_double;
321 item->min_frame_in_invl = pinfo->
num;
323 item->double_tot += new_double;
326 case FT_RELATIVE_TIME:
327 new_time = fvalue_get_time(((
field_info *)gp->pdata[i])->value);
330 case IOG_ITEM_UNIT_CALC_LOAD:
340 const nstime_t time_zero = NSTIME_INIT_ZERO;
345 t = t * 1000000 + new_time->nsecs / 1000;
352 pt = pinfo->
rel_ts.secs * 1000000 + pinfo->
rel_ts.nsecs / 1000;
360 load_item = &items[j];
361 load_item->time_tot.nsecs += (int) (pt * 1000);
362 if (load_item->time_tot.nsecs > 1000000000) {
363 load_item->time_tot.secs++;
364 load_item->time_tot.nsecs -= 1000000000;
373 if (t > (uint64_t) interval) {
374 pt = (uint64_t) interval;
382 if ( (
nstime_cmp(new_time, &item->time_max) > 0)
383 || (item->fields == 0)) {
384 item->time_max = *new_time;
385 item->max_frame_in_invl = pinfo->
num;
387 if ( (
nstime_cmp(new_time, &item->time_min) < 0)
388 || (item->fields == 0)) {
389 item->time_min = *new_time;
390 item->min_frame_in_invl = pinfo->
num;
397 if ((item_unit == IOG_ITEM_UNIT_CALC_FRAMES) ||
398 (item_unit == IOG_ITEM_UNIT_CALC_FIELDS)) {
412 ws_assert_not_reached();
420 item->bytes += pinfo->fd->pkt_len;
enum ftenum proto_registrar_get_ftype(const int n)
Definition: proto.c:11073
GPtrArray * proto_get_finfo_ptr_array(const proto_tree *tree, const int id)
Definition: proto.c:11133
int64_t get_io_graph_index(packet_info *pinfo, int interval)
Definition: io_graph_item.c:20
double get_io_graph_item(const io_graph_item_t *items, io_graph_item_unit_t val_units, int idx, int hf_index, const capture_file *cap_file, int interval, int cur_idx)
Definition: io_graph_item.c:130
GString * check_field_unit(const char *field_name, int *hf_index, io_graph_item_unit_t item_unit)
Definition: io_graph_item.c:37
#define nstime_add(sum, a)
Definition: nstime.h:96
WS_DLL_PUBLIC void nstime_set_zero(nstime_t *nstime)
Definition: nstime.c:28
WS_DLL_PUBLIC int nstime_cmp(const nstime_t *a, const nstime_t *b)
Definition: nstime.c:138
Definition: io_graph_item.h:40
Definition: packet_info.h:44
nstime_t rel_ts
Definition: packet_info.h:50
guint32 num
Definition: packet_info.h:48
Definition: epan_dissect.h:28