--- bench_oram_read.oc.orig 2018-02-19 19:03:45.000000000 -0500 +++ bench_oram_read.oc 2023-02-06 08:16:10.000000000 -0500 @@ -79,8 +79,8 @@ } } else if (arg == 'i') { samples = atoi(optarg); - if (samples <= 0) { - fprintf (stderr, "Argument for -%c must be positive.\n", arg); + if (samples < 0) { + fprintf (stderr, "Argument for -%c must be nonnegative.\n", arg); return; } } else if (arg == '?' || arg == ':') { @@ -96,10 +96,6 @@ } } - #ifndef ORAM_PROFILE_SCHEDULING - fprintf(stdout, "# ORAM ACCESS (READ) (element count, element size, sample 1 microseconds, sample 1 gates, sample 1 bytes, ...)\n"); - #endif - OcCopy cpy = ocCopyIntN(elsz); uint64_t tally = 0; @@ -107,10 +103,21 @@ uint64_t tallybytes = 0; obliv uint32_t * output = calloc(1, elsz * sizeof(obliv uint32_t)); + int64_t startuptime = -current_timestamp(); + int64_t startupgates = -yaoGateCount(); + int64_t startupbytes = -tcp2PBytesSent(ocCurrentProto()); oram * o = oram_new(ORAM_TYPE_AUTO, &cpy, elct); + startuptime += current_timestamp(); + startupgates += yaoGateCount(); + startupbytes += tcp2PBytesSent(ocCurrentProto()); #ifndef ORAM_PROFILE_SCHEDULING + fprintf(stdout, "# ORAM ACCESS (SETUP) (element count, element size, startup microseconds, startup gates, startup bytes)\n"); fprintf(stdout, "%lld,%lld", elct, elsz); + fprintf(stdout, ",%llu,%llu,%llu\n", startuptime,startupgates,startupbytes); + fprintf(stdout, "# ORAM ACCESS (READ) (element count, element size, sample 1 microseconds, sample 1 gates, sample 1 bytes, ...)\n"); + fprintf(stdout, "%lld,%lld", elct, elsz); + fflush(stdout); #endif for (int ii = 0; ii < samples; ii++) { @@ -137,6 +144,8 @@ #ifndef ORAM_PROFILE_SCHEDULING fprintf(stdout, "\n"); #endif + if (samples > 0) { fprintf(stderr, "ORAM Read (count:%lld, size: %lld): %llu microseconds avg, %llu gates avg, %llu bytes avg\n", elct, elsz, tally / samples, tallygates/samples, tallybytes/samples); + } } --- bench_oram_write.oc.orig 2018-02-19 19:03:45.000000000 -0500 +++ bench_oram_write.oc 2023-02-06 08:22:19.000000000 -0500 @@ -79,8 +79,8 @@ } } else if (arg == 'i') { samples = atoi(optarg); - if (samples <= 0) { - fprintf (stderr, "Argument for -%c must be positive.\n", arg); + if (samples < 0) { + fprintf (stderr, "Argument for -%c must be nonnegative.\n", arg); return; } } else if (arg == '?' || arg == ':') { @@ -96,10 +96,6 @@ } } - #ifndef ORAM_PROFILE_SCHEDULING - fprintf(stdout, "# ORAM ACCESS (WRITE) (element count, element size, sample 1 microseconds, sample 1 gates, sample 1 bytes, ...)\n"); - #endif - OcCopy cpy = ocCopyIntN(elsz); uint64_t tally = 0; @@ -107,10 +103,21 @@ uint64_t tallybytes = 0; obliv uint32_t * input = calloc(1, elsz * sizeof(obliv uint32_t)); + int64_t startuptime = -current_timestamp(); + int64_t startupgates = -yaoGateCount(); + int64_t startupbytes = -tcp2PBytesSent(ocCurrentProto()); oram * o = oram_new(ORAM_TYPE_AUTO, &cpy, elct); + startuptime += current_timestamp(); + startupgates += yaoGateCount(); + startupbytes += tcp2PBytesSent(ocCurrentProto()); #ifndef ORAM_PROFILE_SCHEDULING + fprintf(stdout, "# ORAM ACCESS (SETUP) (element count, element size, startup microseconds, startup gates, startup bytes)\n"); fprintf(stdout, "%lld,%lld", elct, elsz); + fprintf(stdout, ",%llu,%llu,%llu\n", startuptime,startupgates,startupbytes); + fprintf(stdout, "# ORAM ACCESS (WRITE) (element count, element size, sample 1 microseconds, sample 1 gates, sample 1 bytes, ...)\n"); + fprintf(stdout, "%lld,%lld", elct, elsz); + fflush(stdout); #endif for (int ii = 0; ii < samples; ii++) { @@ -138,6 +145,8 @@ #ifndef ORAM_PROFILE_SCHEDULING fprintf(stdout, "\n"); #endif + if (samples > 0) { fprintf(stderr, "ORAM Write (count:%lld, size: %lld): %llu microseconds avg, %llu gates avg, %llu bytes avg\n", elct, elsz, tally / samples, tallygates/samples, tallybytes/samples); + } }