ganttwidget.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 GANTTWIDGET_H
  21. #define GANTTWIDGET_H
  22. class MainWindow;
  23. class TaskManager;
  24. #include <QGLWidget>
  25. #include <QPainter>
  26. #include "starpu_top_types.h"
  27. class GanttWidget : public QGLWidget
  28. {
  29. Q_OBJECT
  30. public:
  31. explicit GanttWidget(
  32. MainWindow *mainWindow,
  33. TaskManager *taskManager);
  34. ~GanttWidget();
  35. public slots:
  36. void updateZoom(double value);
  37. void updatePrevLine(double value);
  38. void updateTimeView(int time);
  39. void connected();
  40. void disconnected();
  41. void ganttLocked();
  42. void ganttUnlocked();
  43. protected:
  44. void paintEvent(QPaintEvent *event);
  45. void paint(QPainter *painter, QPaintEvent *event);
  46. void drawPUs(QPainter *painter);
  47. void drawTime(QPainter *painter);
  48. void drawProgram(QPainter *painter);
  49. void resizeGL (int width,int height);
  50. void drawWorkPU(QPainter *painter, starpu_top_task t);
  51. void drawIdlePU(QPainter *painter);
  52. void drawPrevWorkPU(QPainter *painter, starpu_top_task t);
  53. void defaultScreen(QPainter *painter);
  54. void drawPresentLine(QPainter *painter);
  55. int computeTimeInterval(int timeTotal);
  56. qreal coordxForTime(qlonglong timestamp_ms);
  57. void drawFromTime(QPainter *painter, qlonglong timestamp);
  58. void countPUs();
  59. private:
  60. MainWindow *_mainWindow;
  61. TaskManager *_taskManager;
  62. QBrush _background;
  63. QFont _textFont;
  64. QPen _textPen;
  65. QRectF _rectTime;
  66. QRectF _rectProg;
  67. QRectF _rectCPUblock;
  68. QRectF _rectGPUblock;
  69. QRectF *_rectPUs;
  70. QRectF _linePresent;
  71. qreal _coordxPresentLine;
  72. int _numPUs;
  73. bool _wasRunning;
  74. QList<starpu_top_task> _tasks;
  75. int _timeTotal;
  76. int _timeAfter;
  77. int _timeBefore;
  78. double _lastValPrevLine;
  79. QTimer *_timer;
  80. qlonglong _timePresent;
  81. qlonglong _timeToShow;
  82. starpu_top_device *_PUsByDevice;
  83. starpu_top_device *_PUsByPos;
  84. int _numCPUs;
  85. int _numGPUs;
  86. bool _initCompleted;
  87. int _heightPU; // Height of each CPU or GPU rectangles
  88. };
  89. #endif // GANTTWIDGET_H