From f3b4b99a1432ce9f80a68665d01336cbbfc70b8c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 19 Mar 2020 12:52:42 +0100 Subject: [PATCH] Bug 24904: DO NOT PUSH - benchmark script Signed-off-by: Bernardo Gonzalez Kriegel --- benchmark_installer.pl | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 benchmark_installer.pl diff --git a/benchmark_installer.pl b/benchmark_installer.pl new file mode 100644 index 0000000000..b81fe5d2de --- /dev/null +++ b/benchmark_installer.pl @@ -0,0 +1,51 @@ +use Modern::Perl; +use Time::HiRes qw(gettimeofday); +use C4::Installer; +use C4::Languages qw(getAllLanguages getTranslatedLanguages); +use C4::Context; + +my $file_type = $ARGV[0] || 'yml'; +my $installer = C4::Installer->new(); + +$installer->load_db_schema; +my $all_languages = getAllLanguages(); +my @file_list = qw( + installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.yml + installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml + installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml + installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.yml + installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.yml + installer/data/mysql/en/mandatory/auth_values.yml + installer/data/mysql/en/mandatory/class_sources.yml + installer/data/mysql/en/mandatory/sample_frequencies.yml + installer/data/mysql/en/mandatory/sample_notices.yml + installer/data/mysql/en/mandatory/sample_numberpatterns.yml + installer/data/mysql/en/optional/auth_val.yml + installer/data/mysql/en/optional/csv_profiles.yml + installer/data/mysql/en/optional/marc21_holdings_coded_values.yml + installer/data/mysql/en/optional/marc21_relatorterms.yml + installer/data/mysql/en/optional/parameters.yml + installer/data/mysql/en/optional/patron_atributes.yml + installer/data/mysql/en/optional/patron_categories.yml + installer/data/mysql/en/optional/sample_creator_data.yml + installer/data/mysql/en/optional/sample_itemtypes.yml + installer/data/mysql/en/optional/sample_libraries.yml + installer/data/mysql/en/optional/sample_libraries_holidays.yml + installer/data/mysql/en/optional/sample_news.yml + installer/data/mysql/en/optional/sample_patrons.yml + installer/data/mysql/en/optional/sample_quotes.yml + installer/data/mysql/en/optional/sample_z3950_servers.yml +); + +map { s/.yml$/.sql/ } @file_list if $file_type eq 'sql'; + +$installer->load_sql_in_order( $all_languages ); +my $begin_all = gettimeofday; +for my $sql ( @file_list ) { + my $before = gettimeofday; + $installer->load_sql($sql); + my $after = gettimeofday; + say sprintf "%.2f - %s", $after - $before, $sql; +} +my $end_all = gettimeofday; +say sprintf "TOTAL = %.2f", $end_all - $begin_all; -- 2.17.1