starpu_top_types.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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 STARPU_TOP_TYPES_H
  21. #define STARPU_TOP_TYPES_H
  22. #include <QString>
  23. #include <QStringList>
  24. #include <QVector>
  25. /* -------------------------------------------------------------------------- */
  26. /* Display modes */
  27. /* -------------------------------------------------------------------------- */
  28. enum DisplayMode
  29. {
  30. DISPLAY_FLYING_WINDOWS = 0, DISPLAY_MDI_NORMAL = 1,
  31. };
  32. /* -------------------------------------------------------------------------- */
  33. /* Widgets */
  34. /* -------------------------------------------------------------------------- */
  35. // Types
  36. enum DataWidgetType
  37. {
  38. // Data widgets
  39. /** You must pass any modification to the following functions :
  40. MainWindow::initDataWidgetLists(),
  41. DataWidget::DataWidget(),
  42. DataWidget::updateValue() **/
  43. DATA_WIDGET_NONE = -1,
  44. DATA_WIDGET_LCD = 0,
  45. DATA_WIDGET_PLOT = 1,
  46. DATA_WIDGET_LEVEL = 2,
  47. DATA_WIDGET_LED = 3,
  48. DATA_WIDGET_DIAL = 4,
  49. };
  50. enum InteractiveWidgetType
  51. {
  52. // Interactive widgets
  53. /** You must pass any modification to the following functions :
  54. MainWindow::initInteractiveWidgetLists(),
  55. InteractiveWidget::InteractiveWidget() **/
  56. INTERACTIVE_WIDGET_NONE = -1,
  57. INTERACTIVE_WIDGET_SLIDER = 0,
  58. INTERACTIVE_WIDGET_KNOB = 1,
  59. INTERACTIVE_WIDGET_WHEEL = 2,
  60. INTERACTIVE_WIDGET_CHECKBOX = 3,
  61. INTERACTIVE_WIDGET_SPINBOX = 4,
  62. INTERACTIVE_WIDGET_DOUBLESPINBOX = 5,
  63. INTERACTIVE_WIDGET_DIAL = 6,
  64. INTERACTIVE_WIDGET_COMBOBOX = 7,
  65. };
  66. static const DataWidgetType DEFAULT_DATA_WIDGET_BOOL = DATA_WIDGET_LED;
  67. static const DataWidgetType DEFAULT_DATA_WIDGET_INT = DATA_WIDGET_LCD;
  68. static const DataWidgetType DEFAULT_DATA_WIDGET_FLOAT = DATA_WIDGET_LCD;
  69. static const InteractiveWidgetType DEFAULT_INTERACTIVE_WIDGET_BOOL =
  70. INTERACTIVE_WIDGET_CHECKBOX;
  71. static const InteractiveWidgetType DEFAULT_INTERACTIVE_WIDGET_INT =
  72. INTERACTIVE_WIDGET_SPINBOX;
  73. static const InteractiveWidgetType DEFAULT_INTERACTIVE_WIDGET_FLOAT =
  74. INTERACTIVE_WIDGET_DOUBLESPINBOX;
  75. static const InteractiveWidgetType DEFAULT_INTERACTIVE_WIDGET_ENUM =
  76. INTERACTIVE_WIDGET_COMBOBOX;
  77. enum DataType
  78. {
  79. // Data
  80. /** If types were to be added the following functions should be updated :
  81. PreferencesDialog::initDataWidgetLists() **/
  82. DATA_TYPE_BOOL = 0,
  83. DATA_TYPE_INT = 1,
  84. DATA_TYPE_FLOAT = 2,
  85. };
  86. enum ParamType
  87. {
  88. // Params
  89. /** If types were to be added the following functions should be updated :
  90. PreferencesDialog::initInteractiveWidgetLists() **/
  91. PARAM_TYPE_BOOL = 0,
  92. PARAM_TYPE_INT = 1,
  93. PARAM_TYPE_FLOAT = 2,
  94. PARAM_TYPE_ENUM = 4,
  95. };
  96. enum starpu_top_device_type
  97. {
  98. SERVERDEVICE_CPU = 0,
  99. SERVERDEVICE_CUDA = 1,
  100. SERVERDEVICE_OPENCL = 2
  101. };
  102. // Server devices
  103. typedef struct
  104. {
  105. int id;
  106. starpu_top_device_type type;
  107. QString name;
  108. } starpu_top_device;
  109. // Server tasks
  110. typedef struct
  111. {
  112. int taskId;
  113. int deviceId;
  114. qlonglong timestampStart;
  115. qlonglong timestampEnd;
  116. } starpu_top_task;
  117. // Descriptions
  118. typedef struct
  119. { // Certain fields must be ignored depending on type
  120. int id;
  121. QString descriptionString;
  122. DataWidgetType widget;
  123. DataType type;
  124. double valMax;
  125. double valMin;
  126. } DataDescription;
  127. typedef struct
  128. { // Certain fields must be ignored depending on type
  129. int id;
  130. QString descriptionString;
  131. InteractiveWidgetType widget;
  132. ParamType type;
  133. bool valInitBool;
  134. int valInitInt;
  135. double valInitDouble;
  136. int valInitEnum;
  137. double valMax;
  138. double valMin;
  139. QStringList enumValues;
  140. } ParamDescription;
  141. /* --------------------------------------------------------------------------- */
  142. /* Widget lists items data */
  143. /* --------------------------------------------------------------------------- */
  144. typedef struct
  145. {
  146. int id;
  147. DataWidgetType widget;
  148. } DataWidgetListItemData;
  149. typedef struct
  150. {
  151. int id;
  152. InteractiveWidgetType widget;
  153. } InteractiveWidgetListItemData;
  154. /* --------------------------------------------------------------------------- */
  155. /* Plot curves data */
  156. /* --------------------------------------------------------------------------- */
  157. typedef struct
  158. {
  159. QVector<double> *xData;
  160. QVector<double> *yData;
  161. } CurveData;
  162. /* --------------------------------------------------------------------------- */
  163. /* Communication Manager states */
  164. /* --------------------------------------------------------------------------- */
  165. enum CommunicationState
  166. {
  167. COM_STATE_INIT = 0,
  168. COM_STATE_INIT_SERVERINFO = 1,
  169. COM_STATE_INIT_DATA = 2,
  170. COM_STATE_INIT_PARAMS = 3,
  171. COM_STATE_INIT_DEV = 4,
  172. COM_STATE_READY = 8,
  173. COM_STATE_LOOP = 10,
  174. };
  175. /* --------------------------------------------------------------------------- */
  176. /* Communication protocol messages */
  177. /* --------------------------------------------------------------------------- */
  178. enum CommunicationInMessageType
  179. {
  180. /* Complete commands */
  181. COM_MSG_IN_TYPE_BOOL = 0,
  182. COM_MSG_IN_TYPE_INT = 1,
  183. COM_MSG_IN_TYPE_FLOAT = 2,
  184. COM_MSG_IN_TYPE_ENUM = 3,
  185. COM_MSG_IN_SERVERINFO_BEGIN = 5,
  186. COM_MSG_IN_SERVERINFO_END = 6,
  187. COM_MSG_IN_DATA_BEGIN = 10,
  188. COM_MSG_IN_DATA_END = 11,
  189. COM_MSG_IN_PARAMS_BEGIN = 20,
  190. COM_MSG_IN_PARAMS_END = 21,
  191. COM_MSG_IN_DEV_BEGIN = 30,
  192. COM_MSG_IN_DEV_END = 31,
  193. COM_MSG_IN_DEV_CPU = 32,
  194. COM_MSG_IN_DEV_CUDA = 33,
  195. COM_MSG_IN_DEV_OPENCL = 34,
  196. COM_MSG_IN_READY = 40,
  197. COM_MSG_IN_SET = 50,
  198. COM_MSG_IN_PREV = 60,
  199. COM_MSG_IN_START = 61,
  200. COM_MSG_IN_END = 62,
  201. COM_MSG_IN_UPDATE = 70,
  202. COM_MSG_IN_DEBUG = 80,
  203. COM_MSG_IN_DEBUG_ON = 81,
  204. COM_MSG_IN_DEBUG_OFF = 82,
  205. COM_MSG_IN_DEBUG_MESSAGE = 83,
  206. COM_MSG_IN_DEBUG_LOCK = 84,
  207. /* Shortened commands */
  208. COM_MSG_IN_SHORT_UPDATE = 100,
  209. COM_MSG_IN_SHORT_PREV = 110,
  210. COM_MSG_IN_SHORT_START = 111,
  211. COM_MSG_IN_SHORT_END = 112,
  212. };
  213. enum CommunicationOutMessageType
  214. {
  215. /* Complete commands */
  216. COM_MSG_OUT_GO = 0,
  217. COM_MSG_OUT_ENABLE = 10,
  218. COM_MSG_OUT_DISABLE = 11,
  219. COM_MSG_OUT_SET = 20,
  220. COM_MSG_OUT_DEBUG = 30,
  221. COM_MSG_OUT_DEBUG_ON = 31,
  222. COM_MSG_OUT_DEBUG_OFF = 32,
  223. COM_MSG_OUT_DEBUG_STEP = 33,
  224. };
  225. /* --------------------------------------------------------------------------- */
  226. /* Session setup data for loading session setups */
  227. /* --------------------------------------------------------------------------- */
  228. typedef struct
  229. {
  230. int id;
  231. DataType type;
  232. DataWidgetType widget;
  233. } DataDescriptionSetup;
  234. typedef struct
  235. {
  236. int id;
  237. ParamType type;
  238. InteractiveWidgetType widget;
  239. } ParamDescriptionSetup;
  240. typedef struct
  241. {
  242. QByteArray geometry;
  243. DisplayMode displayMode;
  244. } MainWindowSetup;
  245. typedef struct
  246. {
  247. bool floating;
  248. QByteArray geometry;
  249. } ParametersDockSetup;
  250. typedef struct
  251. {
  252. bool inside;
  253. QByteArray geometry;
  254. int dataId;
  255. } DataWidgetSetup;
  256. typedef struct
  257. {
  258. bool inside;
  259. QByteArray geometry;
  260. QList<int> dataIds;
  261. } DataAggregatorWidgetSetup;
  262. #endif // STARPU_TOP_TYPES_H