mirror of
https://github.com/monero-project/monero
synced 2024-11-20 11:19:22 +01:00
Merge pull request #2864
09ce03d6
move includes around to lessen overall load (moneromooo-monero)
This commit is contained in:
commit
b806d9844e
@ -27,6 +27,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "misc_log_ex.h"
|
||||
#include "string_tools.h"
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
@ -37,6 +38,8 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
#include "readline_buffer.h"
|
||||
|
@ -29,7 +29,8 @@
|
||||
#define _FILE_IO_UTILS_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
namespace epee
|
||||
{
|
||||
@ -63,7 +64,7 @@ namespace file_io_utils
|
||||
}
|
||||
|
||||
inline
|
||||
bool get_file_time(const std::string& path_to_file, OUT time_t& ft)
|
||||
bool get_file_time(const std::string& path_to_file, time_t& ft)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
ft = boost::filesystem::last_write_time(boost::filesystem::path(path_to_file), ec);
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <boost/uuid/random_generator.hpp>
|
||||
|
||||
#include "misc_os_dependent.h"
|
||||
#include "syncobj.h"
|
||||
|
||||
namespace epee
|
||||
{
|
||||
|
@ -28,26 +28,7 @@
|
||||
#ifndef _MISC_LOG_EX_H_
|
||||
#define _MISC_LOG_EX_H_
|
||||
|
||||
#include "static_initializer.h"
|
||||
#include "string_tools.h"
|
||||
#include "time_helper.h"
|
||||
#include "misc_os_dependent.h"
|
||||
|
||||
#include "syncobj.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "easylogging++.h"
|
||||
|
||||
|
@ -42,6 +42,9 @@
|
||||
#include <mach/mach.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#pragma once
|
||||
namespace epee
|
||||
{
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "http_auth.h"
|
||||
#include "to_nonconst_iterator.h"
|
||||
#include "net_parse_helpers.h"
|
||||
#include "syncobj.h"
|
||||
|
||||
//#include "shlwapi.h"
|
||||
|
||||
|
@ -38,8 +38,8 @@ namespace epee
|
||||
virtual ~i_sub_handler(){}
|
||||
|
||||
virtual bool update_in( std::string& piece_of_transfer)=0;
|
||||
virtual void stop(std::string& OUT collect_remains)=0;
|
||||
virtual bool update_and_stop(std::string& OUT collect_remains, bool& is_changed)
|
||||
virtual void stop(std::string& collect_remains)=0;
|
||||
virtual bool update_and_stop(std::string& collect_remains, bool& is_changed)
|
||||
{
|
||||
is_changed = true;
|
||||
bool res = this->update_in(collect_remains);
|
||||
@ -66,7 +66,7 @@ namespace epee
|
||||
{
|
||||
return m_powner_filter->handle_target_data(piece_of_transfer);
|
||||
}
|
||||
virtual void stop(std::string& OUT collect_remains)
|
||||
virtual void stop(std::string& collect_remains)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
#include "levin_base.h"
|
||||
#include "misc_language.h"
|
||||
#include "syncobj.h"
|
||||
#include "misc_os_dependent.h"
|
||||
|
||||
#include <random>
|
||||
#include <chrono>
|
||||
|
@ -31,23 +31,16 @@
|
||||
|
||||
//#include <Winsock2.h>
|
||||
//#include <Ws2tcpip.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/preprocessor/selection/min.hpp>
|
||||
#include <boost/lambda/bind.hpp>
|
||||
#include <boost/lambda/lambda.hpp>
|
||||
#include <boost/interprocess/detail/atomic.hpp>
|
||||
#include "net/net_utils_base.h"
|
||||
#include "misc_language.h"
|
||||
//#include "profile_tools.h"
|
||||
#include "../string_tools.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "net"
|
||||
|
@ -29,13 +29,11 @@
|
||||
#ifndef _NET_UTILS_BASE_H_
|
||||
#define _NET_UTILS_BASE_H_
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <memory>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
#include "serialization/keyvalue_serialization.h"
|
||||
#include "string_tools.h"
|
||||
#include "misc_log_ex.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
@ -45,7 +43,6 @@
|
||||
#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24))
|
||||
#endif
|
||||
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace net_utils
|
||||
@ -214,19 +211,8 @@ namespace net_utils
|
||||
inline bool operator>=(const network_address& lhs, const network_address& rhs)
|
||||
{ return !lhs.less(rhs); }
|
||||
|
||||
inline bool create_network_address(network_address &address, const std::string &string, uint16_t default_port = 0)
|
||||
{
|
||||
uint32_t ip;
|
||||
uint16_t port;
|
||||
if (epee::string_tools::parse_peer_from_string(ip, port, string))
|
||||
{
|
||||
if (default_port && !port)
|
||||
port = default_port;
|
||||
address = ipv4_network_address{ip, port};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool create_network_address(network_address &address, const std::string &string, uint16_t default_port = 0);
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
@ -309,21 +295,8 @@ namespace net_utils
|
||||
//some helpers
|
||||
|
||||
|
||||
inline
|
||||
std::string print_connection_context(const connection_context_base& ctx)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << ctx.m_remote_address.str() << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT");
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
inline
|
||||
std::string print_connection_context_short(const connection_context_base& ctx)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << ctx.m_remote_address.str() << (ctx.m_is_income ? " INC":" OUT");
|
||||
return ss.str();
|
||||
}
|
||||
std::string print_connection_context(const connection_context_base& ctx);
|
||||
std::string print_connection_context_short(const connection_context_base& ctx);
|
||||
|
||||
inline MAKE_LOGGABLE(connection_context_base, ct, os)
|
||||
{
|
||||
|
@ -28,6 +28,8 @@
|
||||
#ifndef _PROFILE_TOOLS_H_
|
||||
#define _PROFILE_TOOLS_H_
|
||||
|
||||
#include "misc_os_dependent.h"
|
||||
|
||||
namespace epee
|
||||
{
|
||||
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
#include <streambuf>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
namespace rdln
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define _REG_EXP_DEFINER_H_
|
||||
|
||||
#include <boost/interprocess/detail/atomic.hpp>
|
||||
|
||||
#include "syncobj.h"
|
||||
|
||||
namespace epee
|
||||
{
|
||||
|
@ -26,6 +26,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/contains_fwd.hpp>
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace serialization
|
||||
|
@ -25,6 +25,8 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include "parserse_base_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pragma_comp_defs.h"
|
||||
#include "misc_language.h"
|
||||
#include "portable_storage_base.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <regex>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include "misc_language.h"
|
||||
#include "portable_storage_base.h"
|
||||
@ -146,7 +146,7 @@ POP_WARNINGS
|
||||
if(std::all_of(from.begin(), from.end(), ::isdigit))
|
||||
to = boost::lexical_cast<uint64_t>(from);
|
||||
// MyMonero ISO 8061 timestamp (2017-05-06T16:27:06Z)
|
||||
else if (std::regex_match (from, std::regex("\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\dZ")))
|
||||
else if (boost::regex_match (from, boost::regex("\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\dZ")))
|
||||
{
|
||||
// Convert to unix timestamp
|
||||
std::tm tm = {};
|
||||
|
@ -35,15 +35,15 @@
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <locale>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <regex>
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include "hex.h"
|
||||
#include "span.h"
|
||||
#include "warnings.h"
|
||||
@ -350,11 +350,8 @@ POP_WARNINGS
|
||||
s = *(t_pod_type*)bin_buff.data();
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool validate_hex(uint64_t length, const std::string& str)
|
||||
{
|
||||
return std::regex_match(str, std::regex("'^[0-9abcdefABCDEF]+$'")) && str.size() == length;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool validate_hex(uint64_t length, const std::string& str);
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string get_extension(const std::string& str)
|
||||
{
|
||||
|
@ -28,7 +28,11 @@
|
||||
#ifndef _MLOG_H_
|
||||
#define _MLOG_H_
|
||||
|
||||
#include <time.h>
|
||||
#include <atomic>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "string_tools.h"
|
||||
#include "misc_log_ex.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
#include "net/net_utils_base.h"
|
||||
#include "string_tools.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <typeindex>
|
||||
@ -56,5 +57,34 @@ namespace epee { namespace net_utils
|
||||
if (typeid(*self_) != typeid(*other_self)) return false;
|
||||
return self_->is_same_host(*other_self);
|
||||
}
|
||||
|
||||
bool create_network_address(network_address &address, const std::string &string, uint16_t default_port)
|
||||
{
|
||||
uint32_t ip;
|
||||
uint16_t port;
|
||||
if (epee::string_tools::parse_peer_from_string(ip, port, string))
|
||||
{
|
||||
if (default_port && !port)
|
||||
port = default_port;
|
||||
address = ipv4_network_address{ip, port};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string print_connection_context(const connection_context_base& ctx)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << ctx.m_remote_address.str() << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT");
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string print_connection_context_short(const connection_context_base& ctx)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << ctx.m_remote_address.str() << (ctx.m_is_income ? " INC":" OUT");
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <readline/history.h>
|
||||
#include <sys/select.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
#include "string_tools.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#else
|
||||
@ -56,6 +58,16 @@ namespace string_tools
|
||||
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool validate_hex(uint64_t length, const std::string& str)
|
||||
{
|
||||
if (str.size() != length)
|
||||
return false;
|
||||
for (char c: str)
|
||||
if (!isxdigit(c))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <db_cxx.h>
|
||||
|
||||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h" // for type blobdata
|
||||
#include "cryptonote_basic/blobdatatype.h" // for type blobdata
|
||||
|
||||
#include <unordered_map>
|
||||
#include <condition_variable>
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
#include "string_tools.h"
|
||||
#include "blockchain_db.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "profile_tools.h"
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <boost/program_options.hpp>
|
||||
#include "common/command_line.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/difficulty.h"
|
||||
#include "cryptonote_basic/hardfork.h"
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <cstring> // memcpy
|
||||
#include <random>
|
||||
|
||||
#include "string_tools.h"
|
||||
#include "common/util.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "crypto/crypto.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <atomic>
|
||||
|
||||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h" // for type blobdata
|
||||
#include "cryptonote_basic/blobdatatype.h" // for type blobdata
|
||||
#include "ringct/rctTypes.h"
|
||||
#include <boost/thread/tss.hpp>
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "misc_log_ex.h"
|
||||
#include "bootstrap_file.h"
|
||||
#include "bootstrap_serialization.h"
|
||||
|
@ -31,8 +31,9 @@
|
||||
#include <boost/iostreams/stream_buffer.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
#include <boost/iostreams/device/back_inserter.hpp>
|
||||
|
||||
#include <boost/iostreams/filtering_streambuf.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
|
@ -31,8 +31,9 @@
|
||||
#include <boost/iostreams/stream_buffer.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
#include <boost/iostreams/device/back_inserter.hpp>
|
||||
|
||||
#include <boost/iostreams/filtering_streambuf.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_core/blockchain.h"
|
||||
|
@ -36,15 +36,38 @@ using namespace epee;
|
||||
|
||||
#include "common/dns_utils.h"
|
||||
#include "include_base_utils.h"
|
||||
#include "string_tools.h"
|
||||
#include "storages/portable_storage_template_helper.h" // epee json include
|
||||
#include <sstream>
|
||||
#include <random>
|
||||
#include "serialization/keyvalue_serialization.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "checkpoints"
|
||||
|
||||
namespace cryptonote
|
||||
{
|
||||
/**
|
||||
* @brief struct for loading a checkpoint from json
|
||||
*/
|
||||
struct t_hashline
|
||||
{
|
||||
uint64_t height; //!< the height of the checkpoint
|
||||
std::string hash; //!< the hash for the checkpoint
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(height)
|
||||
KV_SERIALIZE(hash)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief struct for loading many checkpoints from json
|
||||
*/
|
||||
struct t_hash_json {
|
||||
std::vector<t_hashline> hashlines; //!< the checkpoint lines from the file
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(hashlines)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
checkpoints::checkpoints()
|
||||
{
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <vector>
|
||||
#include "misc_log_ex.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "serialization/keyvalue_serialization.h"
|
||||
|
||||
#define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(add_checkpoint(h, hash), false);
|
||||
#define JSON_HASH_FILE_NAME "checkpoints.json"
|
||||
@ -187,32 +186,7 @@ namespace cryptonote
|
||||
bool load_checkpoints_from_dns(bool testnet = false);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
/**
|
||||
* @brief struct for loading a checkpoint from json
|
||||
*/
|
||||
struct t_hashline
|
||||
{
|
||||
uint64_t height; //!< the height of the checkpoint
|
||||
std::string hash; //!< the hash for the checkpoint
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(height)
|
||||
KV_SERIALIZE(hash)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief struct for loading many checkpoints from json
|
||||
*/
|
||||
struct t_hash_json {
|
||||
std::vector<t_hashline> hashlines; //!< the checkpoint lines from the file
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(hashlines)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
std::map<uint64_t, crypto::hash> m_points; //!< the checkpoints container
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <boost/archive/binary_iarchive.hpp>
|
||||
#include <boost/archive/portable_binary_oarchive.hpp>
|
||||
#include <boost/archive/portable_binary_iarchive.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
|
||||
namespace tools
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "include_base_utils.h"
|
||||
#include <random>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
using namespace epee;
|
||||
namespace bf = boost::filesystem;
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <vector>
|
||||
#include "misc_os_dependent.h"
|
||||
#include "perf_timer.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
@ -35,7 +37,8 @@ namespace tools
|
||||
{
|
||||
|
||||
el::Level performance_timer_log_level = el::Level::Debug;
|
||||
__thread std::vector<PerformanceTimer*> *performance_timers = NULL;
|
||||
|
||||
static __thread std::vector<PerformanceTimer*> *performance_timers = NULL;
|
||||
|
||||
void set_performance_timer_log_level(el::Level level)
|
||||
{
|
||||
@ -48,4 +51,38 @@ void set_performance_timer_log_level(el::Level level)
|
||||
performance_timer_log_level = level;
|
||||
}
|
||||
|
||||
PerformanceTimer::PerformanceTimer(const std::string &s, uint64_t unit, el::Level l): name(s), unit(unit), level(l), started(false)
|
||||
{
|
||||
ticks = epee::misc_utils::get_ns_count();
|
||||
if (!performance_timers)
|
||||
{
|
||||
MLOG(level, "PERF ----------");
|
||||
performance_timers = new std::vector<PerformanceTimer*>();
|
||||
}
|
||||
else
|
||||
{
|
||||
PerformanceTimer *pt = performance_timers->back();
|
||||
if (!pt->started)
|
||||
{
|
||||
MLOG(pt->level, "PERF " << std::string((performance_timers->size()-1) * 2, ' ') << " " << pt->name);
|
||||
pt->started = true;
|
||||
}
|
||||
}
|
||||
performance_timers->push_back(this);
|
||||
}
|
||||
|
||||
PerformanceTimer::~PerformanceTimer()
|
||||
{
|
||||
performance_timers->pop_back();
|
||||
ticks = epee::misc_utils::get_ns_count() - ticks;
|
||||
char s[12];
|
||||
snprintf(s, sizeof(s), "%8llu ", (unsigned long long)ticks / (1000000000 / unit));
|
||||
MLOG(level, "PERF " << s << std::string(performance_timers->size() * 2, ' ') << " " << name);
|
||||
if (performance_timers->empty())
|
||||
{
|
||||
delete performance_timers;
|
||||
performance_timers = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,44 +41,12 @@ namespace tools
|
||||
class PerformanceTimer;
|
||||
|
||||
extern el::Level performance_timer_log_level;
|
||||
extern __thread std::vector<PerformanceTimer*> *performance_timers;
|
||||
|
||||
class PerformanceTimer
|
||||
{
|
||||
public:
|
||||
PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug): name(s), unit(unit), level(l), started(false)
|
||||
{
|
||||
ticks = epee::misc_utils::get_ns_count();
|
||||
if (!performance_timers)
|
||||
{
|
||||
MLOG(level, "PERF ----------");
|
||||
performance_timers = new std::vector<PerformanceTimer*>();
|
||||
}
|
||||
else
|
||||
{
|
||||
PerformanceTimer *pt = performance_timers->back();
|
||||
if (!pt->started)
|
||||
{
|
||||
MLOG(pt->level, "PERF " << std::string((performance_timers->size()-1) * 2, ' ') << " " << pt->name);
|
||||
pt->started = true;
|
||||
}
|
||||
}
|
||||
performance_timers->push_back(this);
|
||||
}
|
||||
|
||||
~PerformanceTimer()
|
||||
{
|
||||
performance_timers->pop_back();
|
||||
ticks = epee::misc_utils::get_ns_count() - ticks;
|
||||
char s[12];
|
||||
snprintf(s, sizeof(s), "%8llu ", (unsigned long long)ticks / (1000000000 / unit));
|
||||
MLOG(level, "PERF " << s << std::string(performance_timers->size() * 2, ' ') << " " << name);
|
||||
if (performance_timers->empty())
|
||||
{
|
||||
delete performance_timers;
|
||||
performance_timers = NULL;
|
||||
}
|
||||
}
|
||||
PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug);
|
||||
~PerformanceTimer();
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
|
@ -39,6 +39,7 @@
|
||||
#ifndef STATICLIB
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "common/stack_trace.h"
|
||||
#include "misc_log_ex.h"
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "misc_log_ex.h"
|
||||
#include "util.h"
|
||||
#include "dns_utils.h"
|
||||
|
@ -54,6 +54,7 @@ using namespace epee;
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
|
@ -32,7 +32,9 @@
|
||||
using namespace epee;
|
||||
|
||||
#include <atomic>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "wipeable_string.h"
|
||||
#include "string_tools.h"
|
||||
#include "cryptonote_format_utils.h"
|
||||
#include "cryptonote_config.h"
|
||||
#include "crypto/crypto.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#pragma once
|
||||
#include "cryptonote_protocol/cryptonote_protocol_defs.h"
|
||||
#include "blobdatatype.h"
|
||||
#include "cryptonote_basic_impl.h"
|
||||
#include "account.h"
|
||||
#include "subaddress_index.h"
|
||||
|
@ -32,14 +32,17 @@
|
||||
#include <numeric>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
#include <boost/interprocess/detail/atomic.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include "misc_language.h"
|
||||
#include "include_base_utils.h"
|
||||
#include "misc_language.h"
|
||||
#include "syncobj.h"
|
||||
#include "cryptonote_basic_impl.h"
|
||||
#include "cryptonote_format_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "common/command_line.h"
|
||||
#include "string_coding.h"
|
||||
#include "string_tools.h"
|
||||
#include "storages/portable_storage_template_helper.h"
|
||||
#include "boost/logic/tribool.hpp"
|
||||
|
||||
|
@ -28,7 +28,10 @@
|
||||
//
|
||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "string_tools.h"
|
||||
using namespace epee;
|
||||
|
||||
#include <unordered_set>
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
#include <boost/interprocess/sync/file_lock.hpp>
|
||||
|
||||
#include "p2p/net_node_common.h"
|
||||
#include "cryptonote_protocol/cryptonote_protocol_handler_common.h"
|
||||
#include "storages/portable_storage_template_helper.h"
|
||||
#include "common/download.h"
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <unordered_set>
|
||||
#include "include_base_utils.h"
|
||||
#include "string_tools.h"
|
||||
using namespace epee;
|
||||
|
||||
#include "common/apply_permutation.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <boost/uuid/nil_generator.hpp>
|
||||
#include "string_tools.h"
|
||||
#include "cryptonote_protocol_defs.h"
|
||||
#include "block_queue.h"
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <list>
|
||||
#include "serialization/keyvalue_serialization.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
namespace cryptonote
|
||||
{
|
||||
|
||||
|
@ -59,7 +59,6 @@ set(daemon_private_headers
|
||||
rpc_command_executor.h
|
||||
|
||||
# cryptonote_protocol
|
||||
../cryptonote_protocol/blobdatatype.h
|
||||
../cryptonote_protocol/cryptonote_protocol_defs.h
|
||||
../cryptonote_protocol/cryptonote_protocol_handler.h
|
||||
../cryptonote_protocol/cryptonote_protocol_handler.inl
|
||||
|
@ -26,8 +26,10 @@
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "cryptonote_config.h"
|
||||
#include "version.h"
|
||||
#include "string_tools.h"
|
||||
#include "daemon/command_server.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include "misc_log_ex.h"
|
||||
#include "daemon/daemon.h"
|
||||
#include "rpc/daemon_handler.h"
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "daemon"
|
||||
|
@ -26,6 +26,7 @@
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/tx_extra.h"
|
||||
#include "cryptonote_core/blockchain.h"
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "serialization/keyvalue_serialization.h"
|
||||
#include "net/net_utils_base.h"
|
||||
#include "misc_language.h"
|
||||
#include "string_tools.h"
|
||||
#include "time_helper.h"
|
||||
#include "cryptonote_config.h"
|
||||
#ifdef ALLOW_DEBUG_COMMANDS
|
||||
#include "crypto/crypto.h"
|
||||
|
@ -28,6 +28,7 @@
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "misc_log_ex.h"
|
||||
#include "rctOps.h"
|
||||
using namespace crypto;
|
||||
|
@ -29,6 +29,7 @@
|
||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "string_tools.h"
|
||||
using namespace epee;
|
||||
|
||||
#include "core_rpc_server.h"
|
||||
|
@ -32,7 +32,7 @@
|
||||
// but including here for clarity
|
||||
#include "cryptonote_core/cryptonote_core.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
#include "ringct/rctSigs.h"
|
||||
|
||||
namespace cryptonote
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include "common/command_line.h"
|
||||
#include "common/i18n.h"
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "string_tools.h"
|
||||
#include "rapidjson/document.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "rpc/message_data_structs.h"
|
||||
|
@ -28,12 +28,15 @@
|
||||
//
|
||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#include <numeric>
|
||||
#include <random>
|
||||
#include <tuple>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include "include_base_utils.h"
|
||||
using namespace epee;
|
||||
|
||||
@ -49,7 +52,7 @@ using namespace epee;
|
||||
#include "profile_tools.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "serialization/binary_utils.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
#include "mnemonics/electrum-words.h"
|
||||
#include "common/i18n.h"
|
||||
#include "common/util.h"
|
||||
|
@ -59,8 +59,6 @@
|
||||
#include "common/password.h"
|
||||
#include "node_rpc_proxy.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2"
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "wallet/wallet_args.h"
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include "common/i18n.h"
|
||||
#include "common/util.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "string_tools.h"
|
||||
using namespace epee;
|
||||
|
||||
#include "common/command_line.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "fuzzer.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "wallet/wallet2.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "wallet/wallet2.h"
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
#include "include_base_utils.h"
|
||||
#include "string_tools.h"
|
||||
#include "common/command_line.h"
|
||||
#include "common/util.h"
|
||||
#include "fuzzer.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "wallet/wallet2.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "cryptonote_protocol/blobdatatype.h"
|
||||
#include "cryptonote_basic/blobdatatype.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "fuzzer.h"
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "string_tools.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "string_tools.h"
|
||||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "blockchain_db/lmdb/db_lmdb.h"
|
||||
#ifdef BERKELEY_DB
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "net/http_auth.h"
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/fusion/adapted/std_pair.hpp>
|
||||
#include <boost/range/algorithm/find_if.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
|
@ -30,10 +30,12 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "string_tools.h"
|
||||
#include "common/command_line.h"
|
||||
#include "common/util.h"
|
||||
#include "unit_tests_utils.h"
|
||||
|
Loading…
Reference in New Issue
Block a user