Guest User

test of hd

a guest
Sep 9th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <chrono>
  2. #include <thread>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int*** tab = new int**[3840];
  9.     for(auto i = 0U; i < 3840; ++i)
  10.     {
  11.         tab[i] = new int*[2160];
  12.         for(auto j = 0U; j < 2160; ++j)
  13.             tab[i][j] = new int[3];
  14.     }
  15.  
  16.     long long int time_mean = 0;
  17.  
  18.     for(auto iter = 0U; iter < 1000; ++iter)
  19.     {
  20.         auto t = chrono::high_resolution_clock::now();
  21.  
  22.         for (auto i = 0U; i < 3840; ++i)
  23.             for(auto j = 0U; j < 2160; ++j)
  24.                 for(auto k = 0U; k < 3; ++k)
  25.                     ++tab[i][j][k];
  26.  
  27.         auto t2 = chrono::high_resolution_clock::now();
  28.         time_mean += chrono::duration_cast<chrono::milliseconds>(t2 - t).count();
  29.     }
  30.    
  31.     cout << "Time: " << time_mean / 1000.0  << endl;
  32.     std::this_thread::sleep_for(std::chrono::seconds(10));
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment