Browse Source

moved the timing inside

avadapal 1 year ago
parent
commit
3e3615adf9
1 changed files with 12 additions and 7 deletions
  1. 12 7
      2p-preprocessing/ot_blinds.cpp

+ 12 - 7
2p-preprocessing/ot_blinds.cpp

@@ -199,9 +199,10 @@ void run_test_sender(uint32_t numots, uint32_t bitlength, snd_ot_flavor stype, r
 	
 	response.XOR(X[0]);
 	
-	printf("\n\nLearnt Gamma0 = (X1 /cdot Y0) /oplus T------>>>>>> \n");
-	response.PrintHex();
-
+ #ifdef VERBOSE
+  printf("\n\nLearnt Gamma0 = (X1 /cdot Y0) /oplus T------>>>>>> \n");
+  response.PrintHex();
+ #endif
 	 // std::ofstream gammafile0, X0file, Y0file;
 	 // gammafile0.open ("gamma0.txt", std::ios::out);
 	 // X0file.open("X0.txt", std::ios::out);
@@ -209,17 +210,14 @@ void run_test_sender(uint32_t numots, uint32_t bitlength, snd_ot_flavor stype, r
 
 	  int fd = open("./y0", O_WRONLY, O_CREAT);
  	  ssize_t bytes = write(fd, Y[0]->GetArr(), Y[0]->GetSize());
- 	  std::cout << "bytes = " << bytes << std::endl;
 	  close(fd);
 
 	  int fd2 = open("./x0", O_WRONLY, O_CREAT);
  	  ssize_t bytes2 = write(fd2, X0.GetArr(), X0.GetSize());
- 	  std::cout << "bytes = " << bytes2 << std::endl;
 	  close(fd2);
 
 	   int fd3 = open("./gamma0", O_WRONLY, O_CREAT);
  	  ssize_t bytes3 = write(fd3, response.GetArr(), response.GetSize());
- 	  std::cout << "bytes = " << bytes3 << std::endl;
 	  close(fd3);
 
 	// for(size_t j = 0; j < numots; ++j)
@@ -416,13 +414,20 @@ int main(int argc, char **argv)
 
 		OTExtRec *receiver = NULL;
 
+ 
+	 auto start = std::chrono::steady_clock::now();
 		sender = InitOTExtSnd(selected_options.prot, m_nBaseOTs, m_nChecks, selected_options.usemecr, selected_options.ftype, crypt);
 		receiver = InitOTExtRec(selected_options.prot, m_nBaseOTs, m_nChecks, selected_options.usemecr, selected_options.ftype, crypt);
 		std::cout << "--> : " << getProt(selected_options.prot) << " Sender " << selected_options.numots << " " << getSndFlavor(selected_options.sflavor) << " / " << getRecFlavor(selected_options.rflavor) << " on " << selected_options.bitlen << " bits with " << selected_options.nthreads << " threads, " << getFieldType(selected_options.ftype) << " and" << (selected_options.usemecr ? "" : " no") << " MECR" << std::endl;
 
 		run_test_sender(selected_options.numots, selected_options.bitlen, selected_options.sflavor, selected_options.rflavor, selected_options.nthreads, crypt, sender, receiver);
 
-		delete sender;
+  auto end = std::chrono::steady_clock::now();
+	 
+  std::chrono::duration<double> elapsed_seconds = end - start;
+	 std::cout << "time to generate and evaluate " << nblindbits << "OTs " << " is: " << elapsed_seconds.count() << "s\n";
+		
+  delete sender;
 	}
 	else //Play as OT receiver
 	{