diff options
-rw-r--r-- | cmake/FindLibUSB.cmake | 2 | ||||
-rw-r--r-- | contrib/depends/funcs.mk | 5 | ||||
-rw-r--r-- | contrib/depends/packages/hidapi.mk | 6 | ||||
-rw-r--r-- | contrib/depends/packages/libusb.mk | 6 | ||||
-rw-r--r-- | src/blockchain_utilities/blockchain_stats.cpp | 157 | ||||
-rw-r--r-- | src/crypto/rx-slow-hash.c | 19 |
6 files changed, 109 insertions, 86 deletions
diff --git a/cmake/FindLibUSB.cmake b/cmake/FindLibUSB.cmake index 7f8a11460..f780628f8 100644 --- a/cmake/FindLibUSB.cmake +++ b/cmake/FindLibUSB.cmake @@ -113,7 +113,7 @@ if ( LibUSB_FOUND ) if (APPLE OR LibUSB_VERSION_1.0.16 OR STATIC) if (APPLE) if(DEPENDS) - list(APPEND TEST_COMPILE_EXTRA_LIBRARIES "-framework Foundation -framework IOKit") + list(APPEND TEST_COMPILE_EXTRA_LIBRARIES "-framework Foundation -framework IOKit -framework Security") else() find_library(COREFOUNDATION CoreFoundation) find_library(IOKIT IOKit) diff --git a/contrib/depends/funcs.mk b/contrib/depends/funcs.mk index 804125990..66555aad7 100644 --- a/contrib/depends/funcs.mk +++ b/contrib/depends/funcs.mk @@ -143,8 +143,11 @@ $(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig $(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)" $(1)_build_env+=PATH="$(build_prefix)/bin:$(PATH)" $(1)_stage_env+=PATH="$(build_prefix)/bin:$(PATH)" -$(1)_autoconf=./configure --host=$($($(1)_type)_host) --disable-dependency-tracking --prefix=$($($(1)_type)_prefix) $$($(1)_config_opts) CC="$$($(1)_cc)" CXX="$$($(1)_cxx)" +$(1)_autoconf=./configure --host=$($($(1)_type)_host) --prefix=$($($(1)_type)_prefix) $$($(1)_config_opts) CC="$$($(1)_cc)" CXX="$$($(1)_cxx)" +ifneq ($(1),libusb) +$(1)_autoconf += --disable-dependency-tracking +endif ifneq ($($(1)_nm),) $(1)_autoconf += NM="$$($(1)_nm)" endif diff --git a/contrib/depends/packages/hidapi.mk b/contrib/depends/packages/hidapi.mk index 97e204f17..64935a36a 100644 --- a/contrib/depends/packages/hidapi.mk +++ b/contrib/depends/packages/hidapi.mk @@ -1,8 +1,8 @@ package=hidapi -$(package)_version=0.11.0 -$(package)_download_path=https://github.com/libusb/hidapi/archive +$(package)_version=0.13.1 +$(package)_download_path=https://github.com/libusb/hidapi/archive/refs/tags $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=391d8e52f2d6a5cf76e2b0c079cfefe25497ba1d4659131297081fc0cd744632 +$(package)_sha256_hash=476a2c9a4dc7d1fc97dd223b84338dbea3809a84caea2dcd887d9778725490e3 $(package)_linux_dependencies=libusb eudev $(package)_patches=missing_win_include.patch diff --git a/contrib/depends/packages/libusb.mk b/contrib/depends/packages/libusb.mk index 348c410a7..c1d9fe6a9 100644 --- a/contrib/depends/packages/libusb.mk +++ b/contrib/depends/packages/libusb.mk @@ -1,8 +1,8 @@ package=libusb -$(package)_version=1.0.22 -$(package)_download_path=https://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-$($(package)_version)/ +$(package)_version=1.0.26 +$(package)_download_path=https://github.com/libusb/libusb/releases/download/v$($(package)_version) $(package)_file_name=$(package)-$($(package)_version).tar.bz2 -$(package)_sha256_hash=75aeb9d59a4fdb800d329a545c2e6799f732362193b465ea198f2aa275518157 +$(package)_sha256_hash=12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5 define $(package)_preprocess_cmds autoreconf -i diff --git a/src/blockchain_utilities/blockchain_stats.cpp b/src/blockchain_utilities/blockchain_stats.cpp index 3009b5024..21040a1d8 100644 --- a/src/blockchain_utilities/blockchain_stats.cpp +++ b/src/blockchain_utilities/blockchain_stats.cpp @@ -46,6 +46,77 @@ using namespace cryptonote; static bool stop_requested = false; +static bool do_inputs, do_outputs, do_ringsize, do_hours, do_emission, do_fees, do_diff; + +static struct tm prevtm, currtm; +static uint64_t prevsz, currsz; +static uint64_t prevtxs, currtxs; +static uint64_t currblks; +static uint64_t h; +static uint64_t totins, totouts, totrings; +static boost::multiprecision::uint128_t prevemission, prevfees; +static boost::multiprecision::uint128_t emission, fees; +static boost::multiprecision::uint128_t totdiff, mindiff, maxdiff; + +#define MAX_INOUT 0xffffffff +#define MAX_RINGS 0xffffffff + +static uint32_t minins = MAX_INOUT, maxins; +static uint32_t minouts = MAX_INOUT, maxouts; +static uint32_t minrings = MAX_RINGS, maxrings; +static uint32_t io, tottxs; +static uint32_t txhr[24]; + +static void doprint() +{ + char timebuf[64]; + + strftime(timebuf, sizeof(timebuf), "%Y-%m-%d", &prevtm); + prevtm = currtm; + std::cout << timebuf << "\t" << currblks << "\t" << h << "\t" << currtxs << "\t" << prevtxs + currtxs << "\t" << currsz << "\t" << prevsz + currsz; + prevsz += currsz; + currsz = 0; + prevtxs += currtxs; + currtxs = 0; + if (!tottxs) + tottxs = 1; + if (do_emission) { + std::cout << "\t" << print_money(emission) << "\t" << print_money(prevemission + emission); + prevemission += emission; + emission = 0; + } + if (do_fees) { + std::cout << "\t" << print_money(fees) << "\t" << print_money(prevfees + fees); + prevfees += fees; + fees = 0; + } + if (do_diff) { + std::cout << "\t" << (maxdiff ? mindiff : 0) << "\t" << maxdiff << "\t" << totdiff / currblks; + mindiff = 0; maxdiff = 0; totdiff = 0; + } + if (do_inputs) { + std::cout << "\t" << (maxins ? minins : 0) << "\t" << maxins << "\t" << totins * 1.0 / tottxs; + minins = MAX_INOUT; maxins = 0; totins = 0; + } + if (do_outputs) { + std::cout << "\t" << (maxouts ? minouts : 0) << "\t" << maxouts << "\t" << totouts * 1.0 / tottxs; + minouts = MAX_INOUT; maxouts = 0; totouts = 0; + } + if (do_ringsize) { + std::cout << "\t" << (maxrings ? minrings : 0) << "\t" << maxrings << "\t" << totrings * 1.0 / tottxs; + minrings = MAX_RINGS; maxrings = 0; totrings = 0; + } + if (do_hours) { + for (int i=0; i<24; i++) { + std::cout << "\t" << txhr[i]; + txhr[i] = 0; + } + } + currblks = 0; + tottxs = 0; + std::cout << ENDL; +} + int main(int argc, char* argv[]) { TRY_ENTRY(); @@ -123,13 +194,13 @@ int main(int argc, char* argv[]) network_type net_type = opt_testnet ? TESTNET : opt_stagenet ? STAGENET : MAINNET; block_start = command_line::get_arg(vm, arg_block_start); block_stop = command_line::get_arg(vm, arg_block_stop); - bool do_inputs = command_line::get_arg(vm, arg_inputs); - bool do_outputs = command_line::get_arg(vm, arg_outputs); - bool do_ringsize = command_line::get_arg(vm, arg_ringsize); - bool do_hours = command_line::get_arg(vm, arg_hours); - bool do_emission = command_line::get_arg(vm, arg_emission); - bool do_fees = command_line::get_arg(vm, arg_fees); - bool do_diff = command_line::get_arg(vm, arg_diff); + do_inputs = command_line::get_arg(vm, arg_inputs); + do_outputs = command_line::get_arg(vm, arg_outputs); + do_ringsize = command_line::get_arg(vm, arg_ringsize); + do_hours = command_line::get_arg(vm, arg_hours); + do_emission = command_line::get_arg(vm, arg_emission); + do_fees = command_line::get_arg(vm, arg_fees); + do_diff = command_line::get_arg(vm, arg_diff); LOG_PRINT_L0("Initializing source blockchain (BlockchainDB)"); std::unique_ptr<Blockchain> core_storage; @@ -211,25 +282,7 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, '' } std::cout << ENDL; -#define MAX_INOUT 0xffffffff -#define MAX_RINGS 0xffffffff - - struct tm prevtm = {0}, currtm; - uint64_t prevsz = 0, currsz = 0; - uint64_t prevtxs = 0, currtxs = 0; - uint64_t currblks = 0; - uint64_t totins = 0, totouts = 0, totrings = 0; - boost::multiprecision::uint128_t prevemission = 0, prevfees = 0; - boost::multiprecision::uint128_t emission = 0, fees = 0; - boost::multiprecision::uint128_t totdiff = 0, mindiff = 0, maxdiff = 0; - uint32_t minins = MAX_INOUT, maxins = 0; - uint32_t minouts = MAX_INOUT, maxouts = 0; - uint32_t minrings = MAX_RINGS, maxrings = 0; - uint32_t io, tottxs = 0; - uint32_t txhr[24] = {0}; - unsigned int i; - - for (uint64_t h = block_start; h < block_stop; ++h) + for (h = block_start; h < block_stop; ++h) { cryptonote::blobdata bd = db->get_block_blob_from_height(h); cryptonote::block blk; @@ -239,7 +292,6 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, '' return 1; } time_t tt = blk.timestamp; - char timebuf[64]; epee::misc_utils::get_gmt_time(tt, currtm); if (!prevtm.tm_year) prevtm = currtm; @@ -247,54 +299,9 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, '' if (currtm.tm_mday > prevtm.tm_mday || (currtm.tm_mday == 1 && prevtm.tm_mday > 27)) { // check for timestamp fudging around month ends - if (prevtm.tm_mday == 1 && currtm.tm_mday > 27) - goto skip; - strftime(timebuf, sizeof(timebuf), "%Y-%m-%d", &prevtm); - prevtm = currtm; - std::cout << timebuf << "\t" << currblks << "\t" << h << "\t" << currtxs << "\t" << prevtxs + currtxs << "\t" << currsz << "\t" << prevsz + currsz; - prevsz += currsz; - currsz = 0; - prevtxs += currtxs; - currtxs = 0; - if (!tottxs) - tottxs = 1; - if (do_emission) { - std::cout << "\t" << print_money(emission) << "\t" << print_money(prevemission + emission); - prevemission += emission; - emission = 0; - } - if (do_fees) { - std::cout << "\t" << print_money(fees) << "\t" << print_money(prevfees + fees); - prevfees += fees; - fees = 0; - } - if (do_diff) { - std::cout << "\t" << (maxdiff ? mindiff : 0) << "\t" << maxdiff << "\t" << totdiff / currblks; - mindiff = 0; maxdiff = 0; totdiff = 0; - } - if (do_inputs) { - std::cout << "\t" << (maxins ? minins : 0) << "\t" << maxins << "\t" << totins * 1.0 / tottxs; - minins = MAX_INOUT; maxins = 0; totins = 0; - } - if (do_outputs) { - std::cout << "\t" << (maxouts ? minouts : 0) << "\t" << maxouts << "\t" << totouts * 1.0 / tottxs; - minouts = MAX_INOUT; maxouts = 0; totouts = 0; - } - if (do_ringsize) { - std::cout << "\t" << (maxrings ? minrings : 0) << "\t" << maxrings << "\t" << totrings * 1.0 / tottxs; - minrings = MAX_RINGS; maxrings = 0; totrings = 0; - } - if (do_hours) { - for (i=0; i<24; i++) { - std::cout << "\t" << txhr[i]; - txhr[i] = 0; - } - } - currblks = 0; - tottxs = 0; - std::cout << ENDL; + if (!(prevtm.tm_mday == 1 && currtm.tm_mday > 27)) + doprint(); } -skip: currsz += bd.size(); uint64_t coinbase_amount; uint64_t tx_fee_amount = 0; @@ -371,6 +378,8 @@ skip: if (stop_requested) break; } + if (currblks) + doprint(); core_storage->deinit(); return 0; diff --git a/src/crypto/rx-slow-hash.c b/src/crypto/rx-slow-hash.c index 8682daeb2..14fb56e07 100644 --- a/src/crypto/rx-slow-hash.c +++ b/src/crypto/rx-slow-hash.c @@ -43,6 +43,9 @@ #define RX_LOGCAT "randomx" +// Report large page allocation failures as debug messages +#define alloc_err_msg(x) mdebug(RX_LOGCAT, x); + static CTHR_RWLOCK_TYPE main_dataset_lock = CTHR_RWLOCK_INIT; static CTHR_RWLOCK_TYPE main_cache_lock = CTHR_RWLOCK_INIT; @@ -212,7 +215,7 @@ static void rx_alloc_dataset(randomx_flags flags, randomx_dataset** dataset, int *dataset = randomx_alloc_dataset((flags | RANDOMX_FLAG_LARGE_PAGES) & ~disabled_flags()); if (!*dataset) { - mwarning(RX_LOGCAT, "Couldn't allocate RandomX dataset using large pages"); + alloc_err_msg("Couldn't allocate RandomX dataset using large pages"); *dataset = randomx_alloc_dataset(flags & ~disabled_flags()); if (!*dataset) { merror(RX_LOGCAT, "Couldn't allocate RandomX dataset"); @@ -228,7 +231,7 @@ static void rx_alloc_cache(randomx_flags flags, randomx_cache** cache) *cache = randomx_alloc_cache((flags | RANDOMX_FLAG_LARGE_PAGES) & ~disabled_flags()); if (!*cache) { - mwarning(RX_LOGCAT, "Couldn't allocate RandomX cache using large pages"); + alloc_err_msg("Couldn't allocate RandomX cache using large pages"); *cache = randomx_alloc_cache(flags & ~disabled_flags()); if (!*cache) local_abort("Couldn't allocate RandomX cache"); } @@ -246,7 +249,11 @@ static void rx_init_full_vm(randomx_flags flags, randomx_vm** vm) *vm = randomx_create_vm((flags | RANDOMX_FLAG_LARGE_PAGES | RANDOMX_FLAG_FULL_MEM) & ~disabled_flags(), NULL, main_dataset); if (!*vm) { - mwarning(RX_LOGCAT, "Couldn't allocate RandomX full VM using large pages"); + static int shown = 0; + if (!shown) { + shown = 1; + alloc_err_msg("Couldn't allocate RandomX full VM using large pages (will print only once)"); + } *vm = randomx_create_vm((flags | RANDOMX_FLAG_FULL_MEM) & ~disabled_flags(), NULL, main_dataset); if (!*vm) { merror(RX_LOGCAT, "Couldn't allocate RandomX full VM"); @@ -269,7 +276,11 @@ static void rx_init_light_vm(randomx_flags flags, randomx_vm** vm, randomx_cache *vm = randomx_create_vm((flags | RANDOMX_FLAG_LARGE_PAGES) & ~disabled_flags(), cache, NULL); if (!*vm) { - mwarning(RX_LOGCAT, "Couldn't allocate RandomX light VM using large pages"); + static int shown = 0; + if (!shown) { + shown = 1; + alloc_err_msg("Couldn't allocate RandomX light VM using large pages (will print only once)"); + } *vm = randomx_create_vm(flags & ~disabled_flags(), cache, NULL); if (!*vm) local_abort("Couldn't allocate RandomX light VM"); } |