Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
be25220b
Commit
be25220b
authored
Aug 18, 2006
by
Mike Hibler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to specify a "start" time from which to set the initial conditions.
parent
5c798e51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
pelab/init-elabnodes.pl
pelab/init-elabnodes.pl
+31
-9
No files found.
pelab/init-elabnodes.pl
View file @
be25220b
...
...
@@ -49,6 +49,7 @@ struct( initvalres => {
my
%shapeinfo
;
my
$showonly
=
0
;
my
$starttime
=
0
;
# Default values. Note: delay and PLR are round trip values.
my
$DEF_BW
=
10000
;
# Kbits/sec
...
...
@@ -59,17 +60,28 @@ my $PWDFILE = "/usr/testbed/etc/pelabdb.pwd";
my
$DBNAME
=
"
pelab
";
my
$DBUSER
=
"
pelab
";
my
$now
=
time
();
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
#
my
%options
=
();
if
(
!
getopts
("
n
",
\
%options
))
{
if
(
!
getopts
("
S:
n
",
\
%options
))
{
usage
();
}
if
(
defined
(
$options
{"
n
"}))
{
$showonly
=
1
;
}
if
(
defined
(
$options
{"
S
"}))
{
my
$high
=
time
();
my
$low
=
$high
-
(
23
*
60
*
60
);
# XXX
$starttime
=
$options
{"
S
"};
if
(
$starttime
&&
(
$starttime
<
$low
||
$starttime
>
$high
))
{
die
("
Bogus timestamp
$starttime
, should be in [
$low
-
$high
]
\n
");
}
}
if
(
@ARGV
!=
2
)
{
print
STDERR
"
usage: init-elabnodes pid eid
\n
";
exit
(
1
);
...
...
@@ -161,6 +173,15 @@ foreach my $mapping (@nodelist) {
}
}
my
$msg
=
"
Intializing conditions from time
";
if
(
$starttime
)
{
$msg
.=
"
$starttime
(now -
"
.
(
$now
-
$starttime
)
.
"
seconds)
\n
";
}
else
{
$msg
.=
$now
.
"
(now)
\n
";
$starttime
=
$now
;
}
print
(
$msg
);
#
# Get planetlab info for each planetlab node...
#
...
...
@@ -275,7 +296,8 @@ sub get_plabinfo($)
my $query_result =
DBQueryFatal("select latency,loss,bw from pair_data ".
"where srcsite_idx='$src_site' and ".
" dstsite_idx='$dst_site' ".
" dstsite_idx='$dst_site' and ".
" unixstamp <= $starttime ".
"order by unixstamp desc limit 5");
if (!$query_result->numrows) {
...
...
@@ -334,9 +356,9 @@ sub get_pathInitCond($$$;$)
{
my
(
$srcnode
,
$dstnode
,
$pasthours
,
$expAlpha
)
=
@_
;
if
(
!
defined
$expAlpha
)
{
$expAlpha
=
0.6
;
}
#default alpha value
my
$
end
time
=
time
()
;
#my $
star
ttime = $
end
time - (60*60*24);
my
$
star
ttime
=
$
end
time
-
(
60
*
60
*$pasthours
);
my
$
last
time
=
$start
time
;
#my $
firs
ttime = $
last
time - (60*60*24);
my
$
firs
ttime
=
$
last
time
-
(
60
*
60
*$pasthours
);
my
$srcsite_idx
=
$site_mapping
{
$srcnode
};
my
$dstsite_idx
=
$site_mapping
{
$dstnode
};
...
...
@@ -358,8 +380,8 @@ sub get_pathInitCond($$$;$)
"
srcsite_idx =
$srcsite_idx
and
"
.
"
dstsite_idx =
$dstsite_idx
and
"
.
"
(latency IS NOT NULL or bw IS NOT NULL) and
"
.
"
unixstamp >
$
star
ttime
and
"
.
"
unixstamp <
$
end
time
"
.
"
unixstamp >
$
firs
ttime
and
"
.
"
unixstamp <
=
$
last
time
"
.
"
order by unixstamp asc
"
.
"
;
"
);
while
(
my
$hr
=
$sth
->
fetchrow_hashref
()
){
...
...
@@ -385,8 +407,8 @@ sub get_pathInitCond($$$;$)
"
srcsite_idx =
$dstsite_idx
and
"
.
"
dstsite_idx =
$srcsite_idx
and
"
.
"
(latency IS NOT NULL) and
"
.
"
unixstamp >
$
star
ttime
and
"
.
"
unixstamp <
$
end
time
"
.
"
unixstamp >
$
firs
ttime
and
"
.
"
unixstamp <
=
$
last
time
"
.
"
order by unixstamp asc
"
.
"
;
"
);
while
(
my
$hr
=
$sth
->
fetchrow_hashref
()
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment