public long calculateDuration ( ) { if ( ! nodes . isEmpty ( ) ) { long endTime = 0 ; for ( int i = 0 ; i < getNodes ( ) . size ( ) ; i ++ ) { Node node = getNodes ( ) . get ( i ) ; long nodeEndTime = node . overallEndTime ( ) ; if ( nodeEndTime > endTime ) { endTime = nodeEndTime ; } } return endTime - getNodes ( ) . get ( 0 ) . getTimestamp ( ) ; } return 0L ; }
This method returns the duration of the trace fragment .