--- /dev/null
+file_app = fopen('trace.txt','r');
+
+if file_app == -1
+ error('File trace.txt cannot be opened for reading!');
+end
+
+for i=1:1
+ readin = fgetl(file_app);
+end
+
+i = 1;
+timestamps=zeros(5,2);
+
+while 1
+ readin = fgetl(file_app);
+ a = textscan(readin, '%d %n','delimiter',':');
+ if(a{1,1} == 0)
+ break;
+ end
+ timestamps(i, 1) = a{1, 1};
+ timestamps(i, 2) = (a{1,2});
+ i=i+1;
+end
+
+timestamps_nr=size(timestamps,1);
+
+timestamps_diff=zeros(timestamps_nr/2,1);
+
+starts=zeros(timestamps_nr/2,1);
+ends=zeros(timestamps_nr/2,1);
+i=2;
+for j=1:timestamps_nr/2
+ timestamps_diff(j) = timestamps(i,2) - timestamps(i-1,2);
+ i = i + 2;
+end
+
+timestamps_diff = timestamps_diff.*1000000;
+
+fclose(file_app);
\ No newline at end of file
--- /dev/null
+file_tswitch = fopen('taskswitch.log','r');
+
+if file_tswitch == -1
+ error('File trace.txt cannot be opened for reading!');
+end
+
+for i=1:4
+ readin = fgetl(file_tswitch);
+end
+
+
+while 1
+ readin = fgetl(file_tswitch);
+ if(readin == -1)
+ break;
+ end
+ line = regexpi(readin,'-(\d*)\s*\[000\]\s*(\d*.\d*):\s*(\d*):(\d*):(\w|?)\s*([=>+]*)\s\[000\]\s*(\d*):(\d*):(\w|?)','tokens')
+ fields = {'task','tstamp','pid','kernel_prio','task_state','action','pid_to','kernel_prio_to','task_state_to'}
+ line
+ %struct = cell2struct(line,fields,1);
+ i=i+1;
+end
+
+fclose(file_tswitch);
\ No newline at end of file