From 2e5fdf25b98af7923f319d52bef5b45ee9684fbc Mon Sep 17 00:00:00 2001 From: xchaos Date: Tue, 29 Oct 2013 13:49:19 +0000 Subject: [PATCH] agregation git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@230 251d49ef-1d17-4917-a970-b30cf55b089b --- networks.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/networks.c b/networks.c index c9e54f8..3308943 100644 --- a/networks.c +++ b/networks.c @@ -36,7 +36,7 @@ void update_network(char *look_for, struct IP* ip) { network->group += 1; network->min += ip->min; - network->direct += ip->max<<10; /* sum of Mbps, not kbps*/ + network->direct += ip->max>>10; /* sum of Mbps, not kbps*/ if(ip->max > network->max) { @@ -45,11 +45,11 @@ void update_network(char *look_for, struct IP* ip) if(network->max > network->min) { - network->desired = network->max; + network->desired = network->max>>10; } else { - network->desired = network->min; + network->desired = network->min>>10; } return; } @@ -107,11 +107,11 @@ void analyse_topology(char *traceroute) /*-----------------------------------------------------------------*/ puts("Requested network parameters are:"); /*-----------------------------------------------------------------*/ - for_each(ip, networks) if(ip->desired>>10 > 0) + for_each(ip, networks) if(ip->desired) { printf("%s/%d %s REQUESTED=%dM (classes=%d, sum_min=%dk, max_1=%dk, sum_max=%LuM, agreg.=1:%d)\n", - ip->addr, ip->mask, ip->name, ip->desired>>10, ip->group, ip->min, ip->max, ip->direct, - (int)((float)(ip->direct)/(ip->desired>>10))); + ip->addr, ip->mask, ip->name, ip->desired, ip->group, ip->min, ip->max, ip->direct, + (int)((float)((ip->direct)/ip->desired)+.5)); } exit(-1); } -- 2.30.2