public CallTreeNode onStopwatchStart ( Split split ) { final String name = split . getStopwatch ( ) . getName ( ) ; CallTreeNode currentNode ; if ( callStack . isEmpty ( ) ) { // Root tree node rootNode = new CallTreeNode ( name ) ; currentNode = rootNode ; onRootStopwatchStart ( currentNode , split ) ; } else { // Child node currentNode = callStack . getLast ( ) . getOrAddChild ( name ) ; } callStack . addLast ( currentNode ) ; return currentNode ; }
When stopwatch is started a new tree node is added to the parent tree node and pushed on the call stack . As a result child tree node becomes the current tree node .