2013-05-20 Ramon Novoa <rnovoa@artica.es>
* util/pandora_xml_stress.pl: Added support for strictly incremental modules. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8172 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
bbc3a87eb0
commit
86266b77eb
|
@ -1,3 +1,8 @@
|
|||
2013-05-20 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* util/pandora_xml_stress.pl: Added support for strictly incremental
|
||||
modules.
|
||||
|
||||
2013-05-20 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* util/pandora_xml_stress.pl,
|
||||
|
|
|
@ -117,6 +117,9 @@ sub generate_xml_files ($$$$$$) {
|
|||
|
||||
my %modules_src_pointers = init_src_pointers($modules);
|
||||
|
||||
# Previous data for incremental modules
|
||||
my %prev_rnd_data;
|
||||
|
||||
# Generate data files
|
||||
my $utimestamp = $utimestamp_from;
|
||||
while ($utimestamp <= $utimestamp_to) {
|
||||
|
@ -154,6 +157,7 @@ sub generate_xml_files ($$$$$$) {
|
|||
my $module_type = get_conf_token ($module, 'module_type', 'generic_data');
|
||||
my $module_description = get_conf_token ($module, 'module_description', '');
|
||||
my $module_unit = get_conf_token ($module, 'module_unit', '');
|
||||
my $module_incremental = get_conf_token ($module, 'module_incremental', '0');
|
||||
my $attenuation = get_conf_token ($module, 'module_attenuation', '0');
|
||||
my @attenuation_wdays = get_conf_token_array ($module, 'module_attenuation_wdays', ' ');
|
||||
|
||||
|
@ -242,10 +246,18 @@ sub generate_xml_files ($$$$$$) {
|
|||
}
|
||||
|
||||
# Data attenuation
|
||||
if ($attenuation != 0 && ($#attenuation_wdays < 0 || $wday ~~ @attenuation_wdays)) {
|
||||
if ($attenuation != 0 && ($#attenuation_wdays < 0 || grep{$_ eq $wday} @attenuation_wdays)) {
|
||||
$rnd_data *= $attenuation;
|
||||
}
|
||||
|
||||
# Incremental module
|
||||
if ($module_incremental == 1) {
|
||||
if (defined ($prev_rnd_data{$module_name})) {
|
||||
$rnd_data += $prev_rnd_data{$module_name};
|
||||
}
|
||||
$prev_rnd_data{$module_name} = $rnd_data;
|
||||
}
|
||||
|
||||
# Save previous data
|
||||
$module->{'module_data'} = $rnd_data;
|
||||
$xml_data .= "\t\t<data><![CDATA[$rnd_data]]></data>\n";
|
||||
|
|
Loading…
Reference in New Issue