Advertisement
RyDeR_

Simple benchmarking macro

Nov 10th, 2011
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.40 KB | None | 0 0
  1. /*
  2.     Simple Benchmarking Macro
  3.     Copyright © 2011 RyDeR`
  4. */
  5.  
  6. #define BENCH(%0,%1) \
  7.     for(new __i, __j = GetTickCount(); ; __i++) \
  8.         if((GetTickCount() - __j) > (%0)) { \
  9.             printf(" \n  [Benchmark] '" %1 "' executed about %.02f times/ms. \n", floatdiv(__i, (%0))); \
  10.             break; \
  11.         } else
  12.  
  13. /*
  14. public OnFilterScriptInit() {
  15.     BENCH(1000, "floatpower") {
  16.         floatpower(5.0, 2.0);
  17.     }
  18.     return 1;
  19. }
  20. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement