Commit 14fb533b authored by Christopher Alfeld's avatar Christopher Alfeld

Lots of changes to do ptop_to_phys and add bandwidth info to phys.

parent 22e160f3
......@@ -15,7 +15,7 @@
#include "phys.h"
topology *topo = NULL;
tbgraph PG(1,1);
/* How can we chop things up? */
#define PARTITION_BY_ANNEALING 0
......@@ -705,8 +705,8 @@ int main(int argc, char **argv)
ifstream infile;
infile.open(argv[0]);
if (!infile || !infile.good()) {
cerr << "Error opening file: " << argv[0] << "\n";
exit(1);
cerr << "Error opening file: " << argv[0] << endl;
exit(-11);
}
parse_top(G, infile);
gw.update_graph();
......@@ -728,10 +728,17 @@ int main(int argc, char **argv)
*/
if (topofile != NULL) {
cout << "Parsing phys\n";
topo = parse_phys(topofile);
cout << "Parsing ptop\n";
ifstream ptopfile;
ptopfile.open(topofile);
if (!ptopfile || !ptopfile.good()) {
cerr << "Error opening file: " << topofile << endl;
exit(-1);
}
parse_ptop(PG,ptopfile);
topo=ptop_to_phys(PG);
if (!topo) {
cerr << "Could not read in topofile "
cerr << "Could not convert ptop to phys: "
<< topofile << endl;
exit(-1);
}
......
......@@ -33,7 +33,7 @@
*/
#define MAXSW 32
#include "testbed.h"
#include "phys.h"
topology *parse_phys(char *filename)
......
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
#include "testbed.h"
#include "phys.h"
toponode::toponode() {
......@@ -46,10 +47,11 @@ void topology::print_topo() {
cout << "Topology has " << switchcount << " switches" << endl;
cout << "--------" << endl;
for (int i = 0; i < switchcount; i++) {
cout << " sw " << i << " has " << switches[i]->numnodes() << " nodes"
<< endl;
cout << " sw " << i << " has " << switches[i]->numnodes()
<< " nodes and bw " << switches[i]->bw << endl;
for (int j = 0; j < switches[i]->nodecount; j++) {
cout << switches[i]->nodes[j].ints << " ";
cout << switches[i]->nodes[j].ints <<
"/" << switches[i]->nodes[j].int_bw << " ";
}
cout << endl;
}
......
......@@ -18,7 +18,9 @@ class toponode {
public:
toponode();
int ints; /* Number of ethernet interfaces */
int int_bw; /* Bandwidth used by each interface */
int used; /* Used by assign. Have we assigned here? */
node n;
};
class tbswitch {
......@@ -30,9 +32,10 @@ public:
inline int numnodes();
int nodecount; /* Total number of nodes in the switch */
int nodecount; /* Total number of nodes in the switch */
toponode *nodes; /* Sorted list of the nodes */
char *name; /* Anything you want */
int bw; /* Bandwidth between switch and center */
};
class topology {
......@@ -52,4 +55,4 @@ public:
*/
topology *parse_phys(char *filename);
topology *ptop_to_phys(tbgraph &G);
......@@ -4,7 +4,7 @@
testnode::testnode()
{
name_ = NULL;
interfaces_ = 0;
// interfaces_ = 0;
type_ = 0;
partition_ = 0;
}
......
......@@ -21,8 +21,8 @@ public:
inline char *name() { return name_; }
void name(char *newname);
inline int interfaces() { return interfaces_; }
inline void interfaces(int newint) { interfaces_ = newint; }
// inline int interfaces() { return interfaces_; }
//inline void interfaces(int newint) { interfaces_ = newint; }
inline int type() { return type_; }
inline void type(int newtype) { type_ = newtype; }
inline int partition() { return partition_; }
......@@ -43,7 +43,7 @@ public:
private:
char *name_;
int interfaces_;
// int interfaces_;
int type_;
int partition_; /* To which partition does this node belong? */
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment