File: generate_peer_platform.pl

package info (click to toggle)
simgrid 4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 38,980 kB
  • sloc: cpp: 123,583; ansic: 66,779; python: 8,358; java: 6,406; fortran: 6,079; f90: 5,123; xml: 4,587; sh: 2,337; perl: 1,436; makefile: 105; lisp: 49; javascript: 7; sed: 6
file content (33 lines) | stat: -rwxr-xr-x 1,002 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env perl

# Copyright (c) 2011-2025. The SimGrid Team. All rights reserved.

# This program is free software; you can redistribute it and/or modify it
# under the terms of the license (GNU LGPL) which comes with this package.

use strict;
use warnings;

print "<?xml version='1.0'?>\n";
print "<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">\n";
print "<platform version=\"4\">\n\n";

print "<!-- This file was generated with the following command:\n          generate_peer_platform.pl $ARGV[0]\n-->\n\n";

print "\t<AS id=\"AS0\" routing=\"Vivaldi\">\n";

my $line;

open INPUT, $ARGV[0] or die "Unable to open $ARGV[1]: $!\n";
while(defined($line=<INPUT>))
{
    next if ($line =~ /^#/);
    # 278 7.2 -9.4 h 2.3
    if($line =~ /^(\S*) (\S*) (\S*) h (\S*) *$/) {
	print "\t\t<peer id=\"peer-$1\" coordinates=\"$2 $3 $4\" speed=\"730Mf\" bw_in=\"13.38MBps\" bw_out=\"1.024MBps\"/>\n";
	next;
    }
    die "Parse error: $line\n";
}
print "\t</AS>\n";
print "</platform>\n";