Apple M1 compatibility (#16346)
Co-authored-by: Christian Drappi <christiandrappi@Christians-MacBook-Pro.local>
This commit is contained in:
72
Cargo.lock
generated
72
Cargo.lock
generated
@ -300,9 +300,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "blake3"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce4f9586c9a3151c4b49b19e82ba163dd073614dd057e53c969e1a4db5b52720"
|
||||
checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec",
|
||||
@ -528,12 +528,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.49"
|
||||
version = "1.0.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e450b8da92aa6f274e7c6437692f9f2ce6d701fb73bacfcf87897b3f89a4c20e"
|
||||
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1932,38 +1931,6 @@ version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
|
||||
|
||||
[[package]]
|
||||
name = "jemalloc-ctl"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c502a5ff9dd2924f1ed32ba96e3b65735d837b4bfd978d3161b1702e66aca4b7"
|
||||
dependencies = [
|
||||
"jemalloc-sys",
|
||||
"libc",
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jemalloc-sys"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"fs_extra",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jemallocator"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
|
||||
dependencies = [
|
||||
"jemalloc-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.21"
|
||||
@ -2776,28 +2743,6 @@ dependencies = [
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d508492eeb1e5c38ee696371bf7b9fc33c83d46a7d451606b96458fbbbdc2dec"
|
||||
dependencies = [
|
||||
"paste-impl",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste-impl"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84f328a6a63192b333fce5fbb4be79db6758a4d518dfac6d54412f1492f72d32"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.3.0"
|
||||
@ -3434,13 +3379,13 @@ checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1"
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.16.12"
|
||||
version = "0.16.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c"
|
||||
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"spin",
|
||||
"untrusted",
|
||||
"web-sys",
|
||||
@ -4377,6 +4322,7 @@ dependencies = [
|
||||
"rand_chacha 0.2.2",
|
||||
"regex-syntax",
|
||||
"reqwest",
|
||||
"ring",
|
||||
"serde",
|
||||
"syn 0.15.44",
|
||||
"syn 1.0.60",
|
||||
@ -4772,8 +4718,6 @@ dependencies = [
|
||||
name = "solana-measure"
|
||||
version = "1.7.0"
|
||||
dependencies = [
|
||||
"jemalloc-ctl",
|
||||
"jemallocator",
|
||||
"log 0.4.11",
|
||||
"solana-metrics",
|
||||
"solana-sdk",
|
||||
|
@ -32,6 +32,12 @@ $ sudo apt-get update
|
||||
$ sudo apt-get install libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang make
|
||||
```
|
||||
|
||||
On Mac M1s, make sure you set up your terminal & homebrew [to use](https://5balloons.info/correct-way-to-install-and-use-homebrew-on-m1-macs/) Rosetta. You can install it with:
|
||||
|
||||
```bash
|
||||
$ softwareupdate --install-rosetta
|
||||
```
|
||||
|
||||
## **2. Download the source code.**
|
||||
|
||||
```bash
|
||||
|
@ -15,7 +15,7 @@ use solana_ledger::{
|
||||
blockstore::Blockstore, blockstore_processor::TransactionStatusSender,
|
||||
entry::hash_transactions, leader_schedule_cache::LeaderScheduleCache,
|
||||
};
|
||||
use solana_measure::{measure::Measure, thread_mem_usage};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_info};
|
||||
use solana_perf::{
|
||||
cuda_runtime::PinnedVec,
|
||||
@ -224,7 +224,6 @@ impl BankingStage {
|
||||
Builder::new()
|
||||
.name("solana-banking-stage-tx".to_string())
|
||||
.spawn(move || {
|
||||
thread_mem_usage::datapoint("solana-banking-stage-tx");
|
||||
Self::process_loop(
|
||||
my_pubkey,
|
||||
&verified_receiver,
|
||||
|
@ -40,7 +40,6 @@ use rayon::prelude::*;
|
||||
use rayon::{ThreadPool, ThreadPoolBuilder};
|
||||
use serde::ser::Serialize;
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_measure::thread_mem_usage;
|
||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_error};
|
||||
use solana_net_utils::{
|
||||
bind_common, bind_common_in_range, bind_in_range, find_available_port_in_range,
|
||||
@ -1938,7 +1937,6 @@ impl ClusterInfo {
|
||||
let mut generate_pull_requests = true;
|
||||
loop {
|
||||
let start = timestamp();
|
||||
thread_mem_usage::datapoint("solana-gossip");
|
||||
if self.contact_debug_interval != 0
|
||||
&& start - last_contact_info_trace > self.contact_debug_interval
|
||||
{
|
||||
@ -3215,7 +3213,6 @@ impl ClusterInfo {
|
||||
_ => error!("gossip run_listen failed: {}", err),
|
||||
}
|
||||
}
|
||||
thread_mem_usage::datapoint("solana-listen");
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
|
@ -3,7 +3,6 @@
|
||||
use crate::banking_stage::HOLD_TRANSACTIONS_SLOT_OFFSET;
|
||||
use crate::poh_recorder::PohRecorder;
|
||||
use crate::result::{Error, Result};
|
||||
use solana_measure::thread_mem_usage;
|
||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_info};
|
||||
use solana_perf::packet::PacketsRecycler;
|
||||
use solana_perf::recycler::Recycler;
|
||||
@ -140,7 +139,6 @@ impl FetchStage {
|
||||
let fwd_thread_hdl = Builder::new()
|
||||
.name("solana-fetch-stage-fwd-rcvr".to_string())
|
||||
.spawn(move || loop {
|
||||
thread_mem_usage::datapoint("solana-fetch-stage-fwd-rcvr");
|
||||
if let Err(e) =
|
||||
Self::handle_forwarded_packets(&forward_receiver, &sender, &poh_recorder)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ use solana_ledger::{
|
||||
entry::VerifyRecyclers,
|
||||
leader_schedule_cache::LeaderScheduleCache,
|
||||
};
|
||||
use solana_measure::{measure::Measure, thread_mem_usage};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_metrics::inc_new_counter_info;
|
||||
use solana_runtime::{
|
||||
accounts_background_service::AbsRequestSender, bank::Bank, bank_forks::BankForks,
|
||||
@ -319,15 +319,11 @@ impl ReplayStage {
|
||||
let mut voted_signatures = Vec::new();
|
||||
let mut has_new_vote_been_rooted = !wait_for_vote_to_start_leader;
|
||||
loop {
|
||||
let allocated = thread_mem_usage::Allocatedp::default();
|
||||
|
||||
thread_mem_usage::datapoint("solana-replay-stage");
|
||||
// Stop getting entries if we get exit signal
|
||||
if exit.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
|
||||
let start = allocated.get();
|
||||
let mut generate_new_bank_forks_time =
|
||||
Measure::start("generate_new_bank_forks_time");
|
||||
Self::generate_new_bank_forks(
|
||||
@ -338,11 +334,9 @@ impl ReplayStage {
|
||||
&mut progress,
|
||||
);
|
||||
generate_new_bank_forks_time.stop();
|
||||
Self::report_memory(&allocated, "generate_new_bank_forks", start);
|
||||
|
||||
let mut tpu_has_bank = poh_recorder.lock().unwrap().has_bank();
|
||||
|
||||
let start = allocated.get();
|
||||
let mut replay_active_banks_time = Measure::start("replay_active_banks_time");
|
||||
let ancestors = bank_forks.read().unwrap().ancestors();
|
||||
let descendants = bank_forks.read().unwrap().descendants().clone();
|
||||
@ -364,11 +358,8 @@ impl ReplayStage {
|
||||
&descendants,
|
||||
);
|
||||
replay_active_banks_time.stop();
|
||||
Self::report_memory(&allocated, "replay_active_banks", start);
|
||||
|
||||
let forks_root = bank_forks.read().unwrap().root();
|
||||
let start = allocated.get();
|
||||
|
||||
// Reset any duplicate slots that have been confirmed
|
||||
// by the network in anticipation of the confirmed version of
|
||||
// the slot
|
||||
@ -455,7 +446,6 @@ impl ReplayStage {
|
||||
.select_forks(&frozen_banks, &tower, &progress, &ancestors, &bank_forks);
|
||||
select_forks_time.stop();
|
||||
|
||||
Self::report_memory(&allocated, "select_fork", start);
|
||||
|
||||
let mut select_vote_and_reset_forks_time =
|
||||
Measure::start("select_vote_and_reset_forks");
|
||||
@ -493,8 +483,6 @@ impl ReplayStage {
|
||||
}
|
||||
heaviest_fork_failures_time.stop();
|
||||
|
||||
let start = allocated.get();
|
||||
|
||||
let mut voting_time = Measure::start("voting_time");
|
||||
// Vote on a fork
|
||||
if let Some((ref vote_bank, ref switch_fork_decision)) = vote_bank {
|
||||
@ -535,9 +523,6 @@ impl ReplayStage {
|
||||
};
|
||||
voting_time.stop();
|
||||
|
||||
Self::report_memory(&allocated, "votable_bank", start);
|
||||
let start = allocated.get();
|
||||
|
||||
let mut reset_bank_time = Measure::start("reset_bank");
|
||||
// Reset onto a fork
|
||||
if let Some(reset_bank) = reset_bank {
|
||||
@ -605,12 +590,9 @@ impl ReplayStage {
|
||||
}
|
||||
}
|
||||
}
|
||||
Self::report_memory(&allocated, "reset_bank", start);
|
||||
}
|
||||
reset_bank_time.stop();
|
||||
Self::report_memory(&allocated, "reset_bank", start);
|
||||
|
||||
let start = allocated.get();
|
||||
let mut start_leader_time = Measure::start("start_leader_time");
|
||||
if !tpu_has_bank {
|
||||
Self::maybe_start_leader(
|
||||
@ -636,7 +618,6 @@ impl ReplayStage {
|
||||
}
|
||||
}
|
||||
start_leader_time.stop();
|
||||
Self::report_memory(&allocated, "start_leader", start);
|
||||
|
||||
let mut wait_receive_time = Measure::start("wait_receive_time");
|
||||
if !did_complete_bank {
|
||||
@ -749,17 +730,6 @@ impl ReplayStage {
|
||||
(progress, heaviest_subtree_fork_choice)
|
||||
}
|
||||
|
||||
fn report_memory(
|
||||
allocated: &solana_measure::thread_mem_usage::Allocatedp,
|
||||
name: &'static str,
|
||||
start: u64,
|
||||
) {
|
||||
datapoint_debug!(
|
||||
"replay_stage-memory",
|
||||
(name, (allocated.get() - start) as i64, i64),
|
||||
);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn reset_duplicate_slots(
|
||||
duplicate_slots_reset_receiver: &DuplicateSlotsResetReceiver,
|
||||
|
@ -11,8 +11,7 @@ use bincode::serialize;
|
||||
use rand::distributions::{Distribution, WeightedIndex};
|
||||
use solana_ledger::{blockstore::Blockstore, shred::Nonce};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_measure::thread_mem_usage;
|
||||
use solana_metrics::{datapoint_debug, inc_new_counter_debug};
|
||||
use solana_metrics::inc_new_counter_debug;
|
||||
use solana_perf::packet::{limited_deserialize, Packets, PacketsRecycler};
|
||||
use solana_sdk::{
|
||||
clock::Slot,
|
||||
@ -307,7 +306,6 @@ impl ServeRepair {
|
||||
Self::report_reset_stats(&me, &mut stats);
|
||||
last_print = Instant::now();
|
||||
}
|
||||
thread_mem_usage::datapoint("solana-repair-listen");
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
@ -322,9 +320,7 @@ impl ServeRepair {
|
||||
stats: &mut ServeRepairStats,
|
||||
) {
|
||||
// iter over the packets
|
||||
let allocated = thread_mem_usage::Allocatedp::default();
|
||||
packets.packets.iter().for_each(|packet| {
|
||||
let start = allocated.get();
|
||||
let from_addr = packet.meta.addr();
|
||||
limited_deserialize(&packet.data[..packet.meta.size])
|
||||
.into_iter()
|
||||
@ -336,10 +332,6 @@ impl ServeRepair {
|
||||
let _ignore_disconnect = response_sender.send(rsp);
|
||||
}
|
||||
});
|
||||
datapoint_debug!(
|
||||
"solana-serve-repair-memory",
|
||||
("serve_repair", (allocated.get() - start) as i64, i64),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1390,7 +1390,20 @@ fn report_target_features() {
|
||||
}
|
||||
);
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
// We exclude Mac OS here to be compatible with computers that have Mac M1 chips.
|
||||
// For these computers, one must install rust/cargo/brew etc. using Rosetta 2,
|
||||
// which allows them to run software targeted for x86_64 on an aarch64.
|
||||
// Hence the code below will run on these machines (target_arch="x86_64")
|
||||
// if we don't exclude with target_os="macos".
|
||||
//
|
||||
// It's going to require more more work to get Solana building
|
||||
// on Mac M1's without Rosetta,
|
||||
// and when that happens we should remove this
|
||||
// (the feature flag for code targeting that is target_arch="aarch64")
|
||||
#[cfg(all(
|
||||
any(target_arch = "x86", target_arch = "x86_64"),
|
||||
not(target_os = "macos")
|
||||
))]
|
||||
{
|
||||
unsafe { check_avx() };
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
backtrace = { version = "0.3.33", features = ["serialize-serde"] }
|
||||
bytes = { version = "0.4.12", features = ["either"] }
|
||||
cc = { version = "1.0.45", features = ["jobserver", "num_cpus", "parallel"]}
|
||||
cc = { version = "1.0.67", features = ["jobserver", "parallel"]}
|
||||
curve25519-dalek = { version = "2" }
|
||||
either= { version = "1.5.2" }
|
||||
lazy_static = { version = "1.4.0", features = ["spin", "spin_no_std"] }
|
||||
@ -20,6 +20,7 @@ libc = { version = "0.2.62", features = ["extra_traits"] }
|
||||
rand_chacha = { version = "0.2.2" }
|
||||
regex-syntax = { version = "0.6.12" }
|
||||
reqwest = { version = "0.11.2", default-features = false, features = ["blocking", "rustls-tls", "json"] }
|
||||
ring = { version = "0.16.17" }
|
||||
serde = { version = "1.0.100", features = ["rc"] }
|
||||
ed25519-dalek = { version = "=1.0.1", features = ["serde"] }
|
||||
syn_0_15 = { package = "syn", version = "0.15.42", features = ["extra-traits", "fold", "full"] }
|
||||
|
@ -12,7 +12,7 @@ use itertools::Itertools;
|
||||
use log::*;
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use rayon::{prelude::*, ThreadPool};
|
||||
use solana_measure::{measure::Measure, thread_mem_usage};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_metrics::{datapoint_error, inc_new_counter_debug};
|
||||
use solana_rayon_threadlimit::get_thread_count;
|
||||
use solana_runtime::{
|
||||
@ -423,8 +423,6 @@ fn do_process_blockstore_from_root(
|
||||
transaction_status_sender: Option<TransactionStatusSender>,
|
||||
) -> BlockstoreProcessorResult {
|
||||
info!("processing ledger from slot {}...", bank.slot());
|
||||
let allocated = thread_mem_usage::Allocatedp::default();
|
||||
let initial_allocation = allocated.get();
|
||||
|
||||
// Starting slot must be a root, and thus has no parents
|
||||
assert!(bank.parent().is_none());
|
||||
@ -503,9 +501,9 @@ fn do_process_blockstore_from_root(
|
||||
|
||||
info!("ledger processing timing: {:?}", timing);
|
||||
info!(
|
||||
"ledger processed in {}. {} MB allocated. root slot is {}, {} fork{} at {}, with {} frozen bank{}",
|
||||
HumanTime::from(chrono::Duration::from_std(now.elapsed()).unwrap()).to_text_en(Accuracy::Precise, Tense::Present),
|
||||
allocated.since(initial_allocation) / 1_000_000,
|
||||
"ledger processed in {}. root slot is {}, {} fork{} at {}, with {} frozen bank{}",
|
||||
HumanTime::from(chrono::Duration::from_std(now.elapsed()).unwrap())
|
||||
.to_text_en(Accuracy::Precise, Tense::Present),
|
||||
bank_forks.root(),
|
||||
initial_forks.len(),
|
||||
if initial_forks.len() > 1 { "s" } else { "" },
|
||||
@ -824,9 +822,6 @@ fn process_next_slots(
|
||||
// Only process full slots in blockstore_processor, replay_stage
|
||||
// handles any partials
|
||||
if next_meta.is_full() {
|
||||
let allocated = thread_mem_usage::Allocatedp::default();
|
||||
let initial_allocation = allocated.get();
|
||||
|
||||
let next_bank = Arc::new(Bank::new_from_parent(
|
||||
&bank,
|
||||
&leader_schedule_cache
|
||||
@ -835,10 +830,9 @@ fn process_next_slots(
|
||||
*next_slot,
|
||||
));
|
||||
trace!(
|
||||
"New bank for slot {}, parent slot is {}. {} bytes allocated",
|
||||
"New bank for slot {}, parent slot is {}",
|
||||
next_slot,
|
||||
bank.slot(),
|
||||
allocated.since(initial_allocation)
|
||||
);
|
||||
pending_slots.push((next_meta, next_bank, bank.last_blockhash()));
|
||||
}
|
||||
@ -905,9 +899,6 @@ fn load_frozen_forks(
|
||||
txs = 0;
|
||||
}
|
||||
|
||||
let allocated = thread_mem_usage::Allocatedp::default();
|
||||
let initial_allocation = allocated.get();
|
||||
|
||||
let mut progress = ConfirmationProgress::new(last_entry_hash);
|
||||
|
||||
if process_single_slot(
|
||||
@ -987,10 +978,9 @@ fn load_frozen_forks(
|
||||
slots_elapsed += 1;
|
||||
|
||||
trace!(
|
||||
"Bank for {}slot {} is complete. {} bytes allocated",
|
||||
"Bank for {}slot {} is complete",
|
||||
if last_root == slot { "root " } else { "" },
|
||||
slot,
|
||||
allocated.since(initial_allocation)
|
||||
);
|
||||
|
||||
process_next_slots(
|
||||
|
@ -15,16 +15,5 @@ log = "0.4.11"
|
||||
solana-sdk = { path = "../sdk", version = "=1.7.0" }
|
||||
solana-metrics = { path = "../metrics", version = "=1.7.0" }
|
||||
|
||||
[target."cfg(unix)".dependencies]
|
||||
jemallocator = "0.3.2"
|
||||
jemalloc-ctl = "0.3.2"
|
||||
|
||||
[features]
|
||||
# mainly for heaptrack, which seems to be incompatible with jemalloc
|
||||
# opt-out ("no-" prefix) is chosen for convenience for the default case
|
||||
# (= with jemalloc), considering complexies of proper opt-in (default)
|
||||
# feature plumbing
|
||||
no-jemalloc = []
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
@ -1,11 +1,2 @@
|
||||
#![allow(clippy::integer_arithmetic)]
|
||||
pub mod measure;
|
||||
pub mod thread_mem_usage;
|
||||
|
||||
#[cfg(unix)]
|
||||
extern crate jemallocator;
|
||||
|
||||
#[cfg(not(feature = "no-jemalloc"))]
|
||||
#[cfg(unix)]
|
||||
#[global_allocator]
|
||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||
|
@ -1,50 +0,0 @@
|
||||
#[cfg(not(feature = "no-jemalloc"))]
|
||||
#[cfg(unix)]
|
||||
use jemalloc_ctl::thread;
|
||||
|
||||
pub fn datapoint(_name: &'static str) {
|
||||
#[cfg(not(feature = "no-jemalloc"))]
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let allocated = thread::allocatedp::mib().unwrap();
|
||||
let allocated = allocated.read().unwrap();
|
||||
let mem = allocated.get();
|
||||
solana_metrics::datapoint_debug!("thread-memory", (_name, mem as i64, i64));
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Allocatedp {
|
||||
#[cfg(not(feature = "no-jemalloc"))]
|
||||
#[cfg(unix)]
|
||||
allocated: thread::ThreadLocal<u64>,
|
||||
}
|
||||
|
||||
impl Allocatedp {
|
||||
pub fn default() -> Self {
|
||||
#[cfg(not(feature = "no-jemalloc"))]
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let allocated = thread::allocatedp::mib().unwrap();
|
||||
let allocated = allocated.read().unwrap();
|
||||
Self { allocated }
|
||||
}
|
||||
#[cfg(any(feature = "no-jemalloc", not(unix)))]
|
||||
Self {}
|
||||
}
|
||||
|
||||
/// Return current thread heap usage
|
||||
pub fn get(&self) -> u64 {
|
||||
#[cfg(not(feature = "no-jemalloc"))]
|
||||
#[cfg(unix)]
|
||||
{
|
||||
self.allocated.get()
|
||||
}
|
||||
#[cfg(any(feature = "no-jemalloc", not(unix)))]
|
||||
0
|
||||
}
|
||||
|
||||
/// Return the difference in thread heap usage since a previous `get()`
|
||||
pub fn since(&self, previous: u64) -> i64 {
|
||||
self.get() as i64 - previous as i64
|
||||
}
|
||||
}
|
75
programs/bpf/Cargo.lock
generated
75
programs/bpf/Cargo.lock
generated
@ -163,9 +163,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
|
||||
[[package]]
|
||||
name = "blake3"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce4f9586c9a3151c4b49b19e82ba163dd073614dd057e53c969e1a4db5b52720"
|
||||
checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec",
|
||||
@ -344,12 +344,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.49"
|
||||
version = "1.0.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e450b8da92aa6f274e7c6437692f9f2ce6d701fb73bacfcf87897b3f89a4c20e"
|
||||
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -913,12 +912,6 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fs_extra"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
version = "0.3.3"
|
||||
@ -1383,38 +1376,6 @@ version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
|
||||
|
||||
[[package]]
|
||||
name = "jemalloc-ctl"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c502a5ff9dd2924f1ed32ba96e3b65735d837b4bfd978d3161b1702e66aca4b7"
|
||||
dependencies = [
|
||||
"jemalloc-sys",
|
||||
"libc",
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jemalloc-sys"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"fs_extra",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jemallocator"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
|
||||
dependencies = [
|
||||
"jemalloc-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.21"
|
||||
@ -1957,25 +1918,6 @@ dependencies = [
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "0.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
|
||||
dependencies = [
|
||||
"paste-impl",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste-impl"
|
||||
version = "0.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.4.0"
|
||||
@ -2328,13 +2270,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.16.12"
|
||||
version = "0.16.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c"
|
||||
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"spin",
|
||||
"untrusted",
|
||||
"web-sys",
|
||||
@ -3150,6 +3092,7 @@ dependencies = [
|
||||
"rand_chacha 0.2.2",
|
||||
"regex-syntax",
|
||||
"reqwest",
|
||||
"ring",
|
||||
"serde",
|
||||
"syn 0.15.44",
|
||||
"syn 1.0.67",
|
||||
@ -3264,8 +3207,6 @@ dependencies = [
|
||||
name = "solana-measure"
|
||||
version = "1.7.0"
|
||||
dependencies = [
|
||||
"jemalloc-ctl",
|
||||
"jemallocator",
|
||||
"log",
|
||||
"solana-metrics",
|
||||
"solana-sdk",
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
use crate::packet::{self, send_to, Packets, PacketsRecycler, PACKETS_PER_BATCH};
|
||||
use crate::recvmmsg::NUM_RCVMMSGS;
|
||||
use solana_measure::thread_mem_usage;
|
||||
use solana_sdk::timing::{duration_as_ms, timestamp};
|
||||
use std::net::UdpSocket;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
@ -97,7 +96,6 @@ pub fn receiver(
|
||||
Builder::new()
|
||||
.name("solana-receiver".to_string())
|
||||
.spawn(move || {
|
||||
thread_mem_usage::datapoint(name);
|
||||
let _ = recv_loop(
|
||||
&sock,
|
||||
exit,
|
||||
@ -144,7 +142,6 @@ pub fn responder(name: &'static str, sock: Arc<UdpSocket>, r: PacketReceiver) ->
|
||||
let mut last_error = None;
|
||||
let mut last_print = 0;
|
||||
loop {
|
||||
thread_mem_usage::datapoint(name);
|
||||
if let Err(e) = recv_send(&sock, &r) {
|
||||
match e {
|
||||
StreamerError::RecvTimeoutError(RecvTimeoutError::Disconnected) => break,
|
||||
|
Reference in New Issue
Block a user