sleepless demo to complement sleepless nights

18 ktps on macbook pro, no gpu
This commit is contained in:
Greg Fitzgerald 2018-04-26 13:17:36 -06:00
parent 9ed953e8c3
commit d415b17146
6 changed files with 30 additions and 15 deletions

View File

@ -53,6 +53,9 @@ Now you can start the server:
$ cat genesis.log | cargo run --release --bin solana-testnode > transactions0.log
```
Wait a few seconds for the server to initialize. It will print "Ready." when it's safe
to start sending it transactions.
Then, in a separate shell, let's execute some transactions. Note we pass in
the JSON configuration file here, not the genesis ledger.

View File

@ -285,6 +285,7 @@ impl<W: Write + Send + 'static> AccountantSkel<W> {
// Write new entries to the ledger and notify subscribers.
obj.lock().unwrap().sync();
}
Ok(())
}
@ -328,8 +329,13 @@ impl<W: Write + Send + 'static> AccountantSkel<W> {
&packet_recycler,
&blob_recycler,
);
if e.is_err() && exit.load(Ordering::Relaxed) {
break;
if e.is_err() {
// Assume this was a timeout, so sync any empty entries.
skel.lock().unwrap().sync();
if exit.load(Ordering::Relaxed) {
break;
}
}
});
Ok(vec![t_receiver, t_responder, t_server, t_verifier])

View File

@ -131,6 +131,17 @@ impl AccountantStub {
/// Return the number of transactions the server processed since creating
/// this stub instance.
pub fn transaction_count(&mut self) -> u64 {
// Wait for at least one EntryInfo.
let mut done = false;
while !done {
let resp = self.recv_response().expect("recv response");
if let &Response::EntryInfo(_) = &resp {
done = true;
}
self.process_response(resp);
}
// Then take the rest.
self.socket.set_nonblocking(true).expect("set nonblocking");
loop {
match self.recv_response() {

View File

@ -18,8 +18,7 @@ use std::env;
use std::io::{stdin, Read};
use std::net::UdpSocket;
use std::process::exit;
use std::thread::sleep;
use std::time::{Duration, Instant};
use std::time::Instant;
use untrusted::Input;
fn print_usage(program: &str, opts: Options) {
@ -129,17 +128,13 @@ fn main() {
}
});
println!("Waiting for half the transactions to complete...",);
let mut tx_count = acc.transaction_count();
let mut prev_tx_count = tx_count + 1;
println!("Waiting for the server to go idle...",);
while tx_count != prev_tx_count {
sleep(Duration::from_millis(20));
prev_tx_count = tx_count;
while tx_count < transactions.len() as u64 / 2 {
tx_count = acc.transaction_count();
}
let txs = tx_count - initial_tx_count;
println!("Sent transactions {}", txs);
println!("Transactions processed {}", txs);
let duration = now.elapsed();
let ns = duration.as_secs() * 1_000_000_000 + u64::from(duration.subsec_nanos());

View File

@ -6,15 +6,15 @@ extern crate solana;
extern crate untrusted;
use isatty::stdin_isatty;
use rayon::prelude::*;
use solana::accountant::MAX_ENTRY_IDS;
use solana::entry::{create_entry, next_tick};
use solana::event::Event;
use solana::accountant::MAX_ENTRY_IDS;
use solana::mint::MintDemo;
use solana::signature::{KeyPair, KeyPairUtil};
use solana::transaction::Transaction;
use std::io::{stdin, Read};
use std::process::exit;
use rayon::prelude::*;
use untrusted::Input;
// Generate a ledger with lots and lots of accounts.

View File

@ -3,11 +3,11 @@ extern crate ring;
extern crate serde_json;
extern crate solana;
use rayon::prelude::*;
use ring::rand::SystemRandom;
use solana::mint::{Mint, MintDemo};
use solana::signature::KeyPair;
use std::io;
use rayon::prelude::*;
use ring::rand::SystemRandom;
fn main() {
let mut input_text = String::new();