starpu_fxt_tool.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011 Université de Bordeaux 1
  4. *
  5. * StarPU 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. * StarPU 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. /*
  17. * This program should be used to parse the log generated by FxT
  18. */
  19. #include <starpu.h>
  20. #include <starpu_fxt.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. fprintf(stderr, "Usage : %s [-c] [-no-counter] [-no-bus] [-i input_filename] [-o output_filename]\n", argv[0]);
  57. fprintf(stderr, "\t-c: use a different colour for every type of task.\n");
  58. exit(-1);
  59. }
  60. /* That's pretty dirty: if the reading_input_filenames flag is
  61. * set, and that the argument does not match an option, we
  62. * assume this may be another filename */
  63. if (reading_input_filenames)
  64. {
  65. options.filenames[options.ninputfiles++] = argv[i];
  66. continue;
  67. }
  68. }
  69. }
  70. int main(int argc, char **argv)
  71. {
  72. parse_args(argc, argv);
  73. starpu_fxt_generate_trace(&options);
  74. return 0;
  75. }