starpu_fxt_tool.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. static struct starpu_fxt_options options;
  21. static void parse_args(int argc, char **argv)
  22. {
  23. /* Default options */
  24. starpu_fxt_options_init(&options);
  25. /* We want to support arguments such as "fxt_tool -i trace_*" */
  26. unsigned reading_input_filenames = 0;
  27. int i;
  28. for (i = 1; i < argc; i++) {
  29. if (strcmp(argv[i], "-c") == 0) {
  30. options.per_task_colour = 1;
  31. reading_input_filenames = 0;
  32. continue;
  33. }
  34. if (strcmp(argv[i], "-o") == 0) {
  35. options.out_paje_path = argv[++i];
  36. reading_input_filenames = 0;
  37. continue;
  38. }
  39. if (strcmp(argv[i], "-i") == 0) {
  40. options.filenames[options.ninputfiles++] = argv[++i];
  41. reading_input_filenames = 1;
  42. continue;
  43. }
  44. if (strcmp(argv[i], "-no-counter") == 0) {
  45. options.no_counter = 1;
  46. reading_input_filenames = 0;
  47. continue;
  48. }
  49. if (strcmp(argv[i], "-no-bus") == 0) {
  50. options.no_bus = 1;
  51. reading_input_filenames = 0;
  52. continue;
  53. }
  54. if (strcmp(argv[i], "-h") == 0) {
  55. fprintf(stderr, "Usage : %s [-c] [-no-counter] [-no-bus] [-i input_filename] [-o output_filename]\n", argv[0]);
  56. fprintf(stderr, "\t-c: use a different colour for every type of task.\n");
  57. exit(-1);
  58. }
  59. /* That's pretty dirty: if the reading_input_filenames flag is
  60. * set, and that the argument does not match an option, we
  61. * assume this may be another filename */
  62. if (reading_input_filenames)
  63. {
  64. options.filenames[options.ninputfiles++] = argv[i];
  65. continue;
  66. }
  67. }
  68. }
  69. int main(int argc, char **argv)
  70. {
  71. parse_args(argc, argv);
  72. starpu_fxt_generate_trace(&options);
  73. return 0;
  74. }