SuperMonkey

Benchmark.c

Jun 6th, 2014
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. # include <windows.h>
  2. # include <stdio.h>
  3. # include <stdlib.h>
  4. # include <time.h>
  5.  
  6. int main(int argc, char** argv) {
  7.     if(argc < 2) {
  8.         printf("Missing argument\n");
  9.         return 1;
  10.     }
  11.  
  12.     char cmd [MAX_PATH];
  13.     memset(cmd, 0, MAX_PATH);
  14.     for(int i =1; i < argc; i++) {
  15.         strcat(cmd, argv[i]);
  16.     }
  17.  
  18.     printf("Executing %s ...\n", cmd);
  19.  
  20.     int beg = clock(), end;
  21.     WinExec(cmd, 0);
  22.     end = clock();
  23.     printf("Execution time : %f ms\n", 1000.0 * (float)(end-beg) / CLOCKS_PER_SEC);
  24.  
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment