Use write_to_vec for profile data

This commit is contained in:
gusto 2024-06-27 11:35:43 +03:00
parent e901ddee5e
commit 3d00a45a06
2 changed files with 5 additions and 4 deletions

View File

@ -26,7 +26,7 @@ rayon = { version = "1.10.0", optional = true }
rand = "0.8"
ark-bls12-381 = "0.4.0"
divan = "0.1"
pprof = { version = "0.13.0" }
pprof = { version = "0.13.0", features = ['protobuf-codec', 'protobuf', 'cpp' ]}
[features]
default = []

View File

@ -263,6 +263,7 @@ pub mod test {
decode, verify_element_proof, FieldElement, PolynomialEvaluationDomain,
BYTES_PER_FIELD_ELEMENT,
};
use pprof::protos::Message;
use rand::RngCore;
use std::ops::Div;
@ -472,7 +473,7 @@ pub mod test {
fn profile_full_encode_flow() {
// use ~1MB worth of data
let data = rand_data(1024 * 1024 / DaEncoderParams::MAX_BLS12_381_ENCODING_CHUNK_SIZE);
let domain = GeneralEvaluationDomain::new(4096).unwrap();
let domain = PolynomialEvaluationDomain::new(4096).unwrap();
let encoder = DaEncoder::new(DaEncoderParams::new(4096, true));
let guard = pprof::ProfilerGuardBuilder::default()
@ -487,9 +488,9 @@ pub mod test {
let profile = report.pprof().unwrap();
let mut content = Vec::new();
profile.encode(&mut content).unwrap();
profile.write_to_vec(&mut content).unwrap();
std::io::Write::write_all(&mut file, &content).unwrap();
println!("report: {}", &report);
println!("report: {:?}", &report);
}
Err(_) => {}
};