parent
d8ead57fbb
commit
0bd41f98ed
|
@ -70,6 +70,8 @@ tokio-io = "0.1"
|
||||||
untrusted = "0.7.0"
|
untrusted = "0.7.0"
|
||||||
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "0.21.0" }
|
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "0.21.0" }
|
||||||
reed-solomon-erasure = { package = "solana-reed-solomon-erasure", version = "4.0.1-3", features = ["simd-accel"] }
|
reed-solomon-erasure = { package = "solana-reed-solomon-erasure", version = "4.0.1-3", features = ["simd-accel"] }
|
||||||
|
|
||||||
|
[target."cfg(unix)".dependencies]
|
||||||
jemallocator = "0.3.2"
|
jemallocator = "0.3.2"
|
||||||
jemalloc-ctl = "0.3.2"
|
jemalloc-ctl = "0.3.2"
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ use crate::{
|
||||||
use bincode::{serialize, serialized_size};
|
use bincode::{serialize, serialized_size};
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use jemalloc_ctl::thread::allocatedp;
|
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use solana_ledger::{bank_forks::BankForks, blocktree::Blocktree, staking_utils};
|
use solana_ledger::{bank_forks::BankForks, blocktree::Blocktree, staking_utils};
|
||||||
use solana_metrics::{datapoint_debug, inc_new_counter_debug, inc_new_counter_error};
|
use solana_metrics::{datapoint_debug, inc_new_counter_debug, inc_new_counter_error};
|
||||||
|
@ -1221,8 +1220,7 @@ impl ClusterInfo {
|
||||||
response_sender: &PacketSender,
|
response_sender: &PacketSender,
|
||||||
) {
|
) {
|
||||||
// iter over the packets, collect pulls separately and process everything else
|
// iter over the packets, collect pulls separately and process everything else
|
||||||
let allocated = allocatedp::mib().unwrap();
|
let allocated = thread_mem_usage::Allocatedp::default();
|
||||||
let allocated = allocated.read().unwrap();
|
|
||||||
let mut gossip_pull_data: Vec<PullData> = vec![];
|
let mut gossip_pull_data: Vec<PullData> = vec![];
|
||||||
packets.packets.iter().for_each(|packet| {
|
packets.packets.iter().for_each(|packet| {
|
||||||
let from_addr = packet.meta.addr();
|
let from_addr = packet.meta.addr();
|
||||||
|
|
|
@ -85,7 +85,9 @@ extern crate solana_metrics;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate matches;
|
extern crate matches;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
extern crate jemallocator;
|
extern crate jemallocator;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||||
|
|
|
@ -9,7 +9,6 @@ use crate::{
|
||||||
rpc_subscriptions::RpcSubscriptions,
|
rpc_subscriptions::RpcSubscriptions,
|
||||||
thread_mem_usage,
|
thread_mem_usage,
|
||||||
};
|
};
|
||||||
use jemalloc_ctl::thread::allocatedp;
|
|
||||||
use solana_ledger::{
|
use solana_ledger::{
|
||||||
bank_forks::BankForks,
|
bank_forks::BankForks,
|
||||||
block_error::BlockError,
|
block_error::BlockError,
|
||||||
|
@ -220,8 +219,7 @@ impl ReplayStage {
|
||||||
let mut last_reset = Hash::default();
|
let mut last_reset = Hash::default();
|
||||||
let mut partition = false;
|
let mut partition = false;
|
||||||
loop {
|
loop {
|
||||||
let allocated = allocatedp::mib().unwrap();
|
let allocated = thread_mem_usage::Allocatedp::default();
|
||||||
let allocated = allocated.read().unwrap();
|
|
||||||
|
|
||||||
thread_mem_usage::datapoint("solana-replay-stage");
|
thread_mem_usage::datapoint("solana-replay-stage");
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
|
@ -1,9 +1,39 @@
|
||||||
|
#[cfg(unix)]
|
||||||
use jemalloc_ctl::thread;
|
use jemalloc_ctl::thread;
|
||||||
use solana_metrics::datapoint_debug;
|
|
||||||
|
|
||||||
pub fn datapoint(name: &'static str) {
|
pub fn datapoint(_name: &'static str) {
|
||||||
let allocated = thread::allocatedp::mib().unwrap();
|
#[cfg(unix)]
|
||||||
let allocated = allocated.read().unwrap();
|
{
|
||||||
let mem = allocated.get();
|
let allocated = thread::allocatedp::mib().unwrap();
|
||||||
datapoint_debug!("thread-memory", (name, mem as i64, i64));
|
let allocated = allocated.read().unwrap();
|
||||||
|
let mem = allocated.get();
|
||||||
|
solana_metrics::datapoint_debug!("thread-memory", (_name, mem as i64, i64));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Allocatedp {
|
||||||
|
#[cfg(unix)]
|
||||||
|
allocated: thread::ThreadLocal<u64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Allocatedp {
|
||||||
|
pub fn default() -> Self {
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
let allocated = thread::allocatedp::mib().unwrap();
|
||||||
|
let allocated = allocated.read().unwrap();
|
||||||
|
Self { allocated }
|
||||||
|
}
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
Self {}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get(&self) -> u64 {
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
self.allocated.get()
|
||||||
|
}
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue