Tholp's bespoke website generator
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add elapsed time in output

Tholp 320ee5d6 3753f332

+18 -4
+18 -4
src/main.rs
··· 21 21 env, 22 22 fs::{self}, 23 23 path::PathBuf, 24 + time::Instant, 24 25 }; 25 26 use stringtools::{collect_arguments, collect_block, split_to_tokens}; 26 27 use types::Token; ··· 74 75 // process_skid(infile, group.convert_html, &mut project.context); 75 76 // } 76 77 // } 77 - 78 + let project_start = Instant::now(); 78 79 for i in 0..project.filegroups.len() { 79 80 if !project.filegroups[i].process { 80 81 continue; 81 82 } 82 83 let convert_html = project.filegroups[i].convert_html; 83 84 for k in 0..project.filegroups[i].files.len() { 85 + let file_start = Instant::now(); 84 86 let file_input = project.filegroups[i].files[k].file_input.clone(); 85 87 let contents = fs::read_to_string(&project.filegroups[i].files[k].file_input) 86 88 .expect("File unreadable or missing"); ··· 92 94 &project.filegroups[i].files[k].file_out.clone(), 93 95 convert_html, 94 96 &process_skid(&tokens, &mut project, &mut skid_context), 97 + file_start, 95 98 ); 96 99 } 97 100 } 101 + info_generic(&format!( 102 + "Finished in {:.3}ms", 103 + project_start.elapsed().as_secs_f64() * 1000.0 104 + )); 98 105 } 99 106 100 107 fn find_and_run_macro( ··· 357 364 return tokens; 358 365 } 359 366 360 - fn write_file(file_skidout: &PathBuf, file_out: &PathBuf, convert_html: bool, tokens: &[Token]) { 367 + fn write_file( 368 + file_skidout: &PathBuf, 369 + file_out: &PathBuf, 370 + convert_html: bool, 371 + tokens: &[Token], 372 + file_start: Instant, 373 + ) { 361 374 //println!("{:?}", tokens); 362 375 let mut skid_output: String = if convert_html { 363 376 "<!-- Generated by Skidmark, Do Not Edit! -->\n\n".into() ··· 407 420 fs::write(&file_out, &skid_output).expect("Couldn't write output to file"); 408 421 } 409 422 ok_generic(&format!( 410 - "{} written", 411 - file_out.to_str().unwrap_or("Couldnt Unwrap file_out name") 423 + "{} written in {:.3}ms", 424 + file_out.to_str().unwrap_or("Couldnt Unwrap file_out name"), 425 + file_start.elapsed().as_secs_f64() * 1000.0 412 426 )); 413 427 }