Advertisement
Guest User

Untitled

a guest
Dec 16th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <boost/date_time/posix_time/posix_time_types.hpp>
  4. #include "crc.hpp"
  5.  
  6. void some(boost::crc_32_type& result, void* ptr, size_t size);
  7.  
  8. int main()
  9. {
  10.   std::vector<char> v(32 * 1024 * 1024, 42);
  11.   boost::crc_32_type result;
  12.  
  13.   const int LOOP_CNT = 10;
  14.   boost::posix_time::ptime t1 = boost::posix_time::microsec_clock::universal_time();
  15.  
  16.   for (int i=0; i<LOOP_CNT; i++)
  17.     some(result, &v[0], v.size());
  18.  
  19.   boost::posix_time::ptime t2 = boost::posix_time::microsec_clock::universal_time();
  20.  
  21.   std::cout << std::hex << result.checksum() << std::endl;
  22.   std::cout << "Time: " << (t2 - t1).total_milliseconds() / float(LOOP_CNT) << std::endl;
  23.  
  24.   return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement