feat: increase precision of proving speed, release-only analytics (#19)

This commit is contained in:
Collin Jackson 2024-10-23 12:04:17 -07:00 committed by GitHub
parent 26f1652952
commit f6d168cd7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 11 deletions

View File

@ -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 {
if ws_addr_string.starts_with("wss://dev.orchestrator.nexus.xyz:443/") {
return "504d4d443854f2cd10e2e385aca81aa4".into();

View File

@ -225,8 +225,8 @@ async fn main() {
track(
"progress".into(),
format!(
"Program trace is {} steps. Proving from {} to {}...",
total_steps, start, end
"Program trace is {} steps. Proving {} steps starting at {}...",
total_steps, steps_to_prove, start
),
&ws_addr_string,
json!({
@ -255,11 +255,10 @@ async fn main() {
};
let progress_duration = SystemTime::now().duration_since(progress_time).unwrap();
let cycles_proven = steps_proven * 4;
let proof_cycles_hertz = k * 1000 / progress_duration.as_millis();
let proof_cycles_per_minute = k * 60 * 1000 / progress_duration.as_millis();
let proof_cycles_hertz = k as f64 * 1000.0 / progress_duration.as_millis() as f64;
track(
"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,
json!({
"completed_fraction": completed_fraction,
@ -270,7 +269,6 @@ async fn main() {
"k": k,
"progress_duration_millis": progress_duration.as_millis(),
"proof_cycles_hertz": proof_cycles_hertz,
"proof_cycles_per_minute": proof_cycles_per_minute,
"prover_id": prover_id,
}),
);
@ -310,21 +308,19 @@ async fn main() {
})),
};
let duration = SystemTime::now().duration_since(start_time).unwrap();
let proof_cycles_hertz = cycles_proven * 1000 / duration.as_millis();
let proof_cycles_per_minute = cycles_proven * 60 * 1000 / duration.as_millis();
let proof_cycles_hertz = cycles_proven as f64 * 1000.0 / duration.as_millis() as f64;
client
.send(Message::Binary(response.encode_to_vec()))
.await
.unwrap();
track(
"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,
json!({
"proof_duration_sec": duration.as_secs(),
"proof_duration_millis": duration.as_millis(),
"proof_cycles_hertz": proof_cycles_hertz,
"proof_cycles_per_minute": proof_cycles_per_minute,
"prover_id": prover_id,
}),
);
@ -353,4 +349,4 @@ async fn main() {
&ws_addr_string,
json!({ "prover_id": prover_id }),
);
}
}