diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 0c7ce20055..2668bf9894 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -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, diff --git a/pandora_server/util/pandora_xml_stress.pl b/pandora_server/util/pandora_xml_stress.pl index 91e6374a6b..502f7a29c1 100755 --- a/pandora_server/util/pandora_xml_stress.pl +++ b/pandora_server/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";