aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-07-31 16:24:23 -0400
committerFranklin Wei <me@fwei.tk>2018-07-31 16:24:23 -0400
commit452ec03a9757fdfdec27f2af30b25225f3bb0db6 (patch)
tree9a7bfe2d0efa1fc3f83441f9b2fec8f9f490fde4
parent870a4d60323034701a4bd60b9620fb9688efd5b4 (diff)
downloadcsaa-452ec03a9757fdfdec27f2af30b25225f3bb0db6.zip
csaa-452ec03a9757fdfdec27f2af30b25225f3bb0db6.tar.gz
csaa-452ec03a9757fdfdec27f2af30b25225f3bb0db6.tar.bz2
csaa-452ec03a9757fdfdec27f2af30b25225f3bb0db6.tar.xz
Improve graph generation
Graphs are now stacked and labeled according to the timing points in the source.
-rw-r--r--client.c32
-rwxr-xr-xgenlabels.sh18
-rwxr-xr-xgraph.gnu33
-rw-r--r--postprocess.cpp2
-rw-r--r--service_provider.c26
-rwxr-xr-xtabulate.sh5
-rwxr-xr-xtestall.sh2
-rwxr-xr-xtestmain_preinit.sh2
-rwxr-xr-xtestmodify.sh2
9 files changed, 86 insertions, 36 deletions
diff --git a/client.c b/client.c
index b81902a..b7706f4 100644
--- a/client.c
+++ b/client.c
@@ -18,6 +18,18 @@
* retrieveinfo -f FILEIDX [-v VERSION]
*
* retrievefile -f FILEIDX [-v VERSION] -o IMAGE_OUT
+ *
+ * The following options can be used to alter the client's behavior
+ * with any command:
+ *
+ * -p, --profile
+ * request a performance profile from the server
+ *
+ * -l, --labels
+ * print profile labels as well (use with -p)
+ *
+ * --labels-only
+ * print only profile labels (use with -p)
*/
#define CLIENT
@@ -44,6 +56,7 @@ static uint64_t user_id = 0;
static struct user_request cl_request;
static struct iomt *new_acl = NULL;
static const char *buildcode_path = NULL, *compose_path = NULL, *image_path = NULL, *file_key = NULL;
+static bool labels = false, labels_only = false;
int compare_tuple(const void *p1, const void *p2)
{
@@ -189,6 +202,14 @@ bool parse_args(int argc, char *argv[])
{
cl_request.profile = true;
}
+ else if(!strcmp(arg, "-l") || !strcmp(arg, "--labels"))
+ {
+ labels = true;
+ }
+ else if(!strcmp(arg, "--labels-only"))
+ {
+ labels_only = true;
+ }
else if(!strcmp(arg, "create"))
{
if(cl_request.type != USERREQ_NONE)
@@ -584,7 +605,7 @@ int connect_to_service(const char *sockpath)
return fd;
}
-void prof_dump(struct server_profile *profile)
+void prof_dump(struct server_profile *profile, bool labels)
{
//for(int i = 0; i < profile->n_times; ++i)
//fprintf(stderr, "%s ", profile->labels[i]);
@@ -595,11 +616,14 @@ void prof_dump(struct server_profile *profile)
/* TODO: use partial sums? */
for(int i = 1; i < profile->n_times; ++i)
{
- fprintf(stderr, "%ld ", profile->times[i] - profile->times[i - 1]);
+ if(labels || labels_only)
+ fprintf(stderr, "%s%s", profile->labels[i], !labels_only ? " " : "\n");
+
+ if(!labels_only)
+ fprintf(stderr, "%ld\n", profile->times[i] - profile->times[i - 1]);
sum += profile->times[i] - profile->times[i - 1];
}
- fprintf(stderr, "\n");
}
bool server_request(const char *sockpath,
@@ -772,7 +796,7 @@ bool server_request(const char *sockpath,
if(req.profile)
{
/* dump to stderr */
- prof_dump(&profile);
+ prof_dump(&profile, labels);
}
return success;
diff --git a/genlabels.sh b/genlabels.sh
new file mode 100755
index 0000000..0fbd3a1
--- /dev/null
+++ b/genlabels.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+echo "Initializing..."
+rm files -rf
+
+./server 10 csaa.db --overwrite > /dev/null &
+pid=$!
+sleep .2
+
+# the three operations should have the same labels no matter if
+# they're encrypted or not
+./client -u 1 -k a create # prime
+./client -u 1 -k a create -p --labels-only 2> labels_0_create.txt
+./client -u 1 -k a modifyfile -f 1 -i container1/hello-world.tar -p --labels-only 2> labels_1_modify.txt
+./client -u 1 -k a retrievefile -f 1 -o out -p --labels-only 2> labels_2_retrieve.txt
+
+kill -SIGINT $pid
+rm csaa.db
diff --git a/graph.gnu b/graph.gnu
index 9f30c7b..dba91f9 100755
--- a/graph.gnu
+++ b/graph.gnu
@@ -1,32 +1,41 @@
#!/usr/bin/gnuplot
+set key below
set xlabel "logleaves"
set ylabel "avg time per operation (μs)"
-set yrange [0:]
+set yrange [0:2000]
set style line 1 lc rgb '#0060ad' lt 1 lw 2 pt -1 ps 0
set style line 3 pt -1 ps 0
-set terminal eps
+set terminal eps size 6in,6in
+
+create_times = 14
+modify_times = 1
+retrieve_times = 5
+
+create_labels = "`cat labels_0_create.txt | tr "\n" " "`"
+modify_labels = "`cat labels_1_modify.txt | tr "\n" " "`"
+retrieve_labels = "`cat labels_2_retrieve.txt | tr "\n" " "`"
set output "graph_create.eps"
-plot for[i=1:4] 'results/final_data_0_'.i.'.txt' u 1:2:3 title 'Create subtime '.i w yerrorbars, \
- for[i=1:4] 'results/final_data_0_'.i.'.txt' u 1:2 w lines ls i;
+plot for[i=3 * create_times - 1:2:-3] '< paste results/final_data_0_*.txt' u 1:(sum [col=2:i] column(col)) title 'Create '.word(create_labels, (i+1) / 3) w filledcurves x1, \
+ for[i=3 * create_times - 1:2:-3] '< paste results/final_data_0_*.txt' u 1:(sum [col=2:i] column(col)):i+1 title '+/- 1.96 SE' w yerrorbars ls 1;
set output "graph_modify.eps"
-plot for[i=1:1] 'results/final_data_1_'.i.'.txt' u 1:2:3 title 'Modify subtime '.i w yerrorbars ls 1, \
- for[i=1:1] 'results/final_data_1_'.i.'.txt' u 1:2 w lines ls i;
+plot for[i=3 * modify_times - 1:2:-3] '< paste results/final_data_1_*.txt' u 1:(sum [col=2:i] column(col)) title 'Modify '.word(modify_labels, (i+1) / 3) w filledcurves x1, \
+ for[i=3 * modify_times - 1:2:-3] '< paste results/final_data_1_*.txt' u 1:(sum [col=2:i] column(col)):i+1 title '+/- 1.96 SE' w yerrorbars ls 1;
set output "graph_retrieve.eps"
-plot for[i=1:5] 'results/final_data_2_'.i.'.txt' u 1:2:3 title 'Retrieve subtime '.i w yerrorbars ls 1, \
-for[i=1:5] 'results/final_data_2_'.i.'.txt' u 1:2 w lines ls i;
+plot for[i=3 * retrieve_times - 1:2:-3] '< paste results/final_data_2_*.txt' u 1:(sum [col=2:i] column(col)) title 'Retrieve '.word(retrieve_labels, (i+1) / 3) w filledcurves x1, \
+ for[i=3 * retrieve_times - 1:2:-3] '< paste results/final_data_2_*.txt' u 1:(sum [col=2:i] column(col)):i+1 title '+/- 1.96 SE' w yerrorbars ls 1;
set output "graph_modifyenc.eps"
-plot for[i=1:1] 'results/final_data_3_'.i.'.txt' u 1:2:3 title 'Modify (encrypted) subtime '.i w yerrorbars ls 1, \
-for[i=1:1] 'results/final_data_3_'.i.'.txt' u 1:2 w lines ls i;
+plot for[i=3 * modify_times - 1:2:-3] '< paste results/final_data_3_*.txt' u 1:(sum [col=2:i] column(col)) title 'Encrypted modify '.word(modify_labels, (i+1) / 3) w filledcurves x1, \
+ for[i=3 * modify_times - 1:2:-3] '< paste results/final_data_3_*.txt' u 1:(sum [col=2:i] column(col)):i+1 title '+/- 1.96 SE' w yerrorbars ls 1;
set output "graph_retrieveenc.eps"
-plot for[i=1:5] 'results/final_data_4_'.i.'.txt' u 1:2:3 title 'Retrieve (encrypted) subtime '.i w yerrorbars ls 1, \
-for[i=1:5] 'results/final_data_4_'.i.'.txt' u 1:2 w lines ls i;
+plot for[i=3 * retrieve_times - 1:2:-3] '< paste results/final_data_4_*.txt' u 1:(sum [col=2:i] column(col)) title 'Encrypted retrieve '.word(retrieve_labels, (i+1) / 3) w filledcurves x1, \
+ for[i=3 * retrieve_times - 1:2:-3] '< paste results/final_data_4_*.txt' u 1:(sum [col=2:i] column(col)):i+1 title '+/- 1.96 SE' w yerrorbars ls 1;
diff --git a/postprocess.cpp b/postprocess.cpp
index 7fe230a..c5f0663 100644
--- a/postprocess.cpp
+++ b/postprocess.cpp
@@ -52,7 +52,7 @@ int main()
var += del * del;
}
- if(counts[i] == 0)
+ if(counts[i] <= 1)
stddevs[i] = 0;
else
stddevs[i] = sqrt(var / (counts[i] - 1));
diff --git a/service_provider.c b/service_provider.c
index 5cb2ec7..a1235f0 100644
--- a/service_provider.c
+++ b/service_provider.c
@@ -125,7 +125,7 @@ struct tm_cert cert_eq(struct service_provider *sp,
int *enc_orders;
hash_t *enc_comp = merkle_complement(sp->iomt, encloser_leafidx, &enc_orders);
- prof_add(&sp->profile, "eq1");
+ prof_add(&sp->profile, "EQGenComputeHashes");
/* we need two NU certificates */
hash_t nu1_hmac, nu2_hmac;
@@ -135,27 +135,27 @@ struct tm_cert cert_eq(struct service_provider *sp,
enc_comp, enc_orders, sp->iomt->mt_logleaves,
&nu1_hmac);
- prof_add(&sp->profile, "eq2");
+ prof_add(&sp->profile, "EQGenNUGeneration1");
/* We now update the ancestors of the encloser node. */
hash_t *old_depvalues = malloc(sizeof(hash_t) * sp->iomt->mt_logleaves);
merkle_update(sp->iomt, encloser_leafidx, h_encmod, old_depvalues);
- prof_add(&sp->profile, "eq3");
+ prof_add(&sp->profile, "EQGenEncloserInsert");
int *ins_orders;
hash_t *ins_comp = merkle_complement(sp->iomt, placeholder_leafidx, &ins_orders);
- prof_add(&sp->profile, "eq4");
+ prof_add(&sp->profile, "EQGenComplementCalculation");
struct tm_cert nu2 = tm_cert_node_update(sp->tm,
hash_null, h_ins,
ins_comp, ins_orders, sp->iomt->mt_logleaves,
&nu2_hmac);
- prof_add(&sp->profile, "eq5");
+ prof_add(&sp->profile, "EQGenNUGeneration2");
/* restore the tree */
uint64_t *dep_indices = bintree_ancestors(encloser_leafidx, sp->iomt->mt_logleaves);
restore_nodes(sp->iomt, dep_indices, old_depvalues, sp->iomt->mt_logleaves);
- prof_add(&sp->profile, "eq6");
+ prof_add(&sp->profile, "EQGenRestoreTree");
free(dep_indices);
free(old_depvalues);
@@ -798,13 +798,13 @@ struct tm_request sp_createfile(struct service_provider *sp,
i, i + 1,
&hmac);
- prof_add(&sp->profile, "finish_eqgen");
+ prof_add(&sp->profile, "FinishEQGen");
assert(eq.type == EQ);
/* update previous leaf's index */
iomt_update_leaf_nextidx(sp->iomt, i - 1, i + 1);
- prof_add(&sp->profile, "finish_updateprev");
+ prof_add(&sp->profile, "UpdatePrevLeaf");
/* next_idx is set to 1 to keep everything circularly linked;
* in the next iteration it will be updated to point to the
@@ -812,15 +812,15 @@ struct tm_request sp_createfile(struct service_provider *sp,
/* for random indices, recall the encloser's old next index,
* and use that here */
iomt_update_leaf_full(sp->iomt, i, i + 1, 1, hash_null);
- prof_add(&sp->profile, "finish_updatecur");
+ prof_add(&sp->profile, "UpdateNewLeaf");
assert(tm_set_equiv_root(sp->tm, &eq, hmac));
- prof_add(&sp->profile, "finish_setroot");
+ prof_add(&sp->profile, "RootTransition");
sp->n_placeholders++;
}
- prof_add(&sp->profile, "finish_placeholder_insert");
+ prof_add(&sp->profile, "FinishPlaceholderInsert");
printf("Allocated leaf index %lu\n", i);
@@ -844,7 +844,7 @@ struct tm_request sp_createfile(struct service_provider *sp,
hash_t req_hmac = sign_request(userdata, &req);
hash_t fr_hmac;
- prof_add(&sp->profile, "finish_populate_request");
+ prof_add(&sp->profile, "FinishFillRequest");
struct tm_cert fr_cert = sp_request(sp,
&req, req_hmac,
@@ -857,7 +857,7 @@ struct tm_request sp_createfile(struct service_provider *sp,
NULL, 0,
acl);
- prof_add(&sp->profile, "finish_exec_request");
+ prof_add(&sp->profile, "FinishExecutingRequest");
sp->n_placeholders--;
diff --git a/tabulate.sh b/tabulate.sh
index 524909b..9ddcad4 100755
--- a/tabulate.sh
+++ b/tabulate.sh
@@ -1,7 +1,7 @@
#!/bin/bash
logleaves_start=10
-logleaves_end=24
-trials=2
+logleaves_end=12
+trials=1
runs_test=500
rm -f all_*.txt dummy_all_*.txt
@@ -25,7 +25,6 @@ do
echo -n "$i " > rundata_"$i"_"$j"_"$k".txt
cat run_"$i"_"$j".txt | sed -n $start,$end'p' | ../average.sh | awk '{printf($1" ");}' >> rundata_"$i"_"$j"_"$k".txt
done
- echo >> all_"$i".txt
cat dummy_"$i"_"$j".txt | awk '/Elapsed/ || /Maximum/ || /User time/ || /System time/' | awk 'BEGIN{line=0}{if(line%4<=1)printf($4" ");if(line %4==2)printf($8" ");if(line%4==3)printf($6" ");}{line+=1}END{printf("\n");}' >> dummy_all_"$i".txt
done
diff --git a/testall.sh b/testall.sh
index 600ffe2..4254741 100755
--- a/testall.sh
+++ b/testall.sh
@@ -6,7 +6,7 @@ then
fi
runs_create=$2
-runs_test=$3
+runs_test=$(echo "$3 - 1" | bc)
echo "Initializing..."
rm files -rf
diff --git a/testmain_preinit.sh b/testmain_preinit.sh
index d48cbf0..da7ca20 100755
--- a/testmain_preinit.sh
+++ b/testmain_preinit.sh
@@ -4,7 +4,7 @@ trials=1
runs_test=500
# minimum is ceil(lg(runs_test)), otherwise modify will fail
-for i in `seq 10 25`
+for i in `seq 10 12`
do
echo "logleaves "$i
diff --git a/testmodify.sh b/testmodify.sh
index 69800f8..31bce52 100755
--- a/testmodify.sh
+++ b/testmodify.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# modify files $3 - ($3 + 2), creating a new version with fixed contents
+# modify files $3 - ($3 + $2), creating a new version with fixed contents
echo "Modify:"
stop=$(echo "$3+$2" | bc)