pub fn write_chrometrace(target: &Path, profile_data: &[GpuTimerScopeResult]) -> std::io::Result<()> {
    let mut file = File::create(target)?;

    writeln!(file, "{{")?;
    writeln!(file, "\"traceEvents\": [")?;

    if !profile_data.is_empty() {
        for child in profile_data.iter().take(profile_data.len() - 1) {
            write_results_recursive(&mut file, child, false)?;
        }
        write_results_recursive(&mut file, profile_data.last().unwrap(), true)?;
    }

    writeln!(file, "]")?;
    writeln!(file, "}}")?;

    Ok(())
}
/// Writes a .json trace file that can be viewed as a flame graph in Chrome via chrome://tracing
Writes a .json trace file that can be viewed as a flame graph in Chrome via chrome://tracing
Writes a . json trace file that can be viewed as a flame graph in Chrome via chrome : // tracing
pub fn write_chrometrace(target: &Path, profile_data: &[GpuTimerScopeResult]) -> std::io::Result<()> {
    let mut file = File::create(target)?;
    writeln!(file, "{{")?;
    writeln!(file, "\"traceEvents\": [")?;
    if !profile_data.is_empty() {
        for child in profile_data.iter().take(profile_data.len() - 1) {
            write_results_recursive(&mut file, child, false)?;
        }
        write_results_recursive(&mut file, profile_data.last().unwrap(), true)?;
    }
    writeln!(file, "]")?;
    writeln!(file, "}}")?;
    Ok(())
}
pub fn write_chrometrace ( target : & Path , profile_data : & [ GpuTimerScopeResult ] ) -> std :: io :: Result < ( ) > { let mut file = File :: create ( target ) ? ; writeln ! ( file " " ) ? ; writeln ! ( file " \" \" " ) ? ; if ! profile_data . is_empty ( ) { for child in profile_data . iter ( ) . take ( profile_data . len ( ) - 1 ) { write_results_recursive ( & mut file , child , false ) ? ; } write_results_recursive ( & mut file , profile_data . last ( ) . unwrap ( ) , true ) ? ; } writeln ! ( file " " ) ? ; writeln ! ( file " " ) ? ; Ok ( ( ) ) }
Writes a .json trace file that can be viewed as a flame graph in Chrome via chrome://tracing
Writes a . json trace file that can be viewed as a flame graph in Chrome via chrome : // tracing
target
&Path
profile_data
&[GpuTimerScopeResult]
target
&Path
profile_data
&[GpuTimerScopeResult]