Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ThreadChunk : public FRunnable {
- public:
- bool bAlive = true;
- std::chrono::milliseconds msGen;
- std::vector<int> v;
- ThreadChunk()
- {
- }
- uint32 Run()
- {
- while (bAlive) {
- auto t2 = Clock::now();
- v = std::vector<int>();
- for (int i = 0; i < 99999999; i++) {
- v.push_back(rand());
- }
- v = std::vector<int>();
- for (int i = 0; i < 99999999; i++) {
- v.push_back(rand());
- }
- auto t3 = Clock::now();
- msGen = std::chrono::duration_cast<std::chrono::milliseconds>(t3 - t2);
- std::this_thread::yield();
- }
- return 0;
- }
- void Stop() {
- bAlive = false;
- }
- std::chrono::milliseconds GetTimeGen() {
- return msGen;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement