added first steps for statistics
This commit is contained in:
parent
fdb15550a6
commit
30b1aeaa27
3 changed files with 11 additions and 7 deletions
|
@ -103,6 +103,8 @@ int emulate(int argc, char *argv[])
|
|||
struct rtnl_tc *qdisc_netem = NULL;
|
||||
struct rtnl_tc *cls_fw = NULL;
|
||||
|
||||
struct tc_statistics stats_netem;
|
||||
|
||||
/* Create connection to netlink */
|
||||
sock = nl_socket_alloc();
|
||||
nl_connect(sock, NETLINK_ROUTE);
|
||||
|
@ -152,7 +154,9 @@ int emulate(int argc, char *argv[])
|
|||
nl_object_dump((struct nl_object *) qdisc_prio, &dp_param);
|
||||
nl_object_dump((struct nl_object *) cls_fw, &dp_param);
|
||||
#endif
|
||||
|
||||
tc_print_netem(qdisc_netem);
|
||||
tc_print_stats(&stats_netem);
|
||||
|
||||
next_line: len = getline(&line, &linelen, stdin);
|
||||
if (len < 0 && errno == ENOENT)
|
||||
|
@ -180,4 +184,4 @@ next_line: len = getline(&line, &linelen, stdin);
|
|||
nl_socket_free(sock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
4
tc.c
4
tc.c
|
@ -125,9 +125,9 @@ int tc_get_stats(struct nl_sock *sock, struct rtnl_tc *tc, struct tc_stats *stat
|
|||
return 0;
|
||||
}
|
||||
|
||||
int tc_print_stats(struct tc_stats *stats)
|
||||
int tc_print_stats(struct tc_statistics *stats)
|
||||
{
|
||||
return 0;
|
||||
printf("packets %u bytes %u\n", stats->packets, stats->bytes);
|
||||
}
|
||||
|
||||
int tc_print_netem(struct rtnl_tc *tc)
|
||||
|
|
8
tc.h
8
tc.h
|
@ -12,7 +12,7 @@
|
|||
#include <netlink/route/qdisc.h>
|
||||
#include <netlink/route/classifier.h>
|
||||
|
||||
/*struct tc_stats {
|
||||
struct tc_statistics {
|
||||
uint64_t packets; // Number of packets seen.
|
||||
uint64_t bytes; // Total bytes seen.
|
||||
uint64_t rate_bps; // Current bits/s (rate estimator)
|
||||
|
@ -22,7 +22,7 @@
|
|||
uint64_t drops; // Total number of packets dropped.
|
||||
uint64_t requeues; // Total number of requeues.
|
||||
uint64_t overlimits; // Total number of overlimits.
|
||||
};*/
|
||||
};
|
||||
|
||||
struct rtnl_link * tc_get_link(struct nl_sock *sock, const char *dev);
|
||||
|
||||
|
@ -36,8 +36,8 @@ int tc_reset(struct nl_sock *sock, struct rtnl_link *link);
|
|||
|
||||
int tc_get_stats(struct nl_sock *sock, struct rtnl_tc *tc, struct tc_stats *stats);
|
||||
|
||||
int tc_print_stats(struct tc_stats *stats);
|
||||
int tc_print_stats(struct tc_statistics *stats);
|
||||
|
||||
int tc_print_netem(struct rtnl_tc *tc);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue