Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F123754239
counterpereth.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 29, 10:31
Size
2 KB
Mime Type
text/x-c
Expires
Thu, Jul 31, 10:31 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27750846
Attached To
R6591 HyMAB
counterpereth.hh
View Options
#ifndef CLICK_COUNTERPERETH_HH
#define CLICK_COUNTERPERETH_HH
#include <click/element.hh>
#include <click/ewma.hh>
#include <click/atomic.hh>
#include <click/timer.hh>
#include "util.hh"
CLICK_DECLS
/*
* =c
* CounterPerEth([IGNORE])
* =s counters
* measures historical packet count and rate
* =d
*
* Passes packets unchanged from its input to its
* output, maintaining statistics information about
* packet count and packet rate using a strict average.
*
* The rate covers only the time between the first and
* most recent packets.
*
* IGNORE, by default, is 0. If it is greater than 0,
* the first IGNORE number of seconds are ignored in
* the count.
*
* =h count read-only
* Returns the number of packets that have passed through since the last reset.
*
* =h byte_count read-only
* Returns the number of packets that have passed through since the last reset.
*
* =h rate read-only
* Returns packet arrival rate.
*
* =h byte_rate read-only
* Returns packet arrival rate in bytes per second. (Beware overflow!)
*
* =h reset write-only
* Resets the count and rate to zero.
*/
class
CounterPerEth
:
public
Element
{
public
:
CounterPerEth
()
CLICK_COLD
;
const
char
*
class_name
()
const
{
return
"CounterPerEth"
;
}
const
char
*
port_count
()
const
{
return
PORTS_1_1
;
}
int
configure
(
Vector
<
String
>
&
,
ErrorHandler
*
)
CLICK_COLD
;
HashTable
<
EtherAddress
,
atomic_uint32_t
>
count
()
const
{
return
_count
;
}
uint32_t
count_global
()
const
{
return
_count_global
;
}
uint32_t
count
(
EtherAddress
eth
)
const
{
return
_count
[
eth
];
}
uint32_t
byte_count
(
EtherAddress
eth
)
const
{
return
_byte_count
[
eth
];
}
uint32_t
first
(
EtherAddress
eth
)
const
{
return
_first
[
eth
];
}
uint32_t
last
(
EtherAddress
eth
)
const
{
return
_last
[
eth
];
}
uint32_t
ignore
()
const
{
return
_ignore
;
}
void
reset
();
int
debug
()
const
{
if
(
_verb_debug
)
return
10
;}
String
print_counts
(
int
);
String
print_rates
(
int
);
int
initialize
(
ErrorHandler
*
)
CLICK_COLD
;
void
add_handlers
()
CLICK_COLD
;
Packet
*
simple_action
(
Packet
*
);
private
:
HashTable
<
EtherAddress
,
atomic_uint32_t
>
_count
;
HashTable
<
EtherAddress
,
atomic_uint32_t
>
_byte_count
;
HashTable
<
EtherAddress
,
atomic_uint32_t
>
_first
;
HashTable
<
EtherAddress
,
atomic_uint32_t
>
_last
;
atomic_uint32_t
_count_global
;
uint32_t
_ignore
;
bool
_verb_debug
;
};
CLICK_ENDDECLS
#endif
Event Timeline
Log In to Comment