public final synchronized void endFragment ( String stmtName , boolean isCoordinatorTask , boolean failed , boolean sampledStmt , long duration , int resultSize , int parameterSetSize ) { if ( stmtName == null ) { return ; } StatementStats stmtStats = m_stmtStatsMap . get ( stmtName ) ; if ( stmtStats == null ) { return ; } StatsData dataToUpdate = isCoordinatorTask ? stmtStats . m_coordinatorTask : stmtStats . m_workerTask ; // m_failureCount and m_invocations need to be updated even if the current invocation is not sampled. if ( failed ) { dataToUpdate . m_failureCount ++ ; } dataToUpdate . m_invocations ++ ; // If the current invocation is not sampled, we can stop now. // Notice that this function can be called by a FragmentTask from a multi-partition procedure. // Cannot use the isRecording() value here because SP sites can have values different from the MP Site. if ( ! sampledStmt ) { return ; } // This is a sampled invocation. // Update timings and size statistics below. if ( duration < 0 ) { if ( Math . abs ( duration ) > 1000000000 ) { log . info ( "Statement: " + stmtStats . m_stmtName + " in procedure: " + m_procName + " recorded a negative execution time larger than one second: " + duration ) ; } return ; } dataToUpdate . m_timedInvocations ++ ; // sampled timings dataToUpdate . m_totalTimedExecutionTime += duration ; dataToUpdate . m_minExecutionTime = Math . min ( duration , dataToUpdate . m_minExecutionTime ) ; dataToUpdate . m_maxExecutionTime = Math . max ( duration , dataToUpdate . m_maxExecutionTime ) ; dataToUpdate . m_incrMinExecutionTime = Math . min ( duration , dataToUpdate . m_incrMinExecutionTime ) ; dataToUpdate . m_incrMaxExecutionTime = Math . max ( duration , dataToUpdate . m_incrMaxExecutionTime ) ; // sampled size statistics dataToUpdate . m_totalResultSize += resultSize ; dataToUpdate . m_minResultSize = Math . min ( resultSize , dataToUpdate . m_minResultSize ) ; dataToUpdate . m_maxResultSize = Math . max ( resultSize , dataToUpdate . m_maxResultSize ) ; dataToUpdate . m_incrMinResultSize = Math . min ( resultSize , dataToUpdate . m_incrMinResultSize ) ; dataToUpdate . m_incrMaxResultSize = Math . max ( resultSize , dataToUpdate . m_incrMaxResultSize ) ; dataToUpdate . m_totalParameterSetSize += parameterSetSize ; dataToUpdate . m_minParameterSetSize = Math . min ( parameterSetSize , dataToUpdate . m_minParameterSetSize ) ; dataToUpdate . m_maxParameterSetSize = Math . max ( parameterSetSize , dataToUpdate . m_maxParameterSetSize ) ; dataToUpdate . m_incrMinParameterSetSize = Math . min ( parameterSetSize , dataToUpdate . m_incrMinParameterSetSize ) ; dataToUpdate . m_incrMaxParameterSetSize = Math . max ( parameterSetSize , dataToUpdate . m_incrMaxParameterSetSize ) ; }
This function will be called after a statement finish running . It updates the data structures to maintain the statistics .