]> rtime.felk.cvut.cz Git - eurobot/public.git/blobdiff - src/timing/plot_etp.m
timing: clean-up of clock_gettime ipoint, mutex added
[eurobot/public.git] / src / timing / plot_etp.m
diff --git a/src/timing/plot_etp.m b/src/timing/plot_etp.m
new file mode 100644 (file)
index 0000000..4cd0ed3
--- /dev/null
@@ -0,0 +1,32 @@
+function [diff_us] = plot_etp(fname)
+
+data = load(fname);
+
+len = length(data);
+
+j=1;
+diffs = zeros(len/2, 1);
+for i=1:len
+    if(mod(i,2) == 0)
+        diffs(j) = (data(i) - data(i-1));
+        j = j+1;
+    end
+end
+
+diff_us = diffs.*1000000;
+
+[n,x] = hist(diff_us, 100);
+semilogy(x, cumsum(n)/sum(n));
+title('ETP')
+grid
+plot2svg('etp1.svg')
+
+figure(2)
+semilogy(x, 1-(cumsum(n)/sum(n)), 'LineWidth',2);
+
+grid
+ylabel('1 - Cummulative probability')
+xlabel('Execution time [us]')
+%axis([0 5 10e-5 1]) 
+plot2svg('etp2.svg')
+