14#ifndef __IO_GRAPH_ITEM_H__
15#define __IO_GRAPH_ITEM_H__
28 IOG_ITEM_UNIT_PACKETS = IOG_ITEM_UNIT_FIRST,
31 IOG_ITEM_UNIT_CALC_SUM,
32 IOG_ITEM_UNIT_CALC_FRAMES,
33 IOG_ITEM_UNIT_CALC_FIELDS,
34 IOG_ITEM_UNIT_CALC_MAX,
35 IOG_ITEM_UNIT_CALC_MIN,
36 IOG_ITEM_UNIT_CALC_AVERAGE,
37 IOG_ITEM_UNIT_CALC_THROUGHPUT,
38 IOG_ITEM_UNIT_CALC_LOAD,
39 IOG_ITEM_UNIT_LAST = IOG_ITEM_UNIT_CALC_LOAD,
41} io_graph_item_unit_t;
69 uint32_t first_frame_in_invl;
70 uint32_t min_frame_in_invl;
71 uint32_t max_frame_in_invl;
72 uint32_t last_frame_in_invl;
81reset_io_graph_items(
io_graph_item_t *items,
size_t count,
int hf_index _U_) {
85 for (i = 0; i < count; i++) {
91 item->first_frame_in_invl = 0;
92 item->min_frame_in_invl = 0;
93 item->max_frame_in_invl = 0;
94 item->last_frame_in_invl = 0;
96 nstime_set_zero(&item->time_max);
97 nstime_set_zero(&item->time_min);
98 nstime_set_zero(&item->time_tot);
121 item->double_tot = 0;
134 item->double_tot = 0;
139 item->double_max = 0;
140 item->double_min = 0;
141 item->double_tot = 0;
144 case FT_RELATIVE_TIME:
145 nstime_set_zero(&item->time_max);
146 nstime_set_zero(&item->time_min);
147 nstime_set_zero(&item->time_tot);
181GString *
check_field_unit(
const char *field_name,
int *hf_index, io_graph_item_unit_t item_unit);
215 if (item->first_frame_in_invl == 0) {
216 item->first_frame_in_invl = pinfo->
num;
218 item->last_frame_in_invl = pinfo->
num;
220 if (edt && hf_index >= 0) {
231 for (i=0; i < gp->len; i++) {
243 new_uint64 = fvalue_get_uinteger(((
field_info *)gp->pdata[i])->value);
245 if ((new_uint64 > item->uint_max) || (item->fields == 0)) {
246 item->uint_max = new_uint64;
247 item->max_frame_in_invl = pinfo->
num;
249 if ((new_uint64 < item->uint_min) || (item->fields == 0)) {
250 item->uint_min = new_uint64;
251 item->min_frame_in_invl = pinfo->
num;
253 item->double_tot += (double)new_uint64;
260 new_int64 = fvalue_get_sinteger(((
field_info *)gp->pdata[i])->value);
261 if ((new_int64 > item->int_max) || (item->fields == 0)) {
262 item->int_max = new_int64;
263 item->max_frame_in_invl = pinfo->
num;
265 if ((new_int64 < item->int_min) || (item->fields == 0)) {
266 item->int_min = new_int64;
267 item->min_frame_in_invl = pinfo->
num;
269 item->double_tot += (double)new_int64;
276 new_uint64 = fvalue_get_uinteger64(((
field_info *)gp->pdata[i])->value);
277 if ((new_uint64 > item->uint_max) || (item->fields == 0)) {
278 item->uint_max = new_uint64;
279 item->max_frame_in_invl = pinfo->
num;
281 if ((new_uint64 < item->uint_min) || (item->fields == 0)) {
282 item->uint_min = new_uint64;
283 item->min_frame_in_invl = pinfo->
num;
285 item->double_tot += (double)new_uint64;
292 new_int64 = fvalue_get_sinteger64(((
field_info *)gp->pdata[i])->value);
293 if ((new_int64 > item->int_max) || (item->fields == 0)) {
294 item->int_max = new_int64;
295 item->max_frame_in_invl = pinfo->
num;
297 if ((new_int64 < item->int_min) || (item->fields == 0)) {
298 item->int_min = new_int64;
299 item->min_frame_in_invl = pinfo->
num;
301 item->double_tot += (double)new_int64;
305 new_float = (float)fvalue_get_floating(((
field_info *)gp->pdata[i])->value);
306 if ((new_float > item->double_max) || (item->fields == 0)) {
307 item->double_max = new_float;
308 item->max_frame_in_invl = pinfo->
num;
310 if ((new_float < item->double_min) || (item->fields == 0)) {
311 item->double_min = new_float;
312 item->min_frame_in_invl = pinfo->
num;
314 item->double_tot += new_float;
318 new_double = fvalue_get_floating(((
field_info *)gp->pdata[i])->value);
319 if ((new_double > item->double_max) || (item->fields == 0)) {
320 item->double_max = new_double;
321 item->max_frame_in_invl = pinfo->
num;
323 if ((new_double < item->double_min) || (item->fields == 0)) {
324 item->double_min = new_double;
325 item->min_frame_in_invl = pinfo->
num;
327 item->double_tot += new_double;
330 case FT_RELATIVE_TIME:
331 new_time = fvalue_get_time(((
field_info *)gp->pdata[i])->value);
334 case IOG_ITEM_UNIT_CALC_LOAD:
344 const nstime_t time_zero = NSTIME_INIT_ZERO;
345 if (nstime_cmp(new_time, &time_zero) < 0) {
349 t = t * 1000000 + new_time->nsecs / 1000;
356 pt = pinfo->
rel_ts.secs * 1000000 + pinfo->
rel_ts.nsecs / 1000;
364 load_item = &items[j];
365 load_item->time_tot.nsecs += (int) (pt * 1000);
366 if (load_item->time_tot.nsecs > 1000000000) {
367 load_item->time_tot.secs++;
368 load_item->time_tot.nsecs -= 1000000000;
377 if (t > (uint64_t) interval) {
378 pt = (uint64_t) interval;
386 if ( (nstime_cmp(new_time, &item->time_max) > 0)
387 || (item->fields == 0)) {
388 item->time_max = *new_time;
389 item->max_frame_in_invl = pinfo->
num;
391 if ( (nstime_cmp(new_time, &item->time_min) < 0)
392 || (item->fields == 0)) {
393 item->time_min = *new_time;
394 item->min_frame_in_invl = pinfo->
num;
401 if ((item_unit == IOG_ITEM_UNIT_CALC_FRAMES) ||
402 (item_unit == IOG_ITEM_UNIT_CALC_FIELDS)) {
416 ws_assert_not_reached();
424 item->bytes += pinfo->fd->pkt_len;
enum ftenum proto_registrar_get_ftype(const int n)
Definition proto.c:11213
GPtrArray * proto_get_finfo_ptr_array(const proto_tree *tree, const int id)
Definition proto.c:11273
int64_t get_io_graph_index(packet_info *pinfo, int interval)
Definition io_graph_item.c:25
GString * check_field_unit(const char *field_name, int *hf_index, io_graph_item_unit_t item_unit)
Definition io_graph_item.c:44
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, bool asAOT)
Definition io_graph_item.c:143
#define nstime_add(sum, a)
Definition nstime.h:96
Definition io_graph_item.h:43
Definition packet_info.h:43
uint32_t num
Definition packet_info.h:47
nstime_t rel_ts
Definition packet_info.h:49
Definition epan_dissect.h:28