From 3676ac5841b1e433830323b3c51bf78e96947054 Mon Sep 17 00:00:00 2001 From: warptangent Date: Wed, 11 Feb 2015 15:55:53 -0800 Subject: Add profiling to block and tx processing --- src/cryptonote_core/blockchain_db.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/cryptonote_core/blockchain_db.h') diff --git a/src/cryptonote_core/blockchain_db.h b/src/cryptonote_core/blockchain_db.h index db56c7c07..531de04bd 100644 --- a/src/cryptonote_core/blockchain_db.h +++ b/src/cryptonote_core/blockchain_db.h @@ -301,12 +301,22 @@ private: // helper function to remove transaction from blockchain void remove_transaction(const crypto::hash& tx_hash); + uint64_t num_calls = 0; + uint64_t time_blk_hash = 0; + uint64_t time_add_block1 = 0; + uint64_t time_add_transaction = 0; + public: // virtual dtor virtual ~BlockchainDB() { }; + // reset profiling stats + void reset_stats(); + + // show profiling stats + void show_stats(); // open the db at location , or create it if there isn't one. virtual void open(const std::string& filename) = 0; -- cgit v1.2.3 From 8909d7d82eaf2b130b7d36fb5db7863170356b15 Mon Sep 17 00:00:00 2001 From: warptangent Date: Wed, 11 Feb 2015 15:55:53 -0800 Subject: Improve block and tx processing efficiency by less repeat hashing BlockchainLMDB::add_block() BlockchainLMDB::add_transaction_data() BlockchainDB::add_transaction() --- src/cryptonote_core/blockchain_db.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/cryptonote_core/blockchain_db.h') diff --git a/src/cryptonote_core/blockchain_db.h b/src/cryptonote_core/blockchain_db.h index 531de04bd..02620c406 100644 --- a/src/cryptonote_core/blockchain_db.h +++ b/src/cryptonote_core/blockchain_db.h @@ -265,13 +265,14 @@ private: , const size_t& block_size , const difficulty_type& cumulative_difficulty , const uint64_t& coins_generated + , const crypto::hash& blk_hash ) = 0; // tells the subclass to remove data about the top block virtual void remove_block() = 0; // tells the subclass to store the transaction and its metadata - virtual void add_transaction_data(const crypto::hash& blk_hash, const transaction& tx) = 0; + virtual void add_transaction_data(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash& tx_hash) = 0; // tells the subclass to remove data about a transaction virtual void remove_transaction_data(const crypto::hash& tx_hash, const transaction& tx) = 0; @@ -296,7 +297,7 @@ private: void pop_block(); // helper function for add_transactions, to add each individual tx - void add_transaction(const crypto::hash& blk_hash, const transaction& tx); + void add_transaction(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash* tx_hash_ptr = NULL); // helper function to remove transaction from blockchain void remove_transaction(const crypto::hash& tx_hash); -- cgit v1.2.3 From 7a66b8bbcfb3f8084141d8ffb1154a3a514a9ee5 Mon Sep 17 00:00:00 2001 From: warptangent Date: Wed, 11 Feb 2015 15:55:53 -0800 Subject: BlockchainDB: Add virtual function declarations for batch transactions --- src/cryptonote_core/blockchain_db.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/cryptonote_core/blockchain_db.h') diff --git a/src/cryptonote_core/blockchain_db.h b/src/cryptonote_core/blockchain_db.h index 02620c406..25e9781f8 100644 --- a/src/cryptonote_core/blockchain_db.h +++ b/src/cryptonote_core/blockchain_db.h @@ -347,6 +347,9 @@ public: // release db lock virtual void unlock() = 0; + virtual void batch_start() = 0; + virtual void batch_stop() = 0; + virtual void set_batch_transactions(bool) = 0; // adds a block with the given metadata to the top of the blockchain, returns the new height // NOTE: subclass implementations of this (or the functions it calls) need -- cgit v1.2.3 From 8529c0ea9aa305f097d4a2c89d581163e208e04f Mon Sep 17 00:00:00 2001 From: warptangent Date: Wed, 11 Feb 2015 15:55:53 -0800 Subject: BlockchainDB, BlockchainLMDB: Add profiling for DB commits --- src/cryptonote_core/blockchain_db.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/cryptonote_core/blockchain_db.h') diff --git a/src/cryptonote_core/blockchain_db.h b/src/cryptonote_core/blockchain_db.h index 25e9781f8..ba0e5738b 100644 --- a/src/cryptonote_core/blockchain_db.h +++ b/src/cryptonote_core/blockchain_db.h @@ -308,6 +308,11 @@ private: uint64_t time_add_transaction = 0; +protected: + + uint64_t time_commit1 = 0; + + public: // virtual dtor -- cgit v1.2.3 From 6485dacc2fcaab7eb6db63c46716ffdfa0c568c4 Mon Sep 17 00:00:00 2001 From: warptangent Date: Tue, 10 Feb 2015 20:01:02 -0800 Subject: BlockchainLMDB: Add profiling to tx_exists() --- src/cryptonote_core/blockchain_db.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/cryptonote_core/blockchain_db.h') diff --git a/src/cryptonote_core/blockchain_db.h b/src/cryptonote_core/blockchain_db.h index ba0e5738b..2a7fa8f82 100644 --- a/src/cryptonote_core/blockchain_db.h +++ b/src/cryptonote_core/blockchain_db.h @@ -310,6 +310,7 @@ private: protected: + mutable uint64_t time_tx_exists = 0; uint64_t time_commit1 = 0; -- cgit v1.2.3