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_LOAD,
38 IOG_ITEM_UNIT_LAST = IOG_ITEM_UNIT_CALC_LOAD,
40 } io_graph_item_unit_t;
68 uint32_t first_frame_in_invl;
69 uint32_t min_frame_in_invl;
70 uint32_t max_frame_in_invl;
71 uint32_t last_frame_in_invl;
80 reset_io_graph_items(
io_graph_item_t *items,
size_t count,
int hf_index _U_) {
84 for (i = 0; i < count; i++) {
90 item->first_frame_in_invl = 0;
91 item->min_frame_in_invl = 0;
92 item->max_frame_in_invl = 0;
93 item->last_frame_in_invl = 0;
120 item->double_tot = 0;
133 item->double_tot = 0;
138 item->double_max = 0;
139 item->double_min = 0;
140 item->double_tot = 0;
143 case FT_RELATIVE_TIME:
180 GString *
check_field_unit(
const char *field_name,
int *hf_index, io_graph_item_unit_t item_unit);
213 if (item->first_frame_in_invl == 0) {
214 item->first_frame_in_invl = pinfo->
num;
216 item->last_frame_in_invl = pinfo->
num;
218 if (edt && hf_index >= 0) {
229 for (i=0; i < gp->len; i++) {
241 new_uint64 = fvalue_get_uinteger(((
field_info *)gp->pdata[i])->value);
243 if ((new_uint64 > item->uint_max) || (item->fields == 0)) {
244 item->uint_max = new_uint64;
245 item->max_frame_in_invl = pinfo->
num;
247 if ((new_uint64 < item->uint_min) || (item->fields == 0)) {
248 item->uint_min = new_uint64;
249 item->min_frame_in_invl = pinfo->
num;
251 item->double_tot += (double)new_uint64;
258 new_int64 = fvalue_get_sinteger(((
field_info *)gp->pdata[i])->value);
259 if ((new_int64 > item->int_max) || (item->fields == 0)) {
260 item->int_max = new_int64;
261 item->max_frame_in_invl = pinfo->
num;
263 if ((new_int64 < item->int_min) || (item->fields == 0)) {
264 item->int_min = new_int64;
265 item->min_frame_in_invl = pinfo->
num;
267 item->double_tot += (double)new_int64;
274 new_uint64 = fvalue_get_uinteger64(((
field_info *)gp->pdata[i])->value);
275 if ((new_uint64 > item->uint_max) || (item->fields == 0)) {
276 item->uint_max = new_uint64;
277 item->max_frame_in_invl = pinfo->
num;
279 if ((new_uint64 < item->uint_min) || (item->fields == 0)) {
280 item->uint_min = new_uint64;
281 item->min_frame_in_invl = pinfo->
num;
283 item->double_tot += (double)new_uint64;
290 new_int64 = fvalue_get_sinteger64(((
field_info *)gp->pdata[i])->value);
291 if ((new_int64 > item->int_max) || (item->fields == 0)) {
292 item->int_max = new_int64;
293 item->max_frame_in_invl = pinfo->
num;
295 if ((new_int64 < item->int_min) || (item->fields == 0)) {
296 item->int_min = new_int64;
297 item->min_frame_in_invl = pinfo->
num;
299 item->double_tot += (double)new_int64;
303 new_float = (float)fvalue_get_floating(((
field_info *)gp->pdata[i])->value);
304 if ((new_float > item->double_max) || (item->fields == 0)) {
305 item->double_max = new_float;
306 item->max_frame_in_invl = pinfo->
num;
308 if ((new_float < item->double_min) || (item->fields == 0)) {
309 item->double_min = new_float;
310 item->min_frame_in_invl = pinfo->
num;
312 item->double_tot += new_float;
316 new_double = fvalue_get_floating(((
field_info *)gp->pdata[i])->value);
317 if ((new_double > item->double_max) || (item->fields == 0)) {
318 item->double_max = new_double;
319 item->max_frame_in_invl = pinfo->
num;
321 if ((new_double < item->double_min) || (item->fields == 0)) {
322 item->double_min = new_double;
323 item->min_frame_in_invl = pinfo->
num;
325 item->double_tot += new_double;
328 case FT_RELATIVE_TIME:
329 new_time = fvalue_get_time(((
field_info *)gp->pdata[i])->value);
332 case IOG_ITEM_UNIT_CALC_LOAD:
342 const nstime_t time_zero = NSTIME_INIT_ZERO;
347 t = t * 1000000 + new_time->nsecs / 1000;
354 pt = pinfo->
rel_ts.secs * 1000000 + pinfo->
rel_ts.nsecs / 1000;
362 load_item = &items[j];
363 load_item->time_tot.nsecs += (int) (pt * 1000);
364 if (load_item->time_tot.nsecs > 1000000000) {
365 load_item->time_tot.secs++;
366 load_item->time_tot.nsecs -= 1000000000;
375 if (t > (uint64_t) interval) {
376 pt = (uint64_t) interval;
384 if ( (
nstime_cmp(new_time, &item->time_max) > 0)
385 || (item->fields == 0)) {
386 item->time_max = *new_time;
387 item->max_frame_in_invl = pinfo->
num;
389 if ( (
nstime_cmp(new_time, &item->time_min) < 0)
390 || (item->fields == 0)) {
391 item->time_min = *new_time;
392 item->min_frame_in_invl = pinfo->
num;
399 if ((item_unit == IOG_ITEM_UNIT_CALC_FRAMES) ||
400 (item_unit == IOG_ITEM_UNIT_CALC_FIELDS)) {
414 ws_assert_not_reached();
422 item->bytes += pinfo->fd->pkt_len;
enum ftenum proto_registrar_get_ftype(const int n)
Definition: proto.c:11109
GPtrArray * proto_get_finfo_ptr_array(const proto_tree *tree, const int id)
Definition: proto.c:11169
int64_t get_io_graph_index(packet_info *pinfo, int interval)
Definition: io_graph_item.c:22
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:138
GString * check_field_unit(const char *field_name, int *hf_index, io_graph_item_unit_t item_unit)
Definition: io_graph_item.c:41
#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:42
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