Hi all,
Sorry to bother you.
I have to collect the stats of each flows.
I send the ofp_flow_stats_request and receive the flow_stats_in event
successfully.
But when I want to print the stats in screen, I meet some problems.
This is my code.
Disposition
router::handle_flow_stats_in(const Event& e)
{
const Flow_stats_in_event& fsie = assert_cast<const
Flow_stats_in_event&>(e);
vector<Flow_stats>::const_iterator ited;
datapathid datapath_id = fsie.datapath_id;
for (ited = fsie.flows.begin(); ited != fsie.flows.end(); ited++)
{
lg.dbg("FLOW|datapathid|%"PRIx64"|src|%s|dst|%s|srcport|%d|dstport|%d|bytes|%lld|speed|%lld|packet|%lld",
datapath_id.as_host(),
ipaddr(ited->match.nw_src).string().c_str(),
ipaddr(ited->match.nw_dst).string().c_str(),
ited->match.tp_src, ited->match.tp_dst,
ited->byte_count, ited->byte_count -
bytes[datapath_id][Flow(ited->match)], ited->packet_count);
bytes[datapath_id][Flow(ited->match)] = ited->byte_count;
}
return CONTINUE;
}
The value of bytes, speed and packet is wrong, and if I change "lld" to
"PRIx64", and it is wrong too.
I read the code of openvswitch, it use a very strange format to store the bytes
in flow entry counter which name is ovs_32aligned_u64.
typedef struct {
#ifdef WORDS_BIGENDIAN
uint32_t hi, lo;
#else
uint32_t lo, hi;
#endif
} ovs_32aligned_u64;
So I want to know what format would output the right value in screen.
Thanks very much.
-- Tony