8 open(INPUT,"$filename");
9 while(defined($line=<INPUT>)) {
11 if($line=~/host id/) {
12 $line=~ s/.*host id="//;
14 push @host_list,$line;
21 sub generate_random_deployment{
22 my($host_list,$nflows,$filename)=@_;
24 my($nhost) = scalar(@$host_list);
26 $nflows< $nhost*$nhost-$nhost or die "Too much flows! I can't do it\n";
28 open(OUTPUT,"> $filename");
29 while(scalar(keys(%pairs))<$nflows) {
30 my($src)=int(rand(scalar(@$host_list)));
31 my($dst)=int(rand(scalar(@$host_list)));
33 if($src!=$dst && !defined($pairs{"$$host_list[$src] $$host_list[$dst]"})) {
34 $pairs{"$$host_list[$src] $$host_list[$dst]"}=1;
40 <!DOCTYPE platform SYSTEM "simgrid.dtd">
41 <platform version="2">
44 foreach $p (keys %pairs) {
45 my($src,$dst)=split(/ /,$p);
46 print OUTPUT " <process host='$src' function='master'>\n";
47 print OUTPUT " <argument value='1000000'/>\n";
48 print OUTPUT " <argument value='$dst'/>\n";
49 print OUTPUT " </process>\n";
50 print OUTPUT " <process host='$dst' function='slave'/>\n";
59 my($nodes,$edges,$interferences,$host_list,$count_interferences);
61 $#ARGV>=1 or die "Need a xml platform file and a number of flows!";
62 my($filename)=$ARGV[0];
64 $filename =~ s/\.xml$//g;
65 $filename =~ s/-p$//g;
67 $host_list = read_file $ARGV[0];
68 generate_random_deployment($host_list,$nflows,"$filename-d.xml");