1
0
Fork 0
forked from lthn/blockchain

added mixins into monitoring

This commit is contained in:
cryptozoidberg 2021-06-17 01:47:35 +02:00
parent 9a0382f1a7
commit d0932f1ea4
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
6 changed files with 58 additions and 29 deletions

View file

@ -593,6 +593,7 @@ bool handle_get_daemon_info(po::variables_map& vm)
PRINT_FIELD_NAME(res.performance_data, "", tx_append_time)
PRINT_FIELD_NAME(res.performance_data, "", tx_append_rl_wait)
PRINT_FIELD_NAME(res.performance_data, "", tx_append_is_expired)
PRINT_FIELD_NAME(res.performance_data, "", tx_mixin_count)
PRINT_FIELD_NAME(res.performance_data, "", tx_check_inputs_prefix_hash)
PRINT_FIELD_NAME(res.performance_data, "", tx_check_inputs_attachment_check)
PRINT_FIELD_NAME(res.performance_data, "", tx_check_inputs_loop)

View file

@ -3816,12 +3816,14 @@ namespace currency
const crypto::hash& m_tx_id;
const crypto::hash& m_bl_id;
const uint64_t m_bl_height;
add_transaction_input_visitor(blockchain_storage& bcs, blockchain_storage::key_images_container& m_db_spent_keys, const crypto::hash& tx_id, const crypto::hash& bl_id, const uint64_t bl_height) :
uint64_t &m_mixins_count;
add_transaction_input_visitor(blockchain_storage& bcs, blockchain_storage::key_images_container& m_db_spent_keys, const crypto::hash& tx_id, const crypto::hash& bl_id, const uint64_t bl_height, uint64_t& mixins_count) :
m_bcs(bcs),
m_db_spent_keys(m_db_spent_keys),
m_tx_id(tx_id),
m_bl_id(bl_id),
m_bl_height(bl_height)
m_bl_height(bl_height),
m_mixins_count(mixins_count)
{}
bool operator()(const txin_to_key& in) const
{
@ -3846,7 +3848,8 @@ namespace currency
return false;
}
}
if (m_mixins_count < in.key_offsets.size())
m_mixins_count = in.key_offsets.size();
return true;
}
bool operator()(const txin_htlc& in) const
@ -3896,11 +3899,11 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
process_blockchain_tx_attachments(tx, bl_height, bl_id, timestamp);
TIME_MEASURE_FINISH_PD_COND(need_to_profile, tx_process_attachment);
uint64_t mixins_count = 0;
TIME_MEASURE_START_PD(tx_process_inputs);
for(const txin_v& in : tx.vin)
{
if(!boost::apply_visitor(add_transaction_input_visitor(*this, m_db_spent_keys, tx_id, bl_id, bl_height), in))
if(!boost::apply_visitor(add_transaction_input_visitor(*this, m_db_spent_keys, tx_id, bl_id, bl_height, mixins_count), in))
{
LOG_ERROR("critical internal error: add_transaction_input_visitor failed. but key_images should be already checked");
purge_transaction_keyimages_from_blockchain(tx, false);
@ -3913,6 +3916,8 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
}
}
TIME_MEASURE_FINISH_PD_COND(need_to_profile, tx_process_inputs);
if(need_to_profile && mixins_count > 0)
m_performance_data.tx_mixin_count.push(mixins_count);
//check if there is already transaction with this hash
TIME_MEASURE_START_PD(tx_check_exist);

View file

@ -73,33 +73,35 @@ namespace currency
epee::math_helper::average<uint64_t, 5> target_calculating_calc;
//tx processing zone
epee::math_helper::average<uint64_t, 5> tx_check_inputs_time;
epee::math_helper::average<uint64_t, 5> tx_add_one_tx_time;
epee::math_helper::average<uint64_t, 5> tx_process_extra;
epee::math_helper::average<uint64_t, 5> tx_process_attachment;
epee::math_helper::average<uint64_t, 5> tx_process_inputs ;
epee::math_helper::average<uint64_t, 5> tx_push_global_index;
epee::math_helper::average<uint64_t, 5> tx_check_exist;
epee::math_helper::average<uint64_t, 5> tx_print_log;
epee::math_helper::average<uint64_t, 5> tx_prapare_append;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_time;
epee::math_helper::average<uint64_t, 1> tx_add_one_tx_time;
epee::math_helper::average<uint64_t, 1> tx_process_extra;
epee::math_helper::average<uint64_t, 1> tx_process_attachment;
epee::math_helper::average<uint64_t, 1> tx_process_inputs ;
epee::math_helper::average<uint64_t, 1> tx_push_global_index;
epee::math_helper::average<uint64_t, 1> tx_check_exist;
epee::math_helper::average<uint64_t, 1> tx_print_log;
epee::math_helper::average<uint64_t, 1> tx_prapare_append;
epee::math_helper::average<uint64_t, 5> tx_append_time;
epee::math_helper::average<uint64_t, 5> tx_append_rl_wait;
epee::math_helper::average<uint64_t, 5> tx_append_is_expired;
epee::math_helper::average<uint64_t, 1> tx_append_time;
epee::math_helper::average<uint64_t, 1> tx_append_rl_wait;
epee::math_helper::average<uint64_t, 1> tx_append_is_expired;
epee::math_helper::average<uint64_t, 5> tx_store_db;
epee::math_helper::average<uint64_t, 1> tx_store_db;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_prefix_hash;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_attachment_check;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop_kimage_check;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop_ch_in_val_sig;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop_scan_outputkeys_get_item_size;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop_scan_outputkeys_relative_to_absolute;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop_scan_outputkeys_loop;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop_scan_outputkeys_loop_get_subitem;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop_scan_outputkeys_loop_find_tx;
epee::math_helper::average<uint64_t, 5> tx_check_inputs_loop_scan_outputkeys_loop_handle_output;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_prefix_hash;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_attachment_check;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop_kimage_check;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop_ch_in_val_sig;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop_scan_outputkeys_get_item_size;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop_scan_outputkeys_relative_to_absolute;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop_scan_outputkeys_loop;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop_scan_outputkeys_loop_get_subitem;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop_scan_outputkeys_loop_find_tx;
epee::math_helper::average<uint64_t, 1> tx_check_inputs_loop_scan_outputkeys_loop_handle_output;
epee::math_helper::average<uint64_t, 1> tx_mixin_count;
//TODO: move this to suitable place or remove it all

View file

@ -210,6 +210,7 @@ namespace currency
res.performance_data.tx_append_time = pd.tx_append_time.get_avg();
res.performance_data.tx_append_rl_wait = pd.tx_append_rl_wait.get_avg();
res.performance_data.tx_append_is_expired = pd.tx_append_is_expired.get_avg();
res.performance_data.tx_mixin_count = pd.tx_mixin_count.get_avg();
res.performance_data.tx_store_db = pd.tx_store_db.get_avg();

View file

@ -500,6 +500,8 @@ namespace currency
uint64_t tx_print_log;
uint64_t tx_prapare_append;
uint64_t tx_mixin_count;
uint64_t tx_store_db;
@ -547,6 +549,7 @@ namespace currency
KV_SERIALIZE(tx_store_db)
KV_SERIALIZE(tx_print_log)
KV_SERIALIZE(tx_prapare_append)
KV_SERIALIZE(tx_mixin_count)
KV_SERIALIZE(tx_check_inputs_prefix_hash)
KV_SERIALIZE(tx_check_inputs_attachment_check)

View file

@ -0,0 +1,17 @@
#!/bin/bash
case $1 in
config)
cat <<'EOM'
graph_args --alt-autoscale
graph_title mixins
graph_vlabel mixins
graph_category daemon
mixins.label mixins
EOM
exit 0;;
esac
printf "mixins.value "
connectivity_tool --ip=127.0.0.1 --rpc-port=$ZANO_RPC_PORT --timeout=1000 --rpc-get-daemon-info --getinfo-flags-hex="0x0000000000010000" | grep tx_mixin_count | cut -d ' ' -f2