1 function [wrft,sfire,write] = wrf_timing(wrf_path)
2 % function [wrf,sfire,write] = wrf_timing(wrf_path)
3 % function computes timing from rsl files in directory wrf_path
5 % count the rsl.out files
6 outs = dir([wrf_path,'/rsl*err*']);
13 %loop through the rls.out files, sum the timings
15 %loop from 1:1 since rsl.error.oooo has all the timings
17 f = [outs(i).folder,'/',outs(i).name];
18 fprintf('Processing file %s \n',f)
20 wrt_file = [outs(i).folder,'/writ.txt']; %'writ.txt';
21 wrf_file = [outs(i).folder,'/wrf.txt'];%'wrf.txt';
22 sfr_file = [outs(i).folder,'/wfr.txt'];%'sfr.txt';
24 %store the different timings
25 write_str = sprintf('grep "Timing for Writing" %s > %s',f,wrt_file);
27 wrf_str = sprintf('grep "Timing for main" %s > %s',f,wrf_file);
30 sfr_str = sprintf('grep -P "Timing for .*fire" %s > %s',f,sfr_file);
31 %sfr_str = sprintf('grep "Timing for fire" %s > %s',f,sfr_file);
34 wrt = fopen(wrt_file,'r');
35 wrt_spec = '%s %s %s %s %s %s %s %f %s %s';
36 C_wrt = textscan(wrt,wrt_spec);
39 wrt_sum(i) = sum(wrt_time);
40 wrt_total = wrt_sum(i) + wrt_total;
41 fprintf('Total writing time %s: %f\n',f,wrt_sum(i));
43 wrf = fopen(wrf_file,'r');
44 wrf_spec = '%s %s %s %s %s %s %s %s %f %s %s';
45 C_wrf = textscan(wrt,wrf_spec);
48 wrf_sum(i) = sum(wrf_time);
49 wrf_total = wrf_sum(i) + wrf_total;
50 fprintf('Total main time %s: %f\n',f,wrf_sum(i));
52 sfr = fopen(sfr_file,'r');
53 sfr_spec = '%s %s %s %f %s %s';
54 C_sfr = textscan(sfr,sfr_spec);
57 sfr_sum(i) = sum(sfr_time);
58 sfr_total = sfr_sum(i) + sfr_total;
59 fprintf('Total sfire time %s: %f\n',f,sfr_sum(i));