restart.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * StarPU
  3. * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (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 <sys/time.h>
  17. #include <stdio.h>
  18. #include <unistd.h>
  19. #include <errno.h>
  20. #include <starpu.h>
  21. #include <stdlib.h>
  22. #define N 10
  23. struct timeval start;
  24. struct timeval end;
  25. int main(int argc, char **argv)
  26. {
  27. unsigned iter;
  28. double init_timing = 0.0;
  29. double shutdown_timing = 0.0;
  30. for (iter = 0; iter < N; iter++)
  31. {
  32. gettimeofday(&start, NULL);
  33. /* Initialize StarPU */
  34. starpu_init(NULL);
  35. gettimeofday(&end, NULL);
  36. init_timing += (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
  37. gettimeofday(&start, NULL);
  38. /* Shutdown StarPU */
  39. starpu_shutdown();
  40. gettimeofday(&end, NULL);
  41. shutdown_timing += (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
  42. }
  43. fprintf(stderr, "starpu_init: %2.2f seconds\n", init_timing/(N*1000000));
  44. fprintf(stderr, "starpu_shutdown: %2.2f seconds\n", shutdown_timing/(N*1000000));
  45. return 0;
  46. }