dag-dot.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 <stdint.h>
  18. #include "fxt-tool.h"
  19. static char *out_path = "dag.dot";
  20. static FILE *out_file;
  21. void init_dag_dot(void)
  22. {
  23. /* create a new file */
  24. out_file = fopen(out_path, "w+");
  25. fprintf(out_file, "digraph G {\n");
  26. fprintf(out_file, "\tcolor=white\n");
  27. fprintf(out_file, "\trankdir=LR;\n");
  28. }
  29. void terminate_dat_dot(void)
  30. {
  31. fprintf(out_file, "}\n");
  32. fclose(out_file);
  33. }
  34. void add_deps(uint64_t child, uint64_t father)
  35. {
  36. fprintf(out_file, "\t \"%llx\"->\"%llx\"\n",
  37. (unsigned long long)father, (unsigned long long)child);
  38. }
  39. void dot_set_tag_done(uint64_t tag, char *color)
  40. {
  41. fprintf(out_file, "\t \"%llx\" \[ style=filled, label=\"\", color=\"%s\"]\n",
  42. (unsigned long long)tag, color);
  43. }