restart.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #include <stdio.h>
  17. #include <unistd.h>
  18. #include <errno.h>
  19. #include <starpu.h>
  20. #include <stdlib.h>
  21. #define N 10
  22. struct timeval start;
  23. struct timeval end;
  24. int main(int argc, char **argv)
  25. {
  26. unsigned iter;
  27. double init_timing = 0.0;
  28. double shutdown_timing = 0.0;
  29. for (iter = 0; iter < N; iter++)
  30. {
  31. gettimeofday(&start, NULL);
  32. /* Initialize StarPU */
  33. starpu_init(NULL);
  34. gettimeofday(&end, NULL);
  35. init_timing += (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
  36. gettimeofday(&start, NULL);
  37. /* Shutdown StarPU */
  38. starpu_shutdown();
  39. gettimeofday(&end, NULL);
  40. shutdown_timing += (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
  41. }
  42. fprintf(stderr, "starpu_init: %2.2f seconds\n", init_timing/(N*1000000));
  43. fprintf(stderr, "starpu_shutdown: %2.2f seconds\n", shutdown_timing/(N*1000000));
  44. return 0;
  45. }