aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-07-31 17:06:31 -0400
committerFranklin Wei <me@fwei.tk>2018-07-31 17:06:31 -0400
commit689bf33a1fc319b7b42ba2f2f2c814f55f29793d (patch)
treedb720ed7715bf615086c94c27facb7a296b6aec8
parent6e8d99ef0f82ae7cac917c45ee279ca851bcd275 (diff)
downloadcsaa-689bf33a1fc319b7b42ba2f2f2c814f55f29793d.zip
csaa-689bf33a1fc319b7b42ba2f2f2c814f55f29793d.tar.gz
csaa-689bf33a1fc319b7b42ba2f2f2c814f55f29793d.tar.bz2
csaa-689bf33a1fc319b7b42ba2f2f2c814f55f29793d.tar.xz
Improve graph generation and add timing code to sp_modifyfile()
The number of timing intervals is no longer hard-coded. Also added some profiling instrumentation to the modify function.
-rw-r--r--client.c8
-rwxr-xr-xgraph.gnu24
-rw-r--r--service_provider.c23
3 files changed, 41 insertions, 14 deletions
diff --git a/client.c b/client.c
index b7706f4..53e3aad 100644
--- a/client.c
+++ b/client.c
@@ -605,6 +605,8 @@ int connect_to_service(const char *sockpath)
return fd;
}
+/* The test scripts depend on the output of this function with -p set
+ * (labels = false, labels_only = false). Do not change! */
void prof_dump(struct server_profile *profile, bool labels)
{
//for(int i = 0; i < profile->n_times; ++i)
@@ -620,10 +622,14 @@ void prof_dump(struct server_profile *profile, bool labels)
fprintf(stderr, "%s%s", profile->labels[i], !labels_only ? " " : "\n");
if(!labels_only)
- fprintf(stderr, "%ld\n", profile->times[i] - profile->times[i - 1]);
+ fprintf(stderr, "%ld%c", profile->times[i] - profile->times[i - 1],
+ (!labels && !labels_only) ? ' ' : '\n');
sum += profile->times[i] - profile->times[i - 1];
}
+
+ if(!labels && !labels_only)
+ fprintf(stderr, "\n");
}
bool server_request(const char *sockpath,
diff --git a/graph.gnu b/graph.gnu
index dba91f9..c0b3d01 100755
--- a/graph.gnu
+++ b/graph.gnu
@@ -5,37 +5,43 @@ set ylabel "avg time per operation (μs)"
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 size 6in,6in
-create_times = 14
-modify_times = 1
-retrieve_times = 5
+set terminal pdf size 6in,6in
+
+create_times = "`wc -l labels_0_create.txt`"
+modify_times = "`wc -l labels_1_modify.txt`"
+retrieve_times = "`wc -l labels_2_retrieve.txt`"
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"
+set output "graph_create.pdf"
+set terminal qt 0
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"
+set output "graph_modify.pdf"
+set terminal qt 1
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"
+set output "graph_retrieve.pdf"
+set terminal qt 2
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"
+set output "graph_modifyenc.pdf"
+set terminal qt 3
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"
+set output "graph_retrieveenc.pdf"
+set terminal qt 4
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/service_provider.c b/service_provider.c
index a1235f0..1844533 100644
--- a/service_provider.c
+++ b/service_provider.c
@@ -946,6 +946,9 @@ struct tm_request sp_modifyfile(struct service_provider *sp,
{
/* modification */
struct file_record *rec = lookup_record(sp, file_idx);
+
+ prof_add(&sp->profile, "FinishDBLookupRecord");
+
if(!rec)
{
printf("Could not find file with index %lu\n", file_idx);
@@ -956,6 +959,8 @@ struct tm_request sp_modifyfile(struct service_provider *sp,
uint64_t file_leafidx;
struct iomt_node file_node = iomt_find_leaf(sp->iomt, file_idx, &file_leafidx);
+ prof_add(&sp->profile, "FinishIOMTFindLeaf");
+
if(!file_node.idx)
{
printf("Couldn't find file node???\n");
@@ -966,17 +971,23 @@ struct tm_request sp_modifyfile(struct service_provider *sp,
file_leafidx,
&file_orders);
+ prof_add(&sp->profile, "FinishComplementCalculation");
+
uint64_t acl_leafidx;
struct iomt_node acl_node = iomt_find_leaf(rec->acl, user_id, &acl_leafidx);
hash_t *acl_comp = merkle_complement(rec->acl,
acl_leafidx,
&acl_orders);
+ prof_add(&sp->profile, "FinishACLComplementCalculation");
+
hash_t gamma = sha256(encrypted_file, filelen);
hash_t h_bc = buildcode ? sha256(buildcode, buildcode_len) : hash_null;
hash_t h_cf = composefile ? sha256(composefile, composefile_len) : hash_null;
hash_t lambda = calc_lambda(gamma, h_bc, h_cf, kf);
+ prof_add(&sp->profile, "FinishCalculateLambda");
+
struct tm_request req = req_filemodify(sp->tm,
&rec->fr_cert, rec->fr_hmac,
file_node,
@@ -993,6 +1004,8 @@ struct tm_request sp_modifyfile(struct service_provider *sp,
hash_t req_hmac = sign_request(userdata, &req);
+ prof_add(&sp->profile, "FinishFillRequestStructure");
+
struct tm_cert vr;
hash_t vr_hmac, fr_hmac;
@@ -1009,6 +1022,8 @@ struct tm_request sp_modifyfile(struct service_provider *sp,
composefile, composefile_len,
NULL);
+ prof_add(&sp->profile, "FinishExecuteRequest");
+
/* We return the request because that is how the module's
* authentication is done. */
if(new_fr.type == FR)
@@ -1102,7 +1117,7 @@ void *sp_retrieve_file(struct service_provider *sp,
{
struct file_record *rec = lookup_record(sp, file_idx);
- prof_add(&sp->profile, "finish_lookup");
+ prof_add(&sp->profile, "FinishDBLookup");
if(!rec || !rec->version)
{
@@ -1118,7 +1133,7 @@ void *sp_retrieve_file(struct service_provider *sp,
version = rec->version;
struct file_version *ver = lookup_version(sp, file_idx, version);
- prof_add(&sp->profile, "finish_lookupver");
+ prof_add(&sp->profile, "FinishDBLookupVersion");
if(!ver)
{
@@ -1131,7 +1146,7 @@ void *sp_retrieve_file(struct service_provider *sp,
struct tm_cert rv1 = cert_rv_by_idx(sp->tm, sp->iomt, file_idx, &rv1_hmac);
struct tm_cert rv2 = cert_rv_by_idx(sp->tm, rec->acl, user_id, &rv2_hmac);
- prof_add(&sp->profile, "finish_rvcerts");
+ prof_add(&sp->profile, "FinishGenerateRVCerts");
if(hash_to_u64(rv2.rv.val) < 1)
{
@@ -1150,7 +1165,7 @@ void *sp_retrieve_file(struct service_provider *sp,
&rec->fr_cert, rec->fr_hmac,
ver->encrypted_secret, ver->kf);
}
- prof_add(&sp->profile, "finish_retsec");
+ prof_add(&sp->profile, "FinishRetrieveSecret");
if(kf)
*kf = ver->kf;