I wrote a program to read an alarm log. The foreach loop is very slow
(takes 2 days to run) because there are 31,197 alarms each analyzing 155 Quench Times.
I wrote sub GetQuenchInfo to create a hash to try to speed up...
but I am having trouble understanding how to call it or how to use hash..
foreach $supply (@supplies) {
$AlarmCount++ if(($supply->[4] - $supply->[3]) <= $AlarmFilter)
+;
my $dbEvents = new Sybase::CTlib 'ops','opsops','OPSYB1','fillev
+entsT';
$dbEvents->ct_sql("use rhic_au_fy01_fill");
my $sql = "SELECT *
FROM fillEventsT
WHERE rhicTime like 'Oct%' and (event like 'ev-bquenc
+h' or event like 'ev-yquench')";
my(@fills,$fill);
@fills = $dbEvents->ct_sql($sql);
foreach $fill (@fills) { # how many alarms occur w/in (Y) second
+s of a QUENCH EVENT?
$QuenchCount++ if(($supply->[3] - $fill->[0]) <= $QuenchFilter) an
+d (($supply->[3] - $fill->[0]) > 0);
}
}
sub GetQuenchTimes { # put quench times in a hash
use strict;
my $dbEvents = new Sybase::CTlib 'harmless','harmless','OPSYB1','fil
+leventsT';
$dbEvents->ct_sql("use rhic_au_fy01_fill");
my $sql = "SELECT rhicTimeUS, rhicTime
FROM fillEventsT
WHERE rhicTime like 'Oct%' and (event like 'ev-bquench' o
+r event like 'ev-yquench')";
my(@times,$time);
@times = $dbEvents->ct_sql($sql);
foreach $time (@times) {
$rhicTimeUS{$time->[0]};
print "<$time->[0]> \n";
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.