feat: increase precision of proving speed, release-only analytics (#19)
This commit is contained in:
parent
26f1652952
commit
f6d168cd7c
@ -1,3 +1,10 @@
|
|||||||
|
#[cfg(debug_assertions)]
|
||||||
|
pub fn analytics_token(_ws_addr_string: &str) -> String {
|
||||||
|
// Use one of the tokens in the release version if debugging analytics
|
||||||
|
return "".into();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
pub fn analytics_token(ws_addr_string: &str) -> String {
|
pub fn analytics_token(ws_addr_string: &str) -> String {
|
||||||
if ws_addr_string.starts_with("wss://dev.orchestrator.nexus.xyz:443/") {
|
if ws_addr_string.starts_with("wss://dev.orchestrator.nexus.xyz:443/") {
|
||||||
return "504d4d443854f2cd10e2e385aca81aa4".into();
|
return "504d4d443854f2cd10e2e385aca81aa4".into();
|
||||||
|
@ -225,8 +225,8 @@ async fn main() {
|
|||||||
track(
|
track(
|
||||||
"progress".into(),
|
"progress".into(),
|
||||||
format!(
|
format!(
|
||||||
"Program trace is {} steps. Proving from {} to {}...",
|
"Program trace is {} steps. Proving {} steps starting at {}...",
|
||||||
total_steps, start, end
|
total_steps, steps_to_prove, start
|
||||||
),
|
),
|
||||||
&ws_addr_string,
|
&ws_addr_string,
|
||||||
json!({
|
json!({
|
||||||
@ -255,11 +255,10 @@ async fn main() {
|
|||||||
};
|
};
|
||||||
let progress_duration = SystemTime::now().duration_since(progress_time).unwrap();
|
let progress_duration = SystemTime::now().duration_since(progress_time).unwrap();
|
||||||
let cycles_proven = steps_proven * 4;
|
let cycles_proven = steps_proven * 4;
|
||||||
let proof_cycles_hertz = k * 1000 / progress_duration.as_millis();
|
let proof_cycles_hertz = k as f64 * 1000.0 / progress_duration.as_millis() as f64;
|
||||||
let proof_cycles_per_minute = k * 60 * 1000 / progress_duration.as_millis();
|
|
||||||
track(
|
track(
|
||||||
"progress".into(),
|
"progress".into(),
|
||||||
format!("Proved step {} at {} Hz.", step, proof_cycles_hertz),
|
format!("Proved step {} at {:.2} proof cycles/sec.", step, proof_cycles_hertz),
|
||||||
&ws_addr_string,
|
&ws_addr_string,
|
||||||
json!({
|
json!({
|
||||||
"completed_fraction": completed_fraction,
|
"completed_fraction": completed_fraction,
|
||||||
@ -270,7 +269,6 @@ async fn main() {
|
|||||||
"k": k,
|
"k": k,
|
||||||
"progress_duration_millis": progress_duration.as_millis(),
|
"progress_duration_millis": progress_duration.as_millis(),
|
||||||
"proof_cycles_hertz": proof_cycles_hertz,
|
"proof_cycles_hertz": proof_cycles_hertz,
|
||||||
"proof_cycles_per_minute": proof_cycles_per_minute,
|
|
||||||
"prover_id": prover_id,
|
"prover_id": prover_id,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -310,21 +308,19 @@ async fn main() {
|
|||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
let duration = SystemTime::now().duration_since(start_time).unwrap();
|
let duration = SystemTime::now().duration_since(start_time).unwrap();
|
||||||
let proof_cycles_hertz = cycles_proven * 1000 / duration.as_millis();
|
let proof_cycles_hertz = cycles_proven as f64 * 1000.0 / duration.as_millis() as f64;
|
||||||
let proof_cycles_per_minute = cycles_proven * 60 * 1000 / duration.as_millis();
|
|
||||||
client
|
client
|
||||||
.send(Message::Binary(response.encode_to_vec()))
|
.send(Message::Binary(response.encode_to_vec()))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
track(
|
track(
|
||||||
"proof".into(),
|
"proof".into(),
|
||||||
format!("Proof sent! You proved at {} Hz.", proof_cycles_hertz),
|
format!("Proof sent! Overall speed was {:.2} proof cycles/sec.", proof_cycles_hertz),
|
||||||
&ws_addr_string,
|
&ws_addr_string,
|
||||||
json!({
|
json!({
|
||||||
"proof_duration_sec": duration.as_secs(),
|
"proof_duration_sec": duration.as_secs(),
|
||||||
"proof_duration_millis": duration.as_millis(),
|
"proof_duration_millis": duration.as_millis(),
|
||||||
"proof_cycles_hertz": proof_cycles_hertz,
|
"proof_cycles_hertz": proof_cycles_hertz,
|
||||||
"proof_cycles_per_minute": proof_cycles_per_minute,
|
|
||||||
"prover_id": prover_id,
|
"prover_id": prover_id,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -353,4 +349,4 @@ async fn main() {
|
|||||||
&ws_addr_string,
|
&ws_addr_string,
|
||||||
json!({ "prover_id": prover_id }),
|
json!({ "prover_id": prover_id }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user