starpu_fxt_tool.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011-2012 Université de Bordeaux 1
  4. * Copyright (C) 2012 Centre National de la Recherche Scientifique
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. /*
  18. * This program should be used to parse the log generated by FxT
  19. */
  20. #include <starpu.h>
  21. static struct starpu_fxt_options options;
  22. static void parse_args(int argc, char **argv)
  23. {
  24. /* Default options */
  25. starpu_fxt_options_init(&options);
  26. /* We want to support arguments such as "fxt_tool -i trace_*" */
  27. unsigned reading_input_filenames = 0;
  28. int i;
  29. for (i = 1; i < argc; i++) {
  30. if (strcmp(argv[i], "-c") == 0) {
  31. options.per_task_colour = 1;
  32. reading_input_filenames = 0;
  33. continue;
  34. }
  35. if (strcmp(argv[i], "-o") == 0) {
  36. options.out_paje_path = argv[++i];
  37. reading_input_filenames = 0;
  38. continue;
  39. }
  40. if (strcmp(argv[i], "-i") == 0) {
  41. options.filenames[options.ninputfiles++] = argv[++i];
  42. reading_input_filenames = 1;
  43. continue;
  44. }
  45. if (strcmp(argv[i], "-no-counter") == 0) {
  46. options.no_counter = 1;
  47. reading_input_filenames = 0;
  48. continue;
  49. }
  50. if (strcmp(argv[i], "-no-bus") == 0) {
  51. options.no_bus = 1;
  52. reading_input_filenames = 0;
  53. continue;
  54. }
  55. if (strcmp(argv[i], "-h") == 0
  56. || strcmp(argv[i], "--help") == 0) {
  57. fprintf(stderr, "Usage : %s [-c] [-no-counter] [-no-bus] [-i input_filename] [-o output_filename]\n", argv[0]);
  58. fprintf(stderr, "\t-c: use a different colour for every type of task.\n");
  59. exit(-1);
  60. }
  61. /* That's pretty dirty: if the reading_input_filenames flag is
  62. * set, and that the argument does not match an option, we
  63. * assume this may be another filename */
  64. if (reading_input_filenames)
  65. {
  66. options.filenames[options.ninputfiles++] = argv[i];
  67. continue;
  68. }
  69. }
  70. }
  71. int main(int argc, char **argv)
  72. {
  73. parse_args(argc, argv);
  74. if (options.ninputfiles == 0)
  75. return 77;
  76. starpu_fxt_generate_trace(&options);
  77. return 0;
  78. }