Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
ea2e41bc
Commit
ea2e41bc
authored
Dec 01, 2013
by
Matthieu Muffato
Browse files
The unit conversion table is constant
parent
572ee734
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
scripts/lsf_report.pl
scripts/lsf_report.pl
+4
-2
No files found.
scripts/lsf_report.pl
View file @
ea2e41bc
...
...
@@ -139,6 +139,8 @@ sub main {
my
$sth_replace
=
$dbc
->
prepare
(
'
REPLACE INTO lsf_report (process_id, status, mem_megs, swap_megs, exception_status) VALUES (?, ?, ?, ?, ?)
'
);
{
local
$/
=
"
------------------------------------------------------------------------------
\n\n
";
my
%units_converter
=
(
'
K
'
=>
1.0
/
1024
,
'
M
'
=>
1
,
'
G
'
=>
1024
,
'
T
'
=>
1024
*
1024
);
open
(
my
$bacct_fh
,
$bacct_source_line
);
my
$record
=
<
$bacct_fh
>
;
# skip the header
...
...
@@ -165,8 +167,8 @@ sub main {
my
(
$mem_in_units
,
$mem_unit
)
=
$usage
{'
MEM
'}
=~
/^([\d\.]+)([KMGT])$/
;
my
(
$swap_in_units
,
$swap_unit
)
=
$usage
{'
SWAP
'}
=~
/^([\d\.]+)([KMGT])$/
;
my
$mem_megs
=
$mem_in_units
*
{
'
K
'
=>
1.0
/
1024
,
'
M
'
=>
1
,
'
G
'
=>
1024
,
'
T
'
=>
1024
*
1024
}
->
{
$mem_unit
};
my
$swap_megs
=
$swap_in_units
*
{
'
K
'
=>
1.0
/
1024
,
'
M
'
=>
1
,
'
G
'
=>
1024
,
'
T
'
=>
1024
*
1024
}
->
{
$swap_unit
};
my
$mem_megs
=
$mem_in_units
*
$units_converter
{
$mem_unit
};
my
$swap_megs
=
$swap_in_units
*
$units_converter
{
$swap_unit
};
# warn "PROC_ID=$process_id, STATUS=$usage{STATUS}, MEM=$mem_megs, SWAP=$swap_megs, EXC_STATUS='$exception_status'\n";
$sth_replace
->
execute
(
$process_id
,
$usage
{
STATUS
},
$mem_megs
,
$swap_megs
,
$exception_status
);
...
...
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