aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service_provider.c47
-rw-r--r--service_provider.h2
-rwxr-xr-xtabulate.sh6
-rwxr-xr-xtestmain_preinit.sh4
4 files changed, 39 insertions, 20 deletions
diff --git a/service_provider.c b/service_provider.c
index 79e6cd0..5cb2ec7 100644
--- a/service_provider.c
+++ b/service_provider.c
@@ -73,6 +73,23 @@ struct service_provider {
struct server_profile profile;
};
+/* Profiling */
+static void prof_reset(struct server_profile *prof)
+{
+ memset(prof, 0, sizeof(*prof));
+}
+
+static void prof_add(struct server_profile *prof, const char *label)
+{
+ if(prof->n_times < MAX_TIMES)
+ {
+ prof->times[prof->n_times] = clock();
+ strcpy(prof->labels[prof->n_times], label);
+
+ prof->n_times++;
+ }
+}
+
/* Generate an EQ certificate for inserting a placeholder with index
* placeholder_idx, given an encloser (which must actually enclose
* a). Note: this function will modify the *mt_nodes array to reflect
@@ -108,6 +125,8 @@ 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");
+
/* we need two NU certificates */
hash_t nu1_hmac, nu2_hmac;
@@ -116,21 +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");
/* 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");
int *ins_orders;
hash_t *ins_comp = merkle_complement(sp->iomt, placeholder_leafidx, &ins_orders);
+ prof_add(&sp->profile, "eq4");
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");
/* 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");
free(dep_indices);
free(old_depvalues);
@@ -407,22 +432,6 @@ void sp_free(struct service_provider *sp)
}
}
-static void prof_reset(struct server_profile *prof)
-{
- memset(prof, 0, sizeof(*prof));
-}
-
-static void prof_add(struct server_profile *prof, const char *label)
-{
- if(prof->n_times < MAX_TIMES)
- {
- prof->times[prof->n_times] = clock();
- strcpy(prof->labels[prof->n_times], label);
-
- prof->n_times++;
- }
-}
-
static struct file_record *lookup_record(struct service_provider *sp, uint64_t idx)
{
sqlite3_stmt *st = sp->lookup_record;
@@ -788,10 +797,14 @@ struct tm_request sp_createfile(struct service_provider *sp,
i - 1,
i, i + 1,
&hmac);
+
+ prof_add(&sp->profile, "finish_eqgen");
+
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");
/* next_idx is set to 1 to keep everything circularly linked;
* in the next iteration it will be updated to point to the
@@ -799,8 +812,10 @@ 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");
assert(tm_set_equiv_root(sp->tm, &eq, hmac));
+ prof_add(&sp->profile, "finish_setroot");
sp->n_placeholders++;
}
diff --git a/service_provider.h b/service_provider.h
index f20e5df..5867334 100644
--- a/service_provider.h
+++ b/service_provider.h
@@ -73,7 +73,7 @@ struct user_request {
* struct after the request response */
} __attribute__((packed));
-#define MAX_TIMES 10
+#define MAX_TIMES 30
#define MAX_LABEL 40
/* this struct records a series of clock() times, and labels for them */
diff --git a/tabulate.sh b/tabulate.sh
index 7d70b1d..524909b 100755
--- a/tabulate.sh
+++ b/tabulate.sh
@@ -1,6 +1,6 @@
#!/bin/bash
logleaves_start=10
-logleaves_end=12
+logleaves_end=24
trials=2
runs_test=500
@@ -16,6 +16,10 @@ do
for k in `seq 0 4`
do
start=$(expr $runs_test \* $k + 1)
+ if [[ $k -eq 0 ]]
+ then
+ start=2 # discard first line (with preinserted placeholder)
+ fi
end=$(expr $runs_test \* \( $k + 1 \))
echo -n "$i " > rundata_"$i"_"$j"_"$k".txt
diff --git a/testmain_preinit.sh b/testmain_preinit.sh
index 7be371b..d48cbf0 100755
--- a/testmain_preinit.sh
+++ b/testmain_preinit.sh
@@ -1,10 +1,10 @@
#!/bin/bash
mkdir -p results
-trials=2
+trials=1
runs_test=500
# minimum is ceil(lg(runs_test)), otherwise modify will fail
-for i in `seq 10 12`
+for i in `seq 10 25`
do
echo "logleaves "$i