File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
redisinsight/ui/src/packages/ri-explain/src Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
12
12
ParseProfile ,
13
13
ParseProfileCluster ,
14
14
GetAncestors ,
15
+ GetTotalExecutionTime ,
15
16
} from './parser'
16
17
import { ExplainNode , ProfileNode } from './Node'
17
18
@@ -21,22 +22,30 @@ interface IExplain {
21
22
}
22
23
23
24
function getEdgeSize ( c : number ) {
24
- return ( Math . log ( c || 1 ) / Math . log ( 3 ) ) + 1
25
+ return ( Math . log ( c || 1 ) / Math . log ( 10 ) ) + 1
25
26
}
26
27
27
28
export default function Explain ( props : IExplain ) : JSX . Element {
28
29
const command = props . command . split ( ' ' ) [ 0 ] . toLowerCase ( )
29
30
30
31
if ( command . startsWith ( 'graph' ) ) {
31
32
const info = props . data [ 0 ] . response
32
-
33
33
const resp = ParseGraphV2 ( info )
34
34
35
+ let profilingTime : IProfilingTime = { }
36
+ let t = command . endsWith ( 'explain' ) ? CoreType . Explain : CoreType . Profile
37
+ if ( t === CoreType . Profile ) {
38
+ profilingTime = {
39
+ 'Total Execution Time' : GetTotalExecutionTime ( resp )
40
+ }
41
+ }
42
+
35
43
return (
36
44
< ExplainDraw
37
45
data = { resp }
38
46
module = { ModuleType . Graph }
39
- type = { command . endsWith ( 'explain' ) ? CoreType . Explain : CoreType . Profile }
47
+ type = { t }
48
+ profilingTime = { profilingTime }
40
49
/>
41
50
)
42
51
}
Original file line number Diff line number Diff line change @@ -803,3 +803,8 @@ export function ParseGraphV2(output: string[]) {
803
803
entity . children = children
804
804
return entity
805
805
}
806
+
807
+
808
+ export function GetTotalExecutionTime ( g : EntityInfo ) {
809
+ return parseFloat ( g . time || '' ) + g . children . reduce ( ( a , c ) => a + GetTotalExecutionTime ( c ) , 0 )
810
+ }
You can’t perform that action at this time.
0 commit comments