summaryrefslogtreecommitdiffstats
path: root/sharpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-01-10 01:27:10 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-01-11 01:29:00 +0100
commit25c84d86d722a689ad592f6e10b0134be8a5bb39 (patch)
treed59813bd88cbd3b9c9f32887cbb38cadbf09802e /sharpd
parentsharpd: Allow route install/removal of v6 routes. (diff)
downloadfrr-25c84d86d722a689ad592f6e10b0134be8a5bb39.tar.xz
frr-25c84d86d722a689ad592f6e10b0134be8a5bb39.zip
sharpd: Do addition/subtraction for me
Write a bit of code to track the start/stop times and do subtraction! In the future we expect this code to slice and dice as well. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'sharpd')
-rw-r--r--sharpd/sharp_zebra.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index 8d6260494..c9f333e34 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -129,6 +129,8 @@ static int interface_state_down(int command, struct zclient *zclient,
return 0;
}
+static struct timeval t_start;
+static struct timeval t_end;
extern uint32_t total_routes;
extern uint32_t installed_routes;
extern uint32_t removed_routes;
@@ -152,6 +154,7 @@ void sharp_install_routes_helper(struct prefix *p, uint8_t instance,
} else
temp = ntohl(p->u.val32[3]);
+ monotime(&t_start);
for (i = 0; i < routes; i++) {
route_add(p, (uint8_t)instance, nhg);
if (v4)
@@ -175,6 +178,7 @@ void sharp_remove_routes_helper(struct prefix *p, uint8_t instance,
} else
temp = ntohl(p->u.val32[3]);
+ monotime(&t_start);
for (i = 0; i < routes; i++) {
route_delete(p, (uint8_t)instance);
if (v4)
@@ -207,6 +211,7 @@ static void handle_repeated(bool installed)
static int route_notify_owner(int command, struct zclient *zclient,
zebra_size_t length, vrf_id_t vrf_id)
{
+ struct timeval r;
struct prefix p;
enum zapi_route_notify_owner note;
uint32_t table;
@@ -218,7 +223,10 @@ static int route_notify_owner(int command, struct zclient *zclient,
case ZAPI_ROUTE_INSTALLED:
installed_routes++;
if (total_routes == installed_routes) {
- zlog_debug("Installed All Items");
+ monotime(&t_end);
+ timersub(&t_end, &t_start, &r);
+ zlog_debug("Installed All Items %ld.%ld", r.tv_sec,
+ r.tv_usec);
handle_repeated(true);
}
break;
@@ -231,7 +239,10 @@ static int route_notify_owner(int command, struct zclient *zclient,
case ZAPI_ROUTE_REMOVED:
removed_routes++;
if (total_routes == removed_routes) {
- zlog_debug("Removed all Items");
+ monotime(&t_end);
+ timersub(&t_end, &t_start, &r);
+ zlog_debug("Removed all Items %ld.%ld", r.tv_sec,
+ r.tv_usec);
handle_repeated(false);
}
break;