Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <unistd.h>
- #include <stdio.h>
- #include <time.h>
- int main()
- {
- char buffer[4096];
- for (long i = 0; i < 500000000; ++i);
- clock_t start = clock();
- for (long i = 1; ; ++i)
- {
- if (i % 5000000 == 0)
- {
- double elapsed = (clock() - start) / (CLOCKS_PER_SEC * 1.0);
- double amount = i / elapsed;
- printf("*** TICK ***, amount: %ld, elapsed: %fs, syscall/s: %f\n", i, elapsed, amount);
- }
- write(1, buffer, 0);
- }
- }
- // Before: *** TICK ***, amount: 170000000, elapsed: 34.213585s, syscall/s: 4968786.521494
- // After: *** TICK ***, amount: 40000000, elapsed: 14.232020s, syscall/s: 2810563.785042
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement