starpu_top_types.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. SERVERDEVICE_GORDON = 3,
  102. };
  103. // Server devices
  104. typedef struct
  105. {
  106. int id;
  107. starpu_top_device_type type;
  108. QString name;
  109. } starpu_top_device;
  110. // Server tasks
  111. typedef struct
  112. {
  113. int taskId;
  114. int deviceId;
  115. qlonglong timestampStart;
  116. qlonglong timestampEnd;
  117. } starpu_top_task;
  118. // Descriptions
  119. typedef struct
  120. { // Certain fields must be ignored depending on type
  121. int id;
  122. QString descriptionString;
  123. DataWidgetType widget;
  124. DataType type;
  125. double valMax;
  126. double valMin;
  127. } DataDescription;
  128. typedef struct
  129. { // Certain fields must be ignored depending on type
  130. int id;
  131. QString descriptionString;
  132. InteractiveWidgetType widget;
  133. ParamType type;
  134. bool valInitBool;
  135. int valInitInt;
  136. double valInitDouble;
  137. int valInitEnum;
  138. double valMax;
  139. double valMin;
  140. QStringList enumValues;
  141. } ParamDescription;
  142. /* --------------------------------------------------------------------------- */
  143. /* Widget lists items data */
  144. /* --------------------------------------------------------------------------- */
  145. typedef struct
  146. {
  147. int id;
  148. DataWidgetType widget;
  149. } DataWidgetListItemData;
  150. typedef struct
  151. {
  152. int id;
  153. InteractiveWidgetType widget;
  154. } InteractiveWidgetListItemData;
  155. /* --------------------------------------------------------------------------- */
  156. /* Plot curves data */
  157. /* --------------------------------------------------------------------------- */
  158. typedef struct
  159. {
  160. QVector<double> *xData;
  161. QVector<double> *yData;
  162. } CurveData;
  163. /* --------------------------------------------------------------------------- */
  164. /* Communication Manager states */
  165. /* --------------------------------------------------------------------------- */
  166. enum CommunicationState
  167. {
  168. COM_STATE_INIT = 0,
  169. COM_STATE_INIT_SERVERINFO = 1,
  170. COM_STATE_INIT_DATA = 2,
  171. COM_STATE_INIT_PARAMS = 3,
  172. COM_STATE_INIT_DEV = 4,
  173. COM_STATE_READY = 8,
  174. COM_STATE_LOOP = 10,
  175. };
  176. /* --------------------------------------------------------------------------- */
  177. /* Communication protocol messages */
  178. /* --------------------------------------------------------------------------- */
  179. enum CommunicationInMessageType
  180. {
  181. /* Complete commands */
  182. COM_MSG_IN_TYPE_BOOL = 0,
  183. COM_MSG_IN_TYPE_INT = 1,
  184. COM_MSG_IN_TYPE_FLOAT = 2,
  185. COM_MSG_IN_TYPE_ENUM = 3,
  186. COM_MSG_IN_SERVERINFO_BEGIN = 5,
  187. COM_MSG_IN_SERVERINFO_END = 6,
  188. COM_MSG_IN_DATA_BEGIN = 10,
  189. COM_MSG_IN_DATA_END = 11,
  190. COM_MSG_IN_PARAMS_BEGIN = 20,
  191. COM_MSG_IN_PARAMS_END = 21,
  192. COM_MSG_IN_DEV_BEGIN = 30,
  193. COM_MSG_IN_DEV_END = 31,
  194. COM_MSG_IN_DEV_CPU = 32,
  195. COM_MSG_IN_DEV_CUDA = 33,
  196. COM_MSG_IN_DEV_OPENCL = 34,
  197. COM_MSG_IN_DEV_GORDON = 35,
  198. COM_MSG_IN_READY = 40,
  199. COM_MSG_IN_SET = 50,
  200. COM_MSG_IN_PREV = 60,
  201. COM_MSG_IN_START = 61,
  202. COM_MSG_IN_END = 62,
  203. COM_MSG_IN_UPDATE = 70,
  204. COM_MSG_IN_DEBUG = 80,
  205. COM_MSG_IN_DEBUG_ON = 81,
  206. COM_MSG_IN_DEBUG_OFF = 82,
  207. COM_MSG_IN_DEBUG_MESSAGE = 83,
  208. COM_MSG_IN_DEBUG_LOCK = 84,
  209. /* Shortened commands */
  210. COM_MSG_IN_SHORT_UPDATE = 100,
  211. COM_MSG_IN_SHORT_PREV = 110,
  212. COM_MSG_IN_SHORT_START = 111,
  213. COM_MSG_IN_SHORT_END = 112,
  214. };
  215. enum CommunicationOutMessageType
  216. {
  217. /* Complete commands */
  218. COM_MSG_OUT_GO = 0,
  219. COM_MSG_OUT_ENABLE = 10,
  220. COM_MSG_OUT_DISABLE = 11,
  221. COM_MSG_OUT_SET = 20,
  222. COM_MSG_OUT_DEBUG = 30,
  223. COM_MSG_OUT_DEBUG_ON = 31,
  224. COM_MSG_OUT_DEBUG_OFF = 32,
  225. COM_MSG_OUT_DEBUG_STEP = 33,
  226. };
  227. /* --------------------------------------------------------------------------- */
  228. /* Session setup data for loading session setups */
  229. /* --------------------------------------------------------------------------- */
  230. typedef struct
  231. {
  232. int id;
  233. DataType type;
  234. DataWidgetType widget;
  235. } DataDescriptionSetup;
  236. typedef struct
  237. {
  238. int id;
  239. ParamType type;
  240. InteractiveWidgetType widget;
  241. } ParamDescriptionSetup;
  242. typedef struct
  243. {
  244. QByteArray geometry;
  245. DisplayMode displayMode;
  246. } MainWindowSetup;
  247. typedef struct
  248. {
  249. bool floating;
  250. QByteArray geometry;
  251. } ParametersDockSetup;
  252. typedef struct
  253. {
  254. bool inside;
  255. QByteArray geometry;
  256. int dataId;
  257. } DataWidgetSetup;
  258. typedef struct
  259. {
  260. bool inside;
  261. QByteArray geometry;
  262. QList<int> dataIds;
  263. } DataAggregatorWidgetSetup;
  264. #endif // STARPU_TOP_TYPES_H