Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <fstream>
- #define FRAME_RT 0.0333333f //this is 1 divided by 30, each time stamp for 30 FPS
- int main()
- {
- std::ofstream f("check.txt"); //check with word count after you run the code
- int a, b;
- time_t clk;
- while (clock() < CLOCKS_PER_SEC) //count until 1 second
- {
- clk = clock();
- a = 25; b = 70;
- for (int i = 0; i < 100; i++) {a = a^b; b = a^b; a = a^b;} //whatever, just process test
- f << "FPS "; //frame indicator
- while((float)(clock() - clk) / CLOCKS_PER_SEC < FRAME_RT); //wait until 1/30 of a second
- }
- f.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement