commit 4b656e741478aa6f32e6dbcf5398c7e5fbce069f Author: Robert Ransom rransom.8774@gmail.com Date: Sun May 29 03:59:07 2011 -0700
[2714] Move task-2649 to task-2714 --- task-2649/.gitignore | 3 - task-2649/MOVED | 1 + task-2649/README | 31 --------- task-2649/compute-hsdir-set-instability | 12 ---- task-2649/compute-hsdir-set-instability.tcl | 83 ------------------------- task-2649/generate-consensus-hsdir-lists | 28 -------- task-2649/graph-hsdir-set-instability | 9 --- task-2649/graph-hsdir-set-instability.gnuplot | 12 ---- task-2649/list-consensus-hsdirs | 19 ------ task-2649/list-consensus-hsdirs.awk | 25 -------- task-2714/.gitignore | 3 + task-2714/README | 31 +++++++++ task-2714/compute-hsdir-set-instability | 12 ++++ task-2714/compute-hsdir-set-instability.tcl | 83 +++++++++++++++++++++++++ task-2714/generate-consensus-hsdir-lists | 28 ++++++++ task-2714/graph-hsdir-set-instability | 9 +++ task-2714/graph-hsdir-set-instability.gnuplot | 12 ++++ task-2714/list-consensus-hsdirs | 19 ++++++ task-2714/list-consensus-hsdirs.awk | 25 ++++++++ 19 files changed, 223 insertions(+), 222 deletions(-)
diff --git a/task-2649/.gitignore b/task-2649/.gitignore deleted file mode 100644 index 46ca2bd..0000000 --- a/task-2649/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -dev/ -out/ -*~ diff --git a/task-2649/MOVED b/task-2649/MOVED new file mode 100644 index 0000000..11dbb4c --- /dev/null +++ b/task-2649/MOVED @@ -0,0 +1 @@ +This directory has moved to task-2714. diff --git a/task-2649/README b/task-2649/README deleted file mode 100644 index 4283696..0000000 --- a/task-2649/README +++ /dev/null @@ -1,31 +0,0 @@ - -Purpose: - - These scripts are intended to determine how unstable the set of - relays with the HSDir flag is. - -Dependencies: - - You will need linedemux and linemux installed. See branch parrun in - https://gitweb.torproject.org/rransom/tor-utils.git for now. - - You will also need Tcl 8.5.9 and gnuplot 4.4.0 installed. - -Instructions: - - First, unpack all of the v3 consensus archive tarballs you want to - analyze into a single directory, and set the consensus_archive_dir - environment variable to point to that directory. - - Then run: - - ./generate-consensus-hsdir-lists - ./compute-hsdir-set-instability - ./graph-hsdir-set-instability - -Bugs: - - This code compares each consensus with each of the four following - consensuses; it should compare each hour's consensus with the - consensuses in effect in each of the four following hours. - diff --git a/task-2649/compute-hsdir-set-instability b/task-2649/compute-hsdir-set-instability deleted file mode 100755 index 1a5e767..0000000 --- a/task-2649/compute-hsdir-set-instability +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -e - -# This script must be run as ./compute-hsdir-set-instability . - - -find out/consensus-hsdir-lists -type f -print | -sort | -tclsh8.5 compute-hsdir-set-instability.tcl | -tee out/hsdir-set-instability | -sed -e 's/$/ /' | -tr '\n' '\r' - diff --git a/task-2649/compute-hsdir-set-instability.tcl b/task-2649/compute-hsdir-set-instability.tcl deleted file mode 100644 index 24afb97..0000000 --- a/task-2649/compute-hsdir-set-instability.tcl +++ /dev/null @@ -1,83 +0,0 @@ - -set hsdir_set_name_list {} - -array set hsdir_sets {} - -proc read_file_lines {filename} { - set chanid [open $filename r] - set contents [read -nonewline $chanid] - close $chanid - - return [split $contents "\n"] -} - -proc get_hsdir_set_name {filename} { - return [file tail $filename] -} - -proc read_hsdir_set {set_name filename} { - global hsdir_sets - - set hsdir_set [read_file_lines $filename] - set hsdir_sets($set_name) $hsdir_set -} - -proc forget_hsdir_set {name} { - unset -nocomplain hsdir_sets($name) -} - -proc list_set_symmetric_difference_size {l1 l2} { - set l1 [lsort -ascii -unique $l1] - set l2 [lsort -ascii -unique $l2] - set both [lsort -ascii -unique [concat $l1 $l2]] - - set l1i 0 - set l2i 0 - #set result {} - set result_length 0 - - foreach x $both { - set n_inputs_containing_x 0 - if {[lindex $l1 $l1i] eq $x} { - incr l1i - incr n_inputs_containing_x - } - if {[lindex $l2 $l2i] eq $x} { - incr l2i - incr n_inputs_containing_x - } - if {$n_inputs_containing_x & 1} { - #lappend result $x - incr result_length - } - } - - #return $result - return $result_length -} -rename list_set_symmetric_difference_size lssds - -while {![eof stdin]} { - set x [gets stdin hsdir_set_filename] - if {$x == -1} {break} - - set hsdir_set_name [get_hsdir_set_name $hsdir_set_filename] - read_hsdir_set $hsdir_set_name $hsdir_set_filename - - lappend hsdir_set_name_list $hsdir_set_name - - if {[llength $hsdir_set_name_list] == 5} { - lassign $hsdir_set_name_list set0 set1 set2 set3 set4 - - puts "$set0\ - [llength $hsdir_sets($set0)]\ - [lssds $hsdir_sets($set0) $hsdir_sets($set1)]\ - [lssds $hsdir_sets($set0) $hsdir_sets($set2)]\ - [lssds $hsdir_sets($set0) $hsdir_sets($set3)]\ - [lssds $hsdir_sets($set0) $hsdir_sets($set4)]" - - forget_hsdir_set [lindex $hsdir_set_name_list 0] - set hsdir_set_name_list [lrange $hsdir_set_name_list 1 end] - } -} - diff --git a/task-2649/generate-consensus-hsdir-lists b/task-2649/generate-consensus-hsdir-lists deleted file mode 100755 index 9c09ac8..0000000 --- a/task-2649/generate-consensus-hsdir-lists +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -e - -# This script must be run as ./generate-consensus-hsdir-lists . - -# This script will die horribly later if $consensus_archive_dir -# expands to a string containing a shell metacharacter, so don't try -# to not die now. -test -z $consensus_archive_dir && -export consensus_archive_dir=/usr/local/opt/tor-consensuses - - -mkdir -m 0700 -p dev/ -for i in 0 1 2 3 ;do mkfifo -m 0600 dev/in$i dev/out$i || true ;done - -mkdir -p out/consensus-hsdir-lists - - -(cd "$consensus_archive_dir" ;find consensuses-* -type f -print ) | -sed -e 's|^|./list-consensus-hsdirs |' | -linedemux --fname -- dev/in0 dev/in1 dev/in2 dev/in3 & - -sh <dev/in0 >dev/out0 & -sh <dev/in1 >dev/out1 & -sh <dev/in2 >dev/out2 & -sh <dev/in3 >dev/out3 & - -linemux --fname -- dev/out0 dev/out1 dev/out2 dev/out3 - diff --git a/task-2649/graph-hsdir-set-instability b/task-2649/graph-hsdir-set-instability deleted file mode 100755 index 013d287..0000000 --- a/task-2649/graph-hsdir-set-instability +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -e - -# This script must be run as ./graph-hsdir-set-instability . - -gnuplot >out/hsdir-set-instability-graph.ps <<EOF -set terminal postscript color solid -load "graph-hsdir-set-instability.gnuplot" -EOF - diff --git a/task-2649/graph-hsdir-set-instability.gnuplot b/task-2649/graph-hsdir-set-instability.gnuplot deleted file mode 100644 index c497395..0000000 --- a/task-2649/graph-hsdir-set-instability.gnuplot +++ /dev/null @@ -1,12 +0,0 @@ - -set xdata time -set timefmt "%Y-%m-%d-%H-%M-%S" -set format x "%Y-%m" -set xrange ["2011-01-01-00-00-00":] -set yrange [0:1] - -plot "out/hsdir-set-instability" using 1:(0):($6/$2) with filledcurves title "4 hr",\ - "out/hsdir-set-instability" using 1:(0):($5/$2) with filledcurves title "3 hr",\ - "out/hsdir-set-instability" using 1:(0):($4/$2) with filledcurves title "2 hr",\ - "out/hsdir-set-instability" using 1:(0):($3/$2) with filledcurves title "1 hr" - diff --git a/task-2649/list-consensus-hsdirs b/task-2649/list-consensus-hsdirs deleted file mode 100755 index d6edb27..0000000 --- a/task-2649/list-consensus-hsdirs +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -e - -# This script must be run as ./list-consensus-hsdirs , by -# generate-consensus-hsdir-lists. - -consensus_file="$1" - - -consensus_basename="$(basename "$consensus_file" -consensus )" -hsdir_list_dir="out/consensus-hsdir-lists/$(echo "$consensus_basename" |cut -f 1-2 -d - )" -hsdir_list_name="$hsdir_list_dir/$consensus_basename" - - -mkdir -p "$hsdir_list_dir" - -awk -f list-consensus-hsdirs.awk <"$consensus_archive_dir/$consensus_file" >"$hsdir_list_name" - -echo "generated HSDir list $consensus_basename" - diff --git a/task-2649/list-consensus-hsdirs.awk b/task-2649/list-consensus-hsdirs.awk deleted file mode 100644 index 343c5e7..0000000 --- a/task-2649/list-consensus-hsdirs.awk +++ /dev/null @@ -1,25 +0,0 @@ - -BEGIN { - OFS=":" - idDigest="<oops>" -} - -$1 == "r" { - idDigest=$3 -} - -$1 == "s" { - isHSDir=0 - for (i = NF; i >= 1; --i) { - if ($i == "HSDir") { - isHSDir=1 - } - } - - if (isHSDir != 0) { - print idDigest - } - - idDigest="<oops>" -} - diff --git a/task-2714/.gitignore b/task-2714/.gitignore new file mode 100644 index 0000000..46ca2bd --- /dev/null +++ b/task-2714/.gitignore @@ -0,0 +1,3 @@ +dev/ +out/ +*~ diff --git a/task-2714/README b/task-2714/README new file mode 100644 index 0000000..4283696 --- /dev/null +++ b/task-2714/README @@ -0,0 +1,31 @@ + +Purpose: + + These scripts are intended to determine how unstable the set of + relays with the HSDir flag is. + +Dependencies: + + You will need linedemux and linemux installed. See branch parrun in + https://gitweb.torproject.org/rransom/tor-utils.git for now. + + You will also need Tcl 8.5.9 and gnuplot 4.4.0 installed. + +Instructions: + + First, unpack all of the v3 consensus archive tarballs you want to + analyze into a single directory, and set the consensus_archive_dir + environment variable to point to that directory. + + Then run: + + ./generate-consensus-hsdir-lists + ./compute-hsdir-set-instability + ./graph-hsdir-set-instability + +Bugs: + + This code compares each consensus with each of the four following + consensuses; it should compare each hour's consensus with the + consensuses in effect in each of the four following hours. + diff --git a/task-2714/compute-hsdir-set-instability b/task-2714/compute-hsdir-set-instability new file mode 100755 index 0000000..1a5e767 --- /dev/null +++ b/task-2714/compute-hsdir-set-instability @@ -0,0 +1,12 @@ +#!/bin/sh -e + +# This script must be run as ./compute-hsdir-set-instability . + + +find out/consensus-hsdir-lists -type f -print | +sort | +tclsh8.5 compute-hsdir-set-instability.tcl | +tee out/hsdir-set-instability | +sed -e 's/$/ /' | +tr '\n' '\r' + diff --git a/task-2714/compute-hsdir-set-instability.tcl b/task-2714/compute-hsdir-set-instability.tcl new file mode 100644 index 0000000..24afb97 --- /dev/null +++ b/task-2714/compute-hsdir-set-instability.tcl @@ -0,0 +1,83 @@ + +set hsdir_set_name_list {} + +array set hsdir_sets {} + +proc read_file_lines {filename} { + set chanid [open $filename r] + set contents [read -nonewline $chanid] + close $chanid + + return [split $contents "\n"] +} + +proc get_hsdir_set_name {filename} { + return [file tail $filename] +} + +proc read_hsdir_set {set_name filename} { + global hsdir_sets + + set hsdir_set [read_file_lines $filename] + set hsdir_sets($set_name) $hsdir_set +} + +proc forget_hsdir_set {name} { + unset -nocomplain hsdir_sets($name) +} + +proc list_set_symmetric_difference_size {l1 l2} { + set l1 [lsort -ascii -unique $l1] + set l2 [lsort -ascii -unique $l2] + set both [lsort -ascii -unique [concat $l1 $l2]] + + set l1i 0 + set l2i 0 + #set result {} + set result_length 0 + + foreach x $both { + set n_inputs_containing_x 0 + if {[lindex $l1 $l1i] eq $x} { + incr l1i + incr n_inputs_containing_x + } + if {[lindex $l2 $l2i] eq $x} { + incr l2i + incr n_inputs_containing_x + } + if {$n_inputs_containing_x & 1} { + #lappend result $x + incr result_length + } + } + + #return $result + return $result_length +} +rename list_set_symmetric_difference_size lssds + +while {![eof stdin]} { + set x [gets stdin hsdir_set_filename] + if {$x == -1} {break} + + set hsdir_set_name [get_hsdir_set_name $hsdir_set_filename] + read_hsdir_set $hsdir_set_name $hsdir_set_filename + + lappend hsdir_set_name_list $hsdir_set_name + + if {[llength $hsdir_set_name_list] == 5} { + lassign $hsdir_set_name_list set0 set1 set2 set3 set4 + + puts "$set0\ + [llength $hsdir_sets($set0)]\ + [lssds $hsdir_sets($set0) $hsdir_sets($set1)]\ + [lssds $hsdir_sets($set0) $hsdir_sets($set2)]\ + [lssds $hsdir_sets($set0) $hsdir_sets($set3)]\ + [lssds $hsdir_sets($set0) $hsdir_sets($set4)]" + + forget_hsdir_set [lindex $hsdir_set_name_list 0] + set hsdir_set_name_list [lrange $hsdir_set_name_list 1 end] + } +} + diff --git a/task-2714/generate-consensus-hsdir-lists b/task-2714/generate-consensus-hsdir-lists new file mode 100755 index 0000000..9c09ac8 --- /dev/null +++ b/task-2714/generate-consensus-hsdir-lists @@ -0,0 +1,28 @@ +#!/bin/sh -e + +# This script must be run as ./generate-consensus-hsdir-lists . + +# This script will die horribly later if $consensus_archive_dir +# expands to a string containing a shell metacharacter, so don't try +# to not die now. +test -z $consensus_archive_dir && +export consensus_archive_dir=/usr/local/opt/tor-consensuses + + +mkdir -m 0700 -p dev/ +for i in 0 1 2 3 ;do mkfifo -m 0600 dev/in$i dev/out$i || true ;done + +mkdir -p out/consensus-hsdir-lists + + +(cd "$consensus_archive_dir" ;find consensuses-* -type f -print ) | +sed -e 's|^|./list-consensus-hsdirs |' | +linedemux --fname -- dev/in0 dev/in1 dev/in2 dev/in3 & + +sh <dev/in0 >dev/out0 & +sh <dev/in1 >dev/out1 & +sh <dev/in2 >dev/out2 & +sh <dev/in3 >dev/out3 & + +linemux --fname -- dev/out0 dev/out1 dev/out2 dev/out3 + diff --git a/task-2714/graph-hsdir-set-instability b/task-2714/graph-hsdir-set-instability new file mode 100755 index 0000000..013d287 --- /dev/null +++ b/task-2714/graph-hsdir-set-instability @@ -0,0 +1,9 @@ +#!/bin/sh -e + +# This script must be run as ./graph-hsdir-set-instability . + +gnuplot >out/hsdir-set-instability-graph.ps <<EOF +set terminal postscript color solid +load "graph-hsdir-set-instability.gnuplot" +EOF + diff --git a/task-2714/graph-hsdir-set-instability.gnuplot b/task-2714/graph-hsdir-set-instability.gnuplot new file mode 100644 index 0000000..c497395 --- /dev/null +++ b/task-2714/graph-hsdir-set-instability.gnuplot @@ -0,0 +1,12 @@ + +set xdata time +set timefmt "%Y-%m-%d-%H-%M-%S" +set format x "%Y-%m" +set xrange ["2011-01-01-00-00-00":] +set yrange [0:1] + +plot "out/hsdir-set-instability" using 1:(0):($6/$2) with filledcurves title "4 hr",\ + "out/hsdir-set-instability" using 1:(0):($5/$2) with filledcurves title "3 hr",\ + "out/hsdir-set-instability" using 1:(0):($4/$2) with filledcurves title "2 hr",\ + "out/hsdir-set-instability" using 1:(0):($3/$2) with filledcurves title "1 hr" + diff --git a/task-2714/list-consensus-hsdirs b/task-2714/list-consensus-hsdirs new file mode 100755 index 0000000..d6edb27 --- /dev/null +++ b/task-2714/list-consensus-hsdirs @@ -0,0 +1,19 @@ +#!/bin/sh -e + +# This script must be run as ./list-consensus-hsdirs , by +# generate-consensus-hsdir-lists. + +consensus_file="$1" + + +consensus_basename="$(basename "$consensus_file" -consensus )" +hsdir_list_dir="out/consensus-hsdir-lists/$(echo "$consensus_basename" |cut -f 1-2 -d - )" +hsdir_list_name="$hsdir_list_dir/$consensus_basename" + + +mkdir -p "$hsdir_list_dir" + +awk -f list-consensus-hsdirs.awk <"$consensus_archive_dir/$consensus_file" >"$hsdir_list_name" + +echo "generated HSDir list $consensus_basename" + diff --git a/task-2714/list-consensus-hsdirs.awk b/task-2714/list-consensus-hsdirs.awk new file mode 100644 index 0000000..343c5e7 --- /dev/null +++ b/task-2714/list-consensus-hsdirs.awk @@ -0,0 +1,25 @@ + +BEGIN { + OFS=":" + idDigest="<oops>" +} + +$1 == "r" { + idDigest=$3 +} + +$1 == "s" { + isHSDir=0 + for (i = NF; i >= 1; --i) { + if ($i == "HSDir") { + isHSDir=1 + } + } + + if (isHSDir != 0) { + print idDigest + } + + idDigest="<oops>" +} +
tor-commits@lists.torproject.org