You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

operator.vue 8.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <!--
  2. Copyright 2020-2021 Huawei Technologies Co., Ltd.All Rights Reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. -->
  13. <template>
  14. <div class="operator">
  15. <div class="operator-title">{{$t('profiling.operatorDetail')}}</div>
  16. <div class="cl-profiler">
  17. <el-tabs v-model="apiType"
  18. @tab-click="tabChange">
  19. <el-tab-pane label="AI CORE"
  20. name="core">
  21. <operator-unit chartId="core-echarts"
  22. :currentCard="currentCard"
  23. :opType="coreOpType"
  24. :opSortCondition="coreOpSortCondition"
  25. :search="coreSearch"
  26. :accuracy="6"
  27. :headerFilder="headerFilder"
  28. ref="core" />
  29. </el-tab-pane>
  30. <el-tab-pane label="AI CPU"
  31. class="cpu-tab"
  32. name="cpu">
  33. <operator-unit chartId="cpu-echarts"
  34. :currentCard="currentCard"
  35. :opType="cpuOpType"
  36. :opSortCondition="cpuOpSortCondition"
  37. :search="cpuSearch"
  38. :accuracy="6"
  39. :headerFilder="headerFilder"
  40. ref="cpu" />
  41. </el-tab-pane>
  42. <el-tab-pane label="HOST CPU"
  43. class="cpu-tab"
  44. name="host">
  45. <operator-unit chartId="host-echarts"
  46. :currentCard="currentCard"
  47. :opType="hostType"
  48. :opSortCondition="hostSortCondition"
  49. :search="hostSearch"
  50. :accuracy="6"
  51. :headerFilder="headerFilder"
  52. :chart="hostChart"
  53. ref="host" />
  54. </el-tab-pane>
  55. </el-tabs>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import operatorUnit from '../../components/operator-unit.vue';
  61. export default {
  62. components: {operatorUnit},
  63. data() {
  64. return {
  65. apiType: 'core',
  66. currentCard: '',
  67. coreOpType: {
  68. all: 'aicore_type',
  69. detail: 'aicore_detail',
  70. },
  71. cpuOpType: {
  72. all: 'aicpu_type',
  73. detail: 'aicpu_detail',
  74. },
  75. hostType: {
  76. all: 'cpu_op_type',
  77. detail: 'cpu_op_info',
  78. },
  79. coreOpSortCondition: {
  80. all: {
  81. name: 'execution_time',
  82. type: 'descending',
  83. },
  84. detail: {
  85. name: 'avg_execution_time',
  86. type: 'descending',
  87. },
  88. },
  89. cpuOpSortCondition: {
  90. all: {
  91. name: 'execution_time',
  92. type: 'descending',
  93. },
  94. detail: {
  95. name: 'total_time',
  96. type: 'descending',
  97. },
  98. },
  99. hostSortCondition: {
  100. all: {
  101. name: 'total_compute_time',
  102. type: 'descending',
  103. },
  104. detail: {
  105. name: 'op_total_time',
  106. type: 'descending',
  107. },
  108. },
  109. headerFilder: {
  110. execution_time: `execution_time (${this.$t('profiling.unit')})`,
  111. avg_execution_time: `avg_execution_time (${this.$t('profiling.unit')})`,
  112. execution_frequency: `execution_frequency (${this.$t('profiling.countUnit')})`,
  113. percent: 'percent (%)',
  114. total_time: 'total_time (ms)',
  115. dispatch_time: 'dispatch_time (ms)',
  116. total_compute_time: 'total_compute_time (ms)',
  117. compute_time: `compute_time (${this.$t('profiling.unit')})`,
  118. total_time_proportion: 'total_time_proportion (%)',
  119. op_total_time: 'op_total_time (ms)',
  120. avg_time: 'avg_time (ms)',
  121. op_avg_time: 'op_avg_time (ms)',
  122. },
  123. coreSearch: {
  124. all: {
  125. label:
  126. this.$t('operator.searchByType') +
  127. this.$t('symbols.leftbracket') +
  128. this.$t('public.caseMode') +
  129. this.$t('symbols.rightbracket'),
  130. type: 'op_type',
  131. },
  132. detail: {
  133. label:
  134. this.$t('operator.searchByName') +
  135. this.$t('symbols.leftbracket') +
  136. this.$t('public.caseMode') +
  137. this.$t('symbols.rightbracket'),
  138. type: 'op_name',
  139. },
  140. },
  141. cpuSearch: {
  142. all: {
  143. label:
  144. this.$t('operator.searchByType') +
  145. this.$t('symbols.leftbracket') +
  146. this.$t('public.caseMode') +
  147. this.$t('symbols.rightbracket'),
  148. type: 'op_type',
  149. },
  150. detail: {
  151. label:
  152. this.$t('operator.searchByType') +
  153. this.$t('symbols.leftbracket') +
  154. this.$t('public.caseMode') +
  155. this.$t('symbols.rightbracket'),
  156. type: 'op_type',
  157. },
  158. },
  159. hostSearch: {
  160. all: {
  161. label:
  162. this.$t('operator.searchByType') +
  163. this.$t('symbols.leftbracket') +
  164. this.$t('public.caseMode') +
  165. this.$t('symbols.rightbracket'),
  166. type: 'op_type',
  167. },
  168. detail: {
  169. label:
  170. this.$t('operator.searchByName') +
  171. this.$t('symbols.leftbracket') +
  172. this.$t('public.caseMode') +
  173. this.$t('symbols.rightbracket'),
  174. type: 'op_name',
  175. },
  176. },
  177. hostChart: {
  178. hasPercent: true,
  179. value: 4,
  180. percent: 5,
  181. },
  182. };
  183. },
  184. watch: {
  185. '$parent.curDashboardInfo': {
  186. handler(newValue, oldValue) {
  187. if (newValue.curCardNum) {
  188. this.currentCard = newValue.curCardNum;
  189. this.initOver = false;
  190. this.$nextTick(() => {
  191. this.cardChange();
  192. });
  193. }
  194. if (newValue.initOver) {
  195. this.initOver = true;
  196. }
  197. },
  198. deep: true,
  199. immediate: true,
  200. },
  201. },
  202. destroyed() {},
  203. methods: {
  204. cardChange() {
  205. const ref = this.$refs[this.apiType];
  206. ref.clearCoreData();
  207. if (this.apiType !== 'cuda') {
  208. ref.coreStatisticType = 0;
  209. } else {
  210. ref.coreTableChange();
  211. }
  212. ref.getCoreTypeList();
  213. },
  214. tabChange() {
  215. const ref = this.$refs[this.apiType];
  216. if (this.currentCard !== ref.coreCharts.device_id) {
  217. ref.getCoreTypeList();
  218. if (this.apiType === 'cuda') {
  219. setTimeout(() => {
  220. ref.coreTableChange();
  221. }, 100);
  222. }
  223. } else {
  224. this.$nextTick(() => {
  225. ref.resizeCallback();
  226. });
  227. }
  228. },
  229. },
  230. mounted() {
  231. if (this.train_id) {
  232. document.title = `${decodeURIComponent(this.train_id)}-${this.$t('profiling.operatorDetail')}-MindInsight`;
  233. } else {
  234. document.title = `${this.$t('profiling.operatorDetail')}-MindInsight`;
  235. }
  236. },
  237. };
  238. </script>
  239. <style>
  240. .operator {
  241. height: 100%;
  242. }
  243. .operator .clear {
  244. clear: both;
  245. }
  246. .operator .el-tabs__item {
  247. color: #6c7280;
  248. line-height: 36px;
  249. height: 36px;
  250. }
  251. .operator .el-tabs__item.is-active {
  252. color: #00a5a7;
  253. font-weight: bold;
  254. }
  255. .operator .operator-title {
  256. padding: 0 15px;
  257. font-size: 16px;
  258. font-weight: bold;
  259. }
  260. .operator .cl-profiler {
  261. height: calc(100% - 21px);
  262. overflow-y: auto;
  263. width: 100%;
  264. background: #fff;
  265. padding: 0 16px;
  266. overflow: hidden;
  267. }
  268. .operator .cl-profiler .custom-label {
  269. max-width: calc(100% - 25px);
  270. padding: 0;
  271. vertical-align: middle;
  272. }
  273. .operator .cl-profiler .el-tabs {
  274. height: 100%;
  275. }
  276. .operator .cl-profiler .el-tabs .el-tabs__header {
  277. margin-bottom: 10px;
  278. }
  279. .operator .cl-profiler .el-tabs__content {
  280. height: calc(100% - 46px);
  281. }
  282. .operator .cl-profiler .el-tab-pane {
  283. height: 100%;
  284. }
  285. </style>