Method: Capp#stats
- Defined in:
- ext/capp/capp.c
#stats ⇒ Hash
Retrieves packet capture statistics:
p capp.stats #=> {:drop => 0, :ifdrop => 0, :recv => 123}
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 |
# File 'ext/capp/capp.c', line 1096 static VALUE capp_stats(VALUE self) { VALUE stats; pcap_t *handle; struct pcap_stat ps; GetCapp(self, handle); if (pcap_stats(handle, &ps)) rb_raise(eCappError, "%s", pcap_geterr(handle)); stats = rb_hash_new(); rb_hash_aset(stats, ID2SYM(id_drop), UINT2NUM(ps.ps_drop)); rb_hash_aset(stats, ID2SYM(id_ifdrop), UINT2NUM(ps.ps_ifdrop)); rb_hash_aset(stats, ID2SYM(id_recv), UINT2NUM(ps.ps_recv)); return stats; } |