Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
0193dbd7
Commit
0193dbd7
authored
Aug 08, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve comments and log messages in lib/mtr_timer.pl
parent
79b0f8d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
mysql-test/lib/mtr_timer.pl
mysql-test/lib/mtr_timer.pl
+12
-18
No files found.
mysql-test/lib/mtr_timer.pl
View file @
0193dbd7
...
@@ -52,12 +52,10 @@ sub mtr_init_timers () {
...
@@ -52,12 +52,10 @@ sub mtr_init_timers () {
sub
mtr_timer_start
($$$)
{
sub
mtr_timer_start
($$$)
{
my
(
$timers
,
$name
,
$duration
)
=
@_
;
my
(
$timers
,
$name
,
$duration
)
=
@_
;
mtr_verbose
("
mtr_timer_start:
$name
,
$duration
");
if
(
exists
$timers
->
{'
timers
'}
->
{
$name
}
)
if
(
exists
$timers
->
{'
timers
'}
->
{
$name
}
)
{
{
# We have an old running timer, kill it
# We have an old running timer, kill it
mtr_
verbose
("
There is an old timer running
");
mtr_
warning
("
There is an old timer running
");
mtr_timer_stop
(
$timers
,
$name
);
mtr_timer_stop
(
$timers
,
$name
);
}
}
...
@@ -75,22 +73,22 @@ sub mtr_timer_start($$$) {
...
@@ -75,22 +73,22 @@ sub mtr_timer_start($$$) {
}
}
else
else
{
{
mtr_error
("
can't fork
");
mtr_error
("
can't fork
timer, error: $!
");
}
}
}
}
if
(
$tpid
)
if
(
$tpid
)
{
{
# Parent, record the information
# Parent, record the information
mtr_verbose
("
timer parent, record info(
$name
,
$tpid
,
$duration
)
");
mtr_verbose
("
Starting timer for '
$name
',
",
"
duration:
$duration
, pid:
$tpid
");
$timers
->
{'
timers
'}
->
{
$name
}
->
{'
pid
'}
=
$tpid
;
$timers
->
{'
timers
'}
->
{
$name
}
->
{'
pid
'}
=
$tpid
;
$timers
->
{'
timers
'}
->
{
$name
}
->
{'
duration
'}
=
$duration
;
$timers
->
{'
timers
'}
->
{
$name
}
->
{'
duration
'}
=
$duration
;
$timers
->
{'
pids
'}
->
{
$tpid
}
=
$name
;
$timers
->
{'
pids
'}
->
{
$tpid
}
=
$name
;
}
}
else
else
{
{
# Child, redirect output and exec
# Child, install signal handlers and sleep for "duration"
# FIXME do we need to redirect streams?
# Don't do the ^C cleanup in the timeout child processes!
# Don't do the ^C cleanup in the timeout child processes!
# There is actually a race here, if we get ^C after fork(), but before
# There is actually a race here, if we get ^C after fork(), but before
...
@@ -98,13 +96,13 @@ sub mtr_timer_start($$$) {
...
@@ -98,13 +96,13 @@ sub mtr_timer_start($$$) {
$SIG
{
INT
}
=
'
DEFAULT
';
$SIG
{
INT
}
=
'
DEFAULT
';
$SIG
{
TERM
}
=
sub
{
$SIG
{
TERM
}
=
sub
{
mtr_verbose
("
timer woke up, exiting!
");
mtr_verbose
("
timer
$$
woke up, exiting!
");
exit
(
0
);
exit
(
0
);
};
};
$0
=
"
mtr_timer(timers,
$name
,
$duration
)
";
$0
=
"
mtr_timer(timers,
$name
,
$duration
)
";
sleep
(
$duration
);
sleep
(
$duration
);
mtr_verbose
("
timer expired after
$duration
seconds
");
mtr_verbose
("
timer
$$
expired after
$duration
seconds
");
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -114,12 +112,10 @@ sub mtr_timer_start($$$) {
...
@@ -114,12 +112,10 @@ sub mtr_timer_start($$$) {
sub
mtr_timer_stop
($$)
{
sub
mtr_timer_stop
($$)
{
my
(
$timers
,
$name
)
=
@_
;
my
(
$timers
,
$name
)
=
@_
;
mtr_verbose
("
mtr_timer_stop:
$name
");
if
(
exists
$timers
->
{'
timers
'}
->
{
$name
}
)
if
(
exists
$timers
->
{'
timers
'}
->
{
$name
}
)
{
{
my
$tpid
=
$timers
->
{'
timers
'}
->
{
$name
}
->
{'
pid
'};
my
$tpid
=
$timers
->
{'
timers
'}
->
{
$name
}
->
{'
pid
'};
mtr_verbose
("
Stopping timer with pid
$tpid
");
mtr_verbose
("
Stopping timer
for '
$name
'
with pid
$tpid
");
# FIXME as Cygwin reuses pids fast, maybe check that is
# FIXME as Cygwin reuses pids fast, maybe check that is
# the expected process somehow?!
# the expected process somehow?!
...
@@ -134,11 +130,8 @@ sub mtr_timer_stop ($$) {
...
@@ -134,11 +130,8 @@ sub mtr_timer_stop ($$) {
return
1
;
return
1
;
}
}
else
{
mtr_error
("
Asked to stop timer '
$name
' not started
");
mtr_error
("
Asked to stop timer
\"
$name
\"
not started
");
return
0
;
}
}
}
...
@@ -158,7 +151,8 @@ sub mtr_timer_timeout ($$) {
...
@@ -158,7 +151,8 @@ sub mtr_timer_timeout ($$) {
return
""
unless
exists
$timers
->
{'
pids
'}
->
{
$pid
};
return
""
unless
exists
$timers
->
{'
pids
'}
->
{
$pid
};
# We got a timeout, return the name ot the timer
# Got a timeout(the process with $pid is recorded as being a timer)
# return the name of the timer
return
$timers
->
{'
pids
'}
->
{
$pid
};
return
$timers
->
{'
pids
'}
->
{
$pid
};
}
}
...
...
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