mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Move crates under a sub folder to clean up the code
This commit is contained in:
parent
30f3c30389
commit
9c1e54a2c8
1062 changed files with 19 additions and 20 deletions
21
crates/tracing-trace/src/bin/trace-to-callstats.rs
Normal file
21
crates/tracing-trace/src/bin/trace-to-callstats.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use std::ffi::OsString;
|
||||
use std::io::Write;
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
fn main() {
|
||||
let input_file = std::env::args_os().nth(1).expect("missing <INPUT> file");
|
||||
let input =
|
||||
std::io::BufReader::new(std::fs::File::open(&input_file).expect("could not open <INPUT>"));
|
||||
let trace = tracing_trace::TraceReader::new(input);
|
||||
let profile = tracing_trace::processor::span_stats::to_call_stats(trace).unwrap();
|
||||
let mut output_file = OsString::new();
|
||||
output_file.push("callstats-");
|
||||
output_file.push(input_file);
|
||||
let mut output_file = std::io::BufWriter::new(std::fs::File::create(output_file).unwrap());
|
||||
for (key, value) in profile {
|
||||
serde_json::to_writer(&mut output_file, &json!({key: value})).unwrap();
|
||||
writeln!(&mut output_file).unwrap();
|
||||
}
|
||||
output_file.flush().unwrap();
|
||||
}
|
18
crates/tracing-trace/src/bin/trace-to-firefox.rs
Normal file
18
crates/tracing-trace/src/bin/trace-to-firefox.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
use std::ffi::OsString;
|
||||
use std::io::Write;
|
||||
|
||||
fn main() {
|
||||
let input_file = std::env::args_os().nth(1).expect("missing <INPUT> file");
|
||||
let input =
|
||||
std::io::BufReader::new(std::fs::File::open(&input_file).expect("could not open <INPUT>"));
|
||||
let trace = tracing_trace::TraceReader::new(input);
|
||||
let profile =
|
||||
tracing_trace::processor::firefox_profiler::to_firefox_profile(trace, "Meilisearch")
|
||||
.unwrap();
|
||||
let mut output_file = OsString::new();
|
||||
output_file.push("firefox-");
|
||||
output_file.push(input_file);
|
||||
let mut output_file = std::io::BufWriter::new(std::fs::File::create(output_file).unwrap());
|
||||
serde_json::to_writer(&mut output_file, &profile).unwrap();
|
||||
output_file.flush().unwrap();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue