Skip to content

Commit

Permalink
Merge bb872b5 into 71ced36
Browse files Browse the repository at this point in the history
  • Loading branch information
Cylix committed Jun 14, 2018
2 parents 71ced36 + bb872b5 commit 36fd10a
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ matrix:
env: MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9 && CMAKE_BUILD_TYPE=Debug && COVERAGE=1"
after_success: cd ${TRAVIS_BUILD_DIR}; ./coverage.sh

# Linux x GCC4.9 x Debug x Performance
- os: linux
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9']
env: MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9 && CMAKE_BUILD_TYPE=Release && PERFORMANCE=1"

# Allow quality control jobs to fail
allow_failures:
- os: osx
Expand All @@ -292,6 +300,12 @@ matrix:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9']
env: MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9 && CMAKE_BUILD_TYPE=Debug && COVERAGE=1"
- os: linux
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9']
env: MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9 && CMAKE_BUILD_TYPE=Release && PERFORMANCE=1"

# Allow fast finish, even if the optional quality control jobs are not done yet
fast_finish: true
Expand Down Expand Up @@ -345,4 +359,7 @@ script:
- cd build
- cmake $CMAKE_PARAMS ..
- eval make $REDIR
- GTEST_COLOR=1 ctest -VV
- if [ "$PERFORMANCE" != "1" ]; then GTEST_COLOR=1 ctest -VV; fi

after_script:
- if [ "$PERFORMANCE" == "1" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then cd ../test/performance && ruby test_perf.rb; fi
69 changes: 69 additions & 0 deletions test/performance/test_perf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Check we have the required environment variables
if not ENV['TRAVIS_PULL_REQUEST'] or not ENV['TRAVIS_REPO_SLUG'] or not ENV['GH_TOKEN'] or not ENV['TRAVIS_PULL_REQUEST_BRANCH']
puts "Environment misconfiguration"
exit
end

# Basic init
result = ""
decrease = ""
improvement = ""
notif = ""

# Get report from master branch
`git checkout master -- test_perf_result`

# For each test
# > get execution time
# > check if there is major regression or improvement
# > update the performance report
Dir['../../build/bin/*_test'].each do |f|
start_time = Time.now
`$(#{f} 1> /dev/null 2> /dev/null)`
end_time = Time.now
total_time = end_time - start_time

prev_perf = `cat test_perf_result | grep #{f} | cut -d ' ' -f 2`.to_f
higher_bound = prev_perf + (total_time * 25 / 100)
lower_bound = prev_perf - (total_time * 25 / 100)
diff = (total_time - prev_perf) * 100 / prev_perf

if total_time > higher_bound
decrease += "#{f}: was #{prev_perf}, now #{total_time} (+#{'%0.02f' % diff}%)\\n"
elsif total_time < lower_bound
improvement += "#{f}: was #{prev_perf}, now #{total_time} (#{'%0.02f' % diff}%)\\n"
end

result += "#{f} #{total_time}\n"
end

# Update the performance report
`echo '#{result}' > test_perf_result`

# Setup regression report
if not decrease.empty?
notif += '# Performance degradation report\n'
notif += decrease
end

# Setup improvement report
if not improvement.empty?
notif += '# Performance improvement report\n'
notif += improvement
end

# Setup no change report
if notif.empty?
notif += 'No major performance regression or improvement\n'
end

# Notify
puts `curl -H "Authorization: token ${GH_TOKEN}" -X POST -d '{"body": "#{notif}"}' "https://api.github.com/repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments"`

# Push the updated perf report
`git remote rm origin && git remote add origin https://github.com/$TRAVIS_REPO_SLUG`
`git fetch origin`
`git checkout -b $TRAVIS_PULL_REQUEST_BRANCH origin/$TRAVIS_PULL_REQUEST_BRANCH`
`git add test_perf_result`
`git commit -m 'performance report [CI SKIP]'`
`git push https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG $TRAVIS_PULL_REQUEST_BRANCH`
99 changes: 99 additions & 0 deletions test/performance/test_perf_result
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
build/bin/responses_were_addresses_spent_from_test 0.002456467
build/bin/core_get_trytes_test 0.085785117
build/bin/core_get_transactions_to_approve_test 0.059665439
build/bin/core_get_balances_test 0.030873941
build/bin/extended_send_transfer_test 15.680319028
build/bin/models_transfer_test 0.002588176
build/bin/responses_get_node_info_test 0.002171949
build/bin/utils_stop_watch_test 14.004071684
build/bin/extended_initiate_transfer_test 0.141807368
build/bin/responses_get_tips_test 0.002159716
build/bin/requests_get_inclusion_states_test 0.002015393
build/bin/responses_add_neighbors_test 0.002132093
build/bin/responses_send_transfer_test 0.002003966
build/bin/core_get_node_info_test 0.017616366
build/bin/core_were_addresses_spent_from_test 0.04987075
build/bin/extended_is_reattachable_test 3.416971671
build/bin/errors_illegal_state_test 0.002686235
build/bin/extended_get_transactions_objects_test 0.040687929
build/bin/core_interrupt_attaching_to_tangle_test 4.024298309
build/bin/models_tag_test 0.002353154
build/bin/extended_get_latest_inclusion_test 0.058948057
build/bin/responses_get_transactions_to_approve_test 0.002331315
build/bin/extended_is_promotable_test 0.037656449
build/bin/models_seed_test 0.002397977
build/bin/requests_get_neighbors_test 0.002404002
build/bin/models_neighbor_test 0.002101202
build/bin/errors_generic_test 0.002036625
build/bin/responses_get_balances_test 0.002345201
build/bin/responses_get_balances_and_format_test 0.002131655
build/bin/requests_check_consistency_test 0.002015967
build/bin/requests_get_trytes_test 0.00206097
build/bin/requests_base_test 0.001919485
build/bin/responses_get_trytes_test 0.002084823
build/bin/responses_get_transfers_test 0.00259046
build/bin/extended_send_trytes_test 4.247608671
build/bin/extended_bundles_from_addresses_test 0.35345298
build/bin/responses_check_consistency_test 0.002191813
build/bin/extended_find_transaction_objects_by_bundle_test 0.070434719
build/bin/crypto_pow_test 8.142613887
build/bin/responses_get_account_data_test 0.002348702
build/bin/requests_get_balances_test 0.002126012
build/bin/requests_add_neighbors_test 0.002242509
build/bin/core_store_transactions_test 2.060508664
build/bin/extended_get_transfers_test 0.479612405
build/bin/core_broadcast_transactions_test 2.064870315
build/bin/models_address_test 0.002733281
build/bin/core_neighbors_test 0.066695288
build/bin/requests_get_tips_test 0.002253689
build/bin/responses_get_new_addresses_test 0.002422649
build/bin/crypto_curl_test 0.010378114
build/bin/core_get_inclusions_states_test 0.06017521
build/bin/responses_find_transactions_test 0.002441357
build/bin/core_get_tips_test 0.0170293
build/bin/crypto_signing_test 0.003233936
build/bin/models_transaction_test 0.009862801
build/bin/responses_remove_neighbors_test 0.00228299
build/bin/extended_get_new_addresses_test 0.327466043
build/bin/extended_get_account_data_test 0.788572566
build/bin/responses_base_test 0.00225932
build/bin/crypto_kerl_test 0.002272389
build/bin/requests_find_transactions_test 0.002101068
build/bin/extended_prepare_transfers_test 0.585899849
build/bin/responses_get_bundle_test 0.002541778
build/bin/crypto_multi_signing_test 0.025671504
build/bin/responses_get_neighbors_test 0.002237008
build/bin/extended_get_balances_and_format_test 0.022445345
build/bin/requests_interrupt_attaching_to_tangle_test 0.002073777
build/bin/requests_store_transactions_test 0.001948038
build/bin/models_signature_test 0.002131786
build/bin/core_attach_to_tangle_test 6.222766292
build/bin/extended_get_bundle_test 0.112368381
build/bin/extended_replay_bundle_test 2.118414546
build/bin/errors_bad_request_test 0.002758657
build/bin/requests_remove_neighbors_test 0.002447474
build/bin/responses_replay_bundle_test 0.002425056
build/bin/errors_network_test 0.002456891
build/bin/requests_get_transactions_to_approve_test 0.002534273
build/bin/errors_crypto_test 0.002404992
build/bin/core_check_consistency_test 0.061121608
build/bin/requests_get_node_info_test 0.002506089
build/bin/requests_were_addresses_spent_from_test 0.002327476
build/bin/core_find_transactions_test 0.078306502
build/bin/extended_find_transactions_test 0.07082513
build/bin/crypto_keccak384_test 0.002470474
build/bin/types_trinary_test 0.00246363
build/bin/extended_get_inputs_test 0.213217608
build/bin/extended_add_remainder_test 0.318074948
build/bin/extended_find_transaction_objects_test 0.074470628
build/bin/extended_broadcast_and_store_test 4.093203872
build/bin/errors_internal_server_error_test 0.002265507
build/bin/models_bundle_test 0.030608408
build/bin/extended_traverse_bundle_test 0.096841407
build/bin/errors_unrecognized_test 0.00226116
build/bin/requests_attach_to_tangle_test 0.002190032
build/bin/errors_unauthorized_test 0.00210882
build/bin/responses_get_inclusion_states_test 0.002235962
build/bin/responses_attach_to_tangle_test 0.002253603
build/bin/requests_broadcast_transactions_test 0.002360224

0 comments on commit 36fd10a

Please sign in to comment.