diff --git a/Cargo.toml b/Cargo.toml index e8ccfdb..dcbe5c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ bitvec = "0.18" subtle = "2.3" crossbeam-utils = "0.7" ff = "0.8" -metrics = "=0.13.0-alpha.11" +metrics = "=0.13.0-alpha.13" num_cpus = "1.13" rand = "0.7" diff --git a/src/model.rs b/src/model.rs index 940b73a..6e5f56f 100644 --- a/src/model.rs +++ b/src/model.rs @@ -5,7 +5,7 @@ use std::collections::HashMap; use std::fmt; use std::sync::Arc; -use metrics::{Key, Recorder, Unit}; +use metrics::{GaugeValue, Key, Recorder, Unit}; /// A [`metrics`] recorder for examining halo2 metrics. /// @@ -94,11 +94,11 @@ impl Recorder for ModelRecorder { .or_default() += value; } - fn update_gauge(&self, _key: Key, _value: f64) { + fn update_gauge(&self, _key: Key, _value: GaugeValue) { unimplemented!() } - fn record_histogram(&self, _key: Key, _value: u64) { + fn record_histogram(&self, _key: Key, _value: f64) { unimplemented!() } } diff --git a/src/poly/commitment.rs b/src/poly/commitment.rs index 6729ac5..a4066c2 100644 --- a/src/poly/commitment.rs +++ b/src/poly/commitment.rs @@ -125,7 +125,7 @@ impl Params { poly: &Polynomial, r: Blind, ) -> C::Projective { - metrics::increment!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit"); + metrics::increment_counter!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit"); let mut tmp_scalars = Vec::with_capacity(poly.len() + 1); let mut tmp_bases = Vec::with_capacity(poly.len() + 1); @@ -146,7 +146,7 @@ impl Params { poly: &Polynomial, r: Blind, ) -> C::Projective { - metrics::increment!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit_lagrange"); + metrics::increment_counter!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit_lagrange"); let mut tmp_scalars = Vec::with_capacity(poly.len() + 1); let mut tmp_bases = Vec::with_capacity(poly.len() + 1); diff --git a/src/poly/commitment/msm.rs b/src/poly/commitment/msm.rs index 1d11d66..098c1cd 100644 --- a/src/poly/commitment/msm.rs +++ b/src/poly/commitment/msm.rs @@ -112,7 +112,7 @@ impl<'a, C: CurveAffine> MSM<'a, C> { assert_eq!(scalars.len(), len); - metrics::increment!("multiexp", "size" => format!("{}", len), "fn" => "MSM::eval"); + metrics::increment_counter!("multiexp", "size" => format!("{}", len), "fn" => "MSM::eval"); bool::from(best_multiexp(&scalars, &bases).is_zero()) } } diff --git a/src/poly/commitment/prover.rs b/src/poly/commitment/prover.rs index 999367b..38cbf16 100644 --- a/src/poly/commitment/prover.rs +++ b/src/poly/commitment/prover.rs @@ -175,7 +175,7 @@ impl Proof { let d = C::Scalar::rand(); let s = C::Scalar::rand(); - metrics::increment!("multiexp", "val" => "delta", "size" => "3"); + metrics::increment_counter!("multiexp", "val" => "delta", "size" => "3"); let delta = best_multiexp(&[d, d * &b, s], &[g, u, params.h]).to_affine(); // Feed delta into the transcript diff --git a/src/poly/commitment/verifier.rs b/src/poly/commitment/verifier.rs index 3770db4..55b6d6e 100644 --- a/src/poly/commitment/verifier.rs +++ b/src/poly/commitment/verifier.rs @@ -55,7 +55,7 @@ impl<'a, C: CurveAffine> Guard<'a, C> { pub fn compute_g(&self) -> C { let s = compute_s(&self.challenges_sq, self.allinv); - metrics::increment!("multiexp", "size" => format!("{}", s.len()), "fn" => "compute_g"); + metrics::increment_counter!("multiexp", "size" => format!("{}", s.len()), "fn" => "compute_g"); let mut tmp = best_multiexp(&s, &self.msm.params.g); tmp += self.msm.params.h; tmp.to_affine() diff --git a/src/poly/domain.rs b/src/poly/domain.rs index 09a2cd8..022a67c 100644 --- a/src/poly/domain.rs +++ b/src/poly/domain.rs @@ -205,7 +205,7 @@ impl EvaluationDomain { assert_eq!(a.values.len(), 1 << self.k); // Perform inverse FFT to obtain the polynomial in coefficient form - metrics::increment!("ifft", "size" => format!("{}", a.len()), "fn" => "lagrange_to_coeff"); + metrics::increment_counter!("ifft", "size" => format!("{}", a.len()), "fn" => "lagrange_to_coeff"); Self::ifft(&mut a.values, self.omega_inv, self.k, self.ifft_divisor); Polynomial { @@ -240,7 +240,7 @@ impl EvaluationDomain { Self::distribute_powers(&mut a.values, g); } a.values.resize(self.extended_len(), G::group_zero()); - metrics::increment!("fft", "size" => format!("{}", self.extended_len()), "fn" => "coeff_to_extended"); + metrics::increment_counter!("fft", "size" => format!("{}", self.extended_len()), "fn" => "coeff_to_extended"); best_fft(&mut a.values, self.extended_omega, self.extended_k); Polynomial { @@ -259,7 +259,7 @@ impl EvaluationDomain { assert_eq!(a.values.len(), self.extended_len()); // Inverse FFT - metrics::increment!("ifft", "size" => format!("{}", a.len()), "fn" => "extended_to_coeff"); + metrics::increment_counter!("ifft", "size" => format!("{}", a.len()), "fn" => "extended_to_coeff"); Self::ifft( &mut a.values, self.extended_omega_inv,