move includes around to lessen overall load

This commit is contained in:
moneromooo-monero 2017-11-25 22:25:05 +00:00
parent 38ecd0526e
commit 09ce03d612
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
73 changed files with 212 additions and 161 deletions

View file

@ -27,6 +27,7 @@
#pragma once #pragma once
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include "string_tools.h"
#include <atomic> #include <atomic>
#include <condition_variable> #include <condition_variable>
#include <functional> #include <functional>
@ -37,6 +38,8 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
#include "readline_buffer.h" #include "readline_buffer.h"

View file

@ -29,7 +29,8 @@
#define _FILE_IO_UTILS_H_ #define _FILE_IO_UTILS_H_
#include <iostream> #include <iostream>
#include <boost/filesystem.hpp> #include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
namespace epee namespace epee
{ {
@ -63,7 +64,7 @@ namespace file_io_utils
} }
inline 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; boost::system::error_code ec;
ft = boost::filesystem::last_write_time(boost::filesystem::path(path_to_file), ec); ft = boost::filesystem::last_write_time(boost::filesystem::path(path_to_file), ec);

View file

@ -37,6 +37,7 @@
#include <boost/uuid/random_generator.hpp> #include <boost/uuid/random_generator.hpp>
#include "misc_os_dependent.h" #include "misc_os_dependent.h"
#include "syncobj.h"
namespace epee namespace epee
{ {

View file

@ -28,26 +28,7 @@
#ifndef _MISC_LOG_EX_H_ #ifndef _MISC_LOG_EX_H_
#define _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 <string>
#include <time.h>
#include <boost/cstdint.hpp>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include "easylogging++.h" #include "easylogging++.h"

View file

@ -42,6 +42,9 @@
#include <mach/mach.h> #include <mach/mach.h>
#endif #endif
#include <iostream>
#include <boost/lexical_cast.hpp>
#pragma once #pragma once
namespace epee namespace epee
{ {

View file

@ -50,6 +50,7 @@
#include "http_auth.h" #include "http_auth.h"
#include "to_nonconst_iterator.h" #include "to_nonconst_iterator.h"
#include "net_parse_helpers.h" #include "net_parse_helpers.h"
#include "syncobj.h"
//#include "shlwapi.h" //#include "shlwapi.h"

View file

@ -38,8 +38,8 @@ namespace epee
virtual ~i_sub_handler(){} virtual ~i_sub_handler(){}
virtual bool update_in( std::string& piece_of_transfer)=0; virtual bool update_in( std::string& piece_of_transfer)=0;
virtual void stop(std::string& OUT collect_remains)=0; virtual void stop(std::string& collect_remains)=0;
virtual bool update_and_stop(std::string& OUT collect_remains, bool& is_changed) virtual bool update_and_stop(std::string& collect_remains, bool& is_changed)
{ {
is_changed = true; is_changed = true;
bool res = this->update_in(collect_remains); bool res = this->update_in(collect_remains);
@ -66,7 +66,7 @@ namespace epee
{ {
return m_powner_filter->handle_target_data(piece_of_transfer); 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)
{ {
} }

View file

@ -35,6 +35,8 @@
#include "levin_base.h" #include "levin_base.h"
#include "misc_language.h" #include "misc_language.h"
#include "syncobj.h"
#include "misc_os_dependent.h"
#include <random> #include <random>
#include <chrono> #include <chrono>

View file

@ -31,23 +31,16 @@
//#include <Winsock2.h> //#include <Winsock2.h>
//#include <Ws2tcpip.h> //#include <Ws2tcpip.h>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <istream>
#include <ostream>
#include <string> #include <string>
#include <boost/version.hpp> #include <boost/version.hpp>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/asio/ssl.hpp> #include <boost/asio/ssl.hpp>
#include <boost/asio/steady_timer.hpp> #include <boost/asio/steady_timer.hpp>
#include <boost/preprocessor/selection/min.hpp>
#include <boost/lambda/bind.hpp> #include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp> #include <boost/lambda/lambda.hpp>
#include <boost/interprocess/detail/atomic.hpp> #include <boost/interprocess/detail/atomic.hpp>
#include "net/net_utils_base.h" #include "net/net_utils_base.h"
#include "misc_language.h" #include "misc_language.h"
//#include "profile_tools.h"
#include "../string_tools.h"
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net" #define MONERO_DEFAULT_LOG_CATEGORY "net"

View file

@ -29,13 +29,11 @@
#ifndef _NET_UTILS_BASE_H_ #ifndef _NET_UTILS_BASE_H_
#define _NET_UTILS_BASE_H_ #define _NET_UTILS_BASE_H_
#include <boost/asio/io_service.hpp>
#include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid.hpp>
#include <memory> #include <boost/asio/io_service.hpp>
#include <typeinfo> #include <typeinfo>
#include <type_traits> #include <type_traits>
#include "serialization/keyvalue_serialization.h" #include "serialization/keyvalue_serialization.h"
#include "string_tools.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
@ -45,7 +43,6 @@
#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24)) #define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24))
#endif #endif
namespace epee namespace epee
{ {
namespace net_utils namespace net_utils
@ -214,19 +211,8 @@ namespace net_utils
inline bool operator>=(const network_address& lhs, const network_address& rhs) inline bool operator>=(const network_address& lhs, const network_address& rhs)
{ return !lhs.less(rhs); } { return !lhs.less(rhs); }
inline bool create_network_address(network_address &address, const std::string &string, uint16_t default_port = 0) 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;
}
/************************************************************************/ /************************************************************************/
/* */ /* */
/************************************************************************/ /************************************************************************/
@ -309,21 +295,8 @@ namespace net_utils
//some helpers //some helpers
inline std::string print_connection_context(const connection_context_base& ctx);
std::string print_connection_context(const connection_context_base& ctx) std::string print_connection_context_short(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();
}
inline MAKE_LOGGABLE(connection_context_base, ct, os) inline MAKE_LOGGABLE(connection_context_base, ct, os)
{ {

View file

@ -28,6 +28,8 @@
#ifndef _PROFILE_TOOLS_H_ #ifndef _PROFILE_TOOLS_H_
#define _PROFILE_TOOLS_H_ #define _PROFILE_TOOLS_H_
#include "misc_os_dependent.h"
namespace epee namespace epee
{ {

View file

@ -2,9 +2,7 @@
#include <streambuf> #include <streambuf>
#include <sstream> #include <sstream>
#include <iostream>
#include <vector> #include <vector>
#include <algorithm>
namespace rdln namespace rdln
{ {

View file

@ -29,7 +29,7 @@
#define _REG_EXP_DEFINER_H_ #define _REG_EXP_DEFINER_H_
#include <boost/interprocess/detail/atomic.hpp> #include <boost/interprocess/detail/atomic.hpp>
#include "syncobj.h"
namespace epee namespace epee
{ {

View file

@ -26,6 +26,13 @@
#pragma once #pragma once
#include <set>
#include <list>
#include <vector>
#include <deque>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/contains_fwd.hpp>
namespace epee namespace epee
{ {
namespace serialization namespace serialization

View file

@ -25,6 +25,8 @@
// //
#pragma once #pragma once
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "parserse_base_utils.h" #include "parserse_base_utils.h"
#include "file_io_utils.h" #include "file_io_utils.h"

View file

@ -28,6 +28,7 @@
#pragma once #pragma once
#include "pragma_comp_defs.h"
#include "misc_language.h" #include "misc_language.h"
#include "portable_storage_base.h" #include "portable_storage_base.h"

View file

@ -28,7 +28,7 @@
#pragma once #pragma once
#include <regex> #include <boost/regex.hpp>
#include "misc_language.h" #include "misc_language.h"
#include "portable_storage_base.h" #include "portable_storage_base.h"
@ -146,7 +146,7 @@ POP_WARNINGS
if(std::all_of(from.begin(), from.end(), ::isdigit)) if(std::all_of(from.begin(), from.end(), ::isdigit))
to = boost::lexical_cast<uint64_t>(from); to = boost::lexical_cast<uint64_t>(from);
// MyMonero ISO 8061 timestamp (2017-05-06T16:27:06Z) // 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 // Convert to unix timestamp
std::tm tm = {}; std::tm tm = {};

View file

@ -35,15 +35,15 @@
# include <windows.h> # include <windows.h>
#endif #endif
#include <string.h>
#include <locale> #include <locale>
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <regex>
#include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp> #include <boost/uuid/uuid_io.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string/predicate.hpp>
#include "hex.h" #include "hex.h"
#include "span.h" #include "span.h"
#include "warnings.h" #include "warnings.h"
@ -350,11 +350,8 @@ POP_WARNINGS
s = *(t_pod_type*)bin_buff.data(); s = *(t_pod_type*)bin_buff.data();
return true; return true;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline bool validate_hex(uint64_t length, const std::string& str) bool validate_hex(uint64_t length, const std::string& str);
{
return std::regex_match(str, std::regex("'^[0-9abcdefABCDEF]+$'")) && str.size() == length;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline std::string get_extension(const std::string& str) inline std::string get_extension(const std::string& str)
{ {

View file

@ -28,7 +28,11 @@
#ifndef _MLOG_H_ #ifndef _MLOG_H_
#define _MLOG_H_ #define _MLOG_H_
#include <time.h>
#include <atomic> #include <atomic>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include "string_tools.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY

View file

@ -1,5 +1,6 @@
#include "net/net_utils_base.h" #include "net/net_utils_base.h"
#include "string_tools.h"
#include <cstring> #include <cstring>
#include <typeindex> #include <typeindex>
@ -56,5 +57,34 @@ namespace epee { namespace net_utils
if (typeid(*self_) != typeid(*other_self)) return false; if (typeid(*self_) != typeid(*other_self)) return false;
return self_->is_same_host(*other_self); 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();
}
}} }}

View file

@ -3,6 +3,7 @@
#include <readline/history.h> #include <readline/history.h>
#include <sys/select.h> #include <sys/select.h>
#include <unistd.h> #include <unistd.h>
#include <iostream>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>

View file

@ -26,6 +26,8 @@
#include "string_tools.h" #include "string_tools.h"
#include <ctype.h>
#ifdef _WIN32 #ifdef _WIN32
# include <winsock2.h> # include <winsock2.h>
#else #else
@ -56,6 +58,16 @@ namespace string_tools
return true; 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;
}
} }
} }

View file

@ -28,7 +28,7 @@
#include <db_cxx.h> #include <db_cxx.h>
#include "blockchain_db/blockchain_db.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 <unordered_map>
#include <condition_variable> #include <condition_variable>

View file

@ -28,6 +28,7 @@
#include <boost/range/adaptor/reversed.hpp> #include <boost/range/adaptor/reversed.hpp>
#include "string_tools.h"
#include "blockchain_db.h" #include "blockchain_db.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "profile_tools.h" #include "profile_tools.h"

View file

@ -36,7 +36,7 @@
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include "common/command_line.h" #include "common/command_line.h"
#include "crypto/hash.h" #include "crypto/hash.h"
#include "cryptonote_protocol/blobdatatype.h" #include "cryptonote_basic/blobdatatype.h"
#include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_basic/difficulty.h" #include "cryptonote_basic/difficulty.h"
#include "cryptonote_basic/hardfork.h" #include "cryptonote_basic/hardfork.h"

View file

@ -34,6 +34,7 @@
#include <cstring> // memcpy #include <cstring> // memcpy
#include <random> #include <random>
#include "string_tools.h"
#include "common/util.h" #include "common/util.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "crypto/crypto.h" #include "crypto/crypto.h"

View file

@ -29,7 +29,7 @@
#include <atomic> #include <atomic>
#include "blockchain_db/blockchain_db.h" #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 "ringct/rctTypes.h"
#include <boost/thread/tss.hpp> #include <boost/thread/tss.hpp>

View file

@ -32,6 +32,7 @@
#include <fstream> #include <fstream>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include "bootstrap_file.h" #include "bootstrap_file.h"
#include "bootstrap_serialization.h" #include "bootstrap_serialization.h"

View file

@ -31,8 +31,9 @@
#include <boost/iostreams/stream_buffer.hpp> #include <boost/iostreams/stream_buffer.hpp>
#include <boost/iostreams/stream.hpp> #include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/back_inserter.hpp> #include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/filtering_streambuf.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_basic.h"
#include "cryptonote_basic/cryptonote_boost_serialization.h" #include "cryptonote_basic/cryptonote_boost_serialization.h"

View file

@ -31,8 +31,9 @@
#include <boost/iostreams/stream_buffer.hpp> #include <boost/iostreams/stream_buffer.hpp>
#include <boost/iostreams/stream.hpp> #include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/back_inserter.hpp> #include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/filtering_streambuf.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_basic.h"
#include "cryptonote_core/blockchain.h" #include "cryptonote_core/blockchain.h"

View file

@ -36,15 +36,38 @@ using namespace epee;
#include "common/dns_utils.h" #include "common/dns_utils.h"
#include "include_base_utils.h" #include "include_base_utils.h"
#include "string_tools.h"
#include "storages/portable_storage_template_helper.h" // epee json include #include "storages/portable_storage_template_helper.h" // epee json include
#include <sstream> #include "serialization/keyvalue_serialization.h"
#include <random>
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "checkpoints" #define MONERO_DEFAULT_LOG_CATEGORY "checkpoints"
namespace cryptonote 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() checkpoints::checkpoints()
{ {

View file

@ -33,7 +33,6 @@
#include <vector> #include <vector>
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include "crypto/hash.h" #include "crypto/hash.h"
#include "serialization/keyvalue_serialization.h"
#define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(add_checkpoint(h, hash), false); #define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(add_checkpoint(h, hash), false);
#define JSON_HASH_FILE_NAME "checkpoints.json" #define JSON_HASH_FILE_NAME "checkpoints.json"
@ -187,32 +186,7 @@ namespace cryptonote
bool load_checkpoints_from_dns(bool testnet = false); bool load_checkpoints_from_dns(bool testnet = false);
private: 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 std::map<uint64_t, crypto::hash> m_points; //!< the checkpoints container
}; };
} }

View file

@ -33,6 +33,7 @@
#include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/portable_binary_oarchive.hpp> #include <boost/archive/portable_binary_oarchive.hpp>
#include <boost/archive/portable_binary_iarchive.hpp> #include <boost/archive/portable_binary_iarchive.hpp>
#include <boost/filesystem/operations.hpp>
namespace tools namespace tools

View file

@ -34,6 +34,8 @@
#include "include_base_utils.h" #include "include_base_utils.h"
#include <random> #include <random>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
using namespace epee; using namespace epee;
namespace bf = boost::filesystem; namespace bf = boost::filesystem;

View file

@ -26,6 +26,8 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // 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" #include "perf_timer.h"
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
@ -35,7 +37,8 @@ namespace tools
{ {
el::Level performance_timer_log_level = el::Level::Debug; 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) 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; 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;
}
}
} }

View file

@ -41,44 +41,12 @@ namespace tools
class PerformanceTimer; class PerformanceTimer;
extern el::Level performance_timer_log_level; extern el::Level performance_timer_log_level;
extern __thread std::vector<PerformanceTimer*> *performance_timers;
class PerformanceTimer class PerformanceTimer
{ {
public: public:
PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug): name(s), unit(unit), level(l), started(false) PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug);
{ ~PerformanceTimer();
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;
}
}
private: private:
std::string name; std::string name;

View file

@ -39,6 +39,7 @@
#ifndef STATICLIB #ifndef STATICLIB
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
#include <boost/algorithm/string.hpp>
#include "common/stack_trace.h" #include "common/stack_trace.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"

View file

@ -26,6 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // 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 "misc_log_ex.h"
#include "util.h" #include "util.h"
#include "dns_utils.h" #include "dns_utils.h"

View file

@ -54,6 +54,7 @@ using namespace epee;
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <openssl/sha.h> #include <openssl/sha.h>

View file

@ -32,7 +32,9 @@
using namespace epee; using namespace epee;
#include <atomic> #include <atomic>
#include <boost/algorithm/string.hpp>
#include "wipeable_string.h" #include "wipeable_string.h"
#include "string_tools.h"
#include "cryptonote_format_utils.h" #include "cryptonote_format_utils.h"
#include "cryptonote_config.h" #include "cryptonote_config.h"
#include "crypto/crypto.h" #include "crypto/crypto.h"

View file

@ -29,7 +29,7 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once #pragma once
#include "cryptonote_protocol/cryptonote_protocol_defs.h" #include "blobdatatype.h"
#include "cryptonote_basic_impl.h" #include "cryptonote_basic_impl.h"
#include "account.h" #include "account.h"
#include "subaddress_index.h" #include "subaddress_index.h"

View file

@ -32,14 +32,17 @@
#include <numeric> #include <numeric>
#include <boost/utility/value_init.hpp> #include <boost/utility/value_init.hpp>
#include <boost/interprocess/detail/atomic.hpp> #include <boost/interprocess/detail/atomic.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/limits.hpp> #include <boost/limits.hpp>
#include "misc_language.h"
#include "include_base_utils.h" #include "include_base_utils.h"
#include "misc_language.h"
#include "syncobj.h"
#include "cryptonote_basic_impl.h" #include "cryptonote_basic_impl.h"
#include "cryptonote_format_utils.h" #include "cryptonote_format_utils.h"
#include "file_io_utils.h" #include "file_io_utils.h"
#include "common/command_line.h" #include "common/command_line.h"
#include "string_coding.h" #include "string_coding.h"
#include "string_tools.h"
#include "storages/portable_storage_template_helper.h" #include "storages/portable_storage_template_helper.h"
#include "boost/logic/tribool.hpp" #include "boost/logic/tribool.hpp"

View file

@ -28,7 +28,10 @@
// //
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include <boost/algorithm/string.hpp>
#include "include_base_utils.h" #include "include_base_utils.h"
#include "string_tools.h"
using namespace epee; using namespace epee;
#include <unordered_set> #include <unordered_set>

View file

@ -36,7 +36,6 @@
#include <boost/program_options/variables_map.hpp> #include <boost/program_options/variables_map.hpp>
#include <boost/interprocess/sync/file_lock.hpp> #include <boost/interprocess/sync/file_lock.hpp>
#include "p2p/net_node_common.h"
#include "cryptonote_protocol/cryptonote_protocol_handler_common.h" #include "cryptonote_protocol/cryptonote_protocol_handler_common.h"
#include "storages/portable_storage_template_helper.h" #include "storages/portable_storage_template_helper.h"
#include "common/download.h" #include "common/download.h"

View file

@ -30,6 +30,7 @@
#include <unordered_set> #include <unordered_set>
#include "include_base_utils.h" #include "include_base_utils.h"
#include "string_tools.h"
using namespace epee; using namespace epee;
#include "common/apply_permutation.h" #include "common/apply_permutation.h"

View file

@ -31,6 +31,7 @@
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
#include <boost/uuid/nil_generator.hpp> #include <boost/uuid/nil_generator.hpp>
#include "string_tools.h"
#include "cryptonote_protocol_defs.h" #include "cryptonote_protocol_defs.h"
#include "block_queue.h" #include "block_queue.h"

View file

@ -33,7 +33,7 @@
#include <list> #include <list>
#include "serialization/keyvalue_serialization.h" #include "serialization/keyvalue_serialization.h"
#include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_protocol/blobdatatype.h" #include "cryptonote_basic/blobdatatype.h"
namespace cryptonote namespace cryptonote
{ {

View file

@ -59,7 +59,6 @@ set(daemon_private_headers
rpc_command_executor.h rpc_command_executor.h
# cryptonote_protocol # cryptonote_protocol
../cryptonote_protocol/blobdatatype.h
../cryptonote_protocol/cryptonote_protocol_defs.h ../cryptonote_protocol/cryptonote_protocol_defs.h
../cryptonote_protocol/cryptonote_protocol_handler.h ../cryptonote_protocol/cryptonote_protocol_handler.h
../cryptonote_protocol/cryptonote_protocol_handler.inl ../cryptonote_protocol/cryptonote_protocol_handler.inl

View file

@ -26,8 +26,10 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/algorithm/string.hpp>
#include "cryptonote_config.h" #include "cryptonote_config.h"
#include "version.h" #include "version.h"
#include "string_tools.h"
#include "daemon/command_server.h" #include "daemon/command_server.h"
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY

View file

@ -30,6 +30,7 @@
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>
#include <boost/algorithm/string/split.hpp>
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include "daemon/daemon.h" #include "daemon/daemon.h"
#include "rpc/daemon_handler.h" #include "rpc/daemon_handler.h"

View file

@ -32,7 +32,6 @@
#include <boost/program_options/options_description.hpp> #include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp> #include <boost/program_options/variables_map.hpp>
#include <string> #include <string>
#include <vector>
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "daemon" #define MONERO_DEFAULT_LOG_CATEGORY "daemon"

View file

@ -26,6 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // 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/cryptonote_basic.h"
#include "cryptonote_basic/tx_extra.h" #include "cryptonote_basic/tx_extra.h"
#include "cryptonote_core/blockchain.h" #include "cryptonote_core/blockchain.h"

View file

@ -34,6 +34,8 @@
#include "serialization/keyvalue_serialization.h" #include "serialization/keyvalue_serialization.h"
#include "net/net_utils_base.h" #include "net/net_utils_base.h"
#include "misc_language.h" #include "misc_language.h"
#include "string_tools.h"
#include "time_helper.h"
#include "cryptonote_config.h" #include "cryptonote_config.h"
#ifdef ALLOW_DEBUG_COMMANDS #ifdef ALLOW_DEBUG_COMMANDS
#include "crypto/crypto.h" #include "crypto/crypto.h"

View file

@ -28,6 +28,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // 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 "misc_log_ex.h"
#include "rctOps.h" #include "rctOps.h"
using namespace crypto; using namespace crypto;

View file

@ -29,6 +29,7 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include "include_base_utils.h" #include "include_base_utils.h"
#include "string_tools.h"
using namespace epee; using namespace epee;
#include "core_rpc_server.h" #include "core_rpc_server.h"

View file

@ -32,7 +32,7 @@
// but including here for clarity // but including here for clarity
#include "cryptonote_core/cryptonote_core.h" #include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_protocol/blobdatatype.h" #include "cryptonote_basic/blobdatatype.h"
#include "ringct/rctSigs.h" #include "ringct/rctSigs.h"
namespace cryptonote namespace cryptonote

View file

@ -30,6 +30,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/asio/ip/address.hpp> #include <boost/asio/ip/address.hpp>
#include <boost/bind.hpp>
#include "common/command_line.h" #include "common/command_line.h"
#include "common/i18n.h" #include "common/i18n.h"

View file

@ -28,6 +28,7 @@
#pragma once #pragma once
#include "string_tools.h"
#include "rapidjson/document.h" #include "rapidjson/document.h"
#include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_basic.h"
#include "rpc/message_data_structs.h" #include "rpc/message_data_structs.h"

View file

@ -28,12 +28,15 @@
// //
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include <numeric>
#include <random> #include <random>
#include <tuple> #include <tuple>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/optional/optional.hpp> #include <boost/optional/optional.hpp>
#include <boost/utility/value_init.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" #include "include_base_utils.h"
using namespace epee; using namespace epee;
@ -49,7 +52,7 @@ using namespace epee;
#include "profile_tools.h" #include "profile_tools.h"
#include "crypto/crypto.h" #include "crypto/crypto.h"
#include "serialization/binary_utils.h" #include "serialization/binary_utils.h"
#include "cryptonote_protocol/blobdatatype.h" #include "cryptonote_basic/blobdatatype.h"
#include "mnemonics/electrum-words.h" #include "mnemonics/electrum-words.h"
#include "common/i18n.h" #include "common/i18n.h"
#include "common/util.h" #include "common/util.h"

View file

@ -59,8 +59,6 @@
#include "common/password.h" #include "common/password.h"
#include "node_rpc_proxy.h" #include "node_rpc_proxy.h"
#include <iostream>
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2" #define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2"

View file

@ -28,6 +28,7 @@
#include "wallet/wallet_args.h" #include "wallet/wallet_args.h"
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include "common/i18n.h" #include "common/i18n.h"
#include "common/util.h" #include "common/util.h"

View file

@ -31,6 +31,7 @@
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include "include_base_utils.h" #include "include_base_utils.h"
#include "string_tools.h"
using namespace epee; using namespace epee;
#include "common/command_line.h" #include "common/command_line.h"

View file

@ -28,7 +28,7 @@
#include "include_base_utils.h" #include "include_base_utils.h"
#include "file_io_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_basic.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "fuzzer.h" #include "fuzzer.h"

View file

@ -28,7 +28,7 @@
#include "include_base_utils.h" #include "include_base_utils.h"
#include "file_io_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_basic.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "wallet/wallet2.h" #include "wallet/wallet2.h"

View file

@ -28,7 +28,7 @@
#include "include_base_utils.h" #include "include_base_utils.h"
#include "file_io_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_basic.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "wallet/wallet2.h" #include "wallet/wallet2.h"

View file

@ -28,6 +28,7 @@
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include "include_base_utils.h" #include "include_base_utils.h"
#include "string_tools.h"
#include "common/command_line.h" #include "common/command_line.h"
#include "common/util.h" #include "common/util.h"
#include "fuzzer.h" #include "fuzzer.h"

View file

@ -28,7 +28,7 @@
#include "include_base_utils.h" #include "include_base_utils.h"
#include "file_io_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_basic.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "wallet/wallet2.h" #include "wallet/wallet2.h"

View file

@ -28,7 +28,7 @@
#include "include_base_utils.h" #include "include_base_utils.h"
#include "file_io_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_basic.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "fuzzer.h" #include "fuzzer.h"

View file

@ -30,6 +30,7 @@
#pragma once #pragma once
#include "string_tools.h"
#include "crypto/crypto.h" #include "crypto/crypto.h"
#include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_basic.h"

View file

@ -35,6 +35,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "string_tools.h"
#include "blockchain_db/blockchain_db.h" #include "blockchain_db/blockchain_db.h"
#include "blockchain_db/lmdb/db_lmdb.h" #include "blockchain_db/lmdb/db_lmdb.h"
#ifdef BERKELEY_DB #ifdef BERKELEY_DB

View file

@ -30,6 +30,7 @@
#include "net/http_auth.h" #include "net/http_auth.h"
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/fusion/adapted/std_pair.hpp> #include <boost/fusion/adapted/std_pair.hpp>
#include <boost/range/algorithm/find_if.hpp> #include <boost/range/algorithm/find_if.hpp>
#include <boost/range/iterator_range_core.hpp> #include <boost/range/iterator_range_core.hpp>

View file

@ -30,10 +30,12 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include <boost/filesystem.hpp> #include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include "include_base_utils.h" #include "include_base_utils.h"
#include "string_tools.h"
#include "common/command_line.h" #include "common/command_line.h"
#include "common/util.h" #include "common/util.h"
#include "unit_tests_utils.h" #include "unit_tests_utils.h"