taskmanager.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. = StarPU-Top for StarPU =
  3. Copyright (C) 2011
  4. William Braik
  5. Yann Courtois
  6. Jean-Marie Couteyen
  7. Anthony Roy
  8. This library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU Lesser General Public
  10. License as published by the Free Software Foundation; either
  11. version 2.1 of the License, or (at your option) any later version.
  12. This library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. Lesser General Public License for more details.
  16. You should have received a copy of the GNU Lesser General Public
  17. License along with this library; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef TASKMANAGER_H
  21. #define TASKMANAGER_H
  22. #include "starpu_top_types.h"
  23. #include <QDebug>
  24. #include <QtSql/QSqlDatabase>
  25. #include <QtSql/QSqlQuery>
  26. class TaskManager
  27. { /* Manages the tasks received from the server
  28. in a memory SQLITE database. */
  29. public:
  30. TaskManager();
  31. ~TaskManager();
  32. void initialize();
  33. bool connectDatabase();
  34. // Add new tasks
  35. void addTaskPrev(int taskId, int deviceId, qlonglong timestampStart,
  36. qlonglong timestampEnd);
  37. void addTaskStart(int taskId, int deviceId, qlonglong timestampStart);
  38. void addTaskEnd(int taskId, qlonglong timestampEnd);
  39. // Getters
  40. QList<starpu_top_task> tasks(qlonglong timestampStart,
  41. qlonglong timestampEnd);
  42. QList<starpu_top_task> prevTasks(qlonglong timestampStart,
  43. qlonglong timestampEnd);
  44. private:
  45. // Metadata
  46. // Database
  47. QSqlDatabase _database;
  48. // Queries
  49. QSqlQuery _insertTaskPrevQuery;
  50. QSqlQuery _insertTaskStartQuery;
  51. QSqlQuery _updateTaskEndQuery;
  52. QSqlQuery _selectTasksQuery;
  53. QSqlQuery _selectPrevTasksQuery;
  54. };
  55. #endif // TASKMANAGER_H