Commit bef31968 authored by Arnaud Legrand's avatar Arnaud Legrand

Let's rely on pyton rather than perl

parent 1d0a618a
...@@ -97,37 +97,38 @@ echo 'file:measurements.txt' ...@@ -97,37 +97,38 @@ echo 'file:measurements.txt'
* Extracting traces from data files :noexport: * Extracting traces from data files :noexport:
#+begin_src perl :results output raw :exports both :var input="measurements.txt" output="data.csv" #+begin_src python :results output raw :exports both :var input="measurements.txt" output="data.csv"
use strict; import re,sys
open INPUT, $input;
open OUTPUT, "> $output"; INPUT = open(input, "r")
OUTPUT = open(output, "w")
my($line);
my($size); OUTPUT.writelines("Size, Seq, Par, Libc\n")
my($seq,$par,$libc);
for line in INPUT.readlines():
print OUTPUT "Size, Seq, Par, Libc\n" ; m = re.match('^Size: ([\d\.]*)$',line)
while($line=<INPUT>) { if(m):
chomp $line; size = m.group(1)
if($line =~/^Size: ([\d\.]*)$/) { continue
$size = $1; m = re.match('^Sequential quicksort.*: ([\d\.]*) sec.$',line)
next; if(m):
} seq = m.group(1)
if($line =~/^Sequential quicksort.*: ([\d\.]*) sec.$/) { continue
$seq=$1; next; m = re.match('^Parallel quicksort.*: ([\d\.]*) sec.$',line)
} if(m):
if($line =~/^Parallel quicksort.*: ([\d\.]*) sec.$/) { par = m.group(1)
$par=$1; next; continue
} m = re.match('^Built-in quicksort.*: ([\d\.]*) sec.$',line)
if($line =~/^Built-in quicksort.*: ([\d\.]*) sec.$/) { if(m):
$libc=$1; libc = m.group(1)
print OUTPUT "$size, $seq, $par, $libc\n"; OUTPUT.writelines(size+", "+seq+", "+par+", "+libc+"\n")
next;
} print "[[file:"+output+"]]"
}
print "file:$output"
#+end_src #+end_src
#+RESULTS:
[[file:data.csv]]
* R functions :noexport: * R functions :noexport:
Initialization and reading of the data. Initialization and reading of the data.
#+begin_src R :results output :session *R* :exports both #+begin_src R :results output :session *R* :exports both
...@@ -248,7 +249,7 @@ our own experimental testbed with support of our university. ...@@ -248,7 +249,7 @@ our own experimental testbed with support of our university.
# Local Variables: # Local Variables:
# eval: (add-to-list 'load-path ".") # eval: (add-to-list 'load-path ".")
# eval: (require 'org-install) # eval: (require 'org-install)
# eval: (org-babel-do-load-languages 'org-babel-load-languages '((shell . t) (R . t) (perl . t) (python . t) )) # eval: (org-babel-do-load-languages 'org-babel-load-languages '((shell . t) (R . t) (python . t) ))
# eval: (setq org-confirm-babel-evaluate nil) # eval: (setq org-confirm-babel-evaluate nil)
# eval: (unless (boundp 'org-latex-classes) (setq org-latex-classes nil)) # eval: (unless (boundp 'org-latex-classes) (setq org-latex-classes nil))
# eval: (add-to-list 'org-latex-classes '("IEEEtran" # eval: (add-to-list 'org-latex-classes '("IEEEtran"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment