Buggy code:
public class GpuProcessStreamReceiver extends ProcessStreamReceiver { private static final Logger log = Logger . getLogger ( GpuProcessStreamReceiver . class ) ; protected GpuQueryProcessor gpuQueryProcessor ; protected GpuMetaStreamEvent gpuMetaEvent ; private int streamIndex ; private String streamReferenceId ; private String streamFullId ; protected ByteBufferWriter eventBufferWriter ; private GpuStreamProcessor gpuStreamProcessor ; private List < SiddhiGpu . GpuProcessor > gpuProcessors = new ArrayList < SiddhiGpu . GpuProcessor > ( ) ; private GpuQuerySelector selectProcessor ; private int maximumEventBatchSize ; private int minimumEventBatchSize ; private boolean softBatchScheduling ; private int selectorWorkerCount ; private float currentEventCount = 0 ; private long startTime = 0 ; private long endTime = 0 ; private long gpuProcEndTime = 0 ; private long serializeBeginTime = 0 ; private long serializeTime = 0 ; private long duration = 0 ; private final SummaryStatistics throughputStatstics = new SummaryStatistics ( ) ; private final SummaryStatistics totalTimeStatstics = new SummaryStatistics ( ) ; private final SummaryStatistics serializationTimeStatstics = new SummaryStatistics ( ) ; private final SummaryStatistics gpuTimeStatstics = new SummaryStatistics ( ) ; private final SummaryStatistics selectTimeStatstics = new SummaryStatistics ( ) ; private final DecimalFormat decimalFormat = new DecimalFormat ( "###.##" ) ; public GpuProcessStreamReceiver ( String streamId , String referenceId , String queryName ) { } public GpuProcessStreamReceiver clone ( String key ) { } public void serialize ( Event event ) { } @ Override public void receive ( Event event , boolean endOfBatch ) { serializeBeginTime = System . nanoTime ( ) ; serialize ( event ) ; serializeTime += ( System . nanoTime ( ) ) - ( serializeBeginTime ) ; ( currentEventCount ) ++ ; if ( ( endOfBatch && ( ( currentEventCount ) >= ( minimumEventBatchSize ) ) ) || ( ( maximumEventBatchSize ) == ( currentEventCount ) ) ) { startTime = System . nanoTime ( ) ; eventBufferWriter . Reset ( ) ; int resultEventCount = gpuStreamProcessor . Process ( ( ( int ) ( currentEventCount ) ) ) ; gpuProcEndTime = System . nanoTime ( ) ; selectProcessor . process ( resultEventCount ) ; endTime = System . nanoTime ( ) ; duration = ( endTime ) - ( startTime ) ; double average = ( ( currentEventCount ) * 1000000000 ) // ( ( double ) ( duration ) ) ; throughputStatstics . addValue ( average ) ; <START_BUG> totalTimeStatstics . addValue ( ( ( endTime ) - ( startTime ) ) ) ; <END_BUG> serializationTimeStatstics . addValue ( serializeTime ) ; gpuTimeStatstics . addValue ( ( ( gpuProcEndTime ) - ( startTime ) ) ) ; selectTimeStatstics . addValue ( ( ( endTime ) - ( gpuProcEndTime ) ) ) ; currentEventCount = 0 ; serializeTime = 0 ; } } public void init ( ) { } public void configure ( ByteBufferWriter eventBufferWriter , GpuStreamProcessor gpuStreamProcessor ) { } public void setGpuQueryProcessor ( GpuQueryProcessor gpuQueryProcessor ) { } public GpuQueryProcessor getGpuQueryProcessor ( ) { } public GpuMetaStreamEvent getGpuMetaEvent ( ) { } public void setGpuMetaEvent ( GpuMetaStreamEvent gpuMetaEvent ) { } public void setSelectProcessor ( Processor selectProcessor ) { } public void addGpuProcessor ( SiddhiGpu . GpuProcessor gpuProcessor ) { } public List < SiddhiGpu . GpuProcessor > getGpuProcessors ( ) { } public int getMaximumEventBatchSize ( ) { } public void setMaximumEventBatchSize ( int eventBatchSize ) { } public void setSoftBatchScheduling ( boolean softBatchScheduling ) { } public int getMinimumEventBatchSize ( ) { } public void setMinimumEventBatchSize ( int minimumEventBatchSize ) { } public String getStreamFullId ( ) { } public int getSelectorWorkerCount ( ) { } public void setSelectorWorkerCount ( int selectorWorkerCount ) { } private void configureSelectorProcessor ( ) { } public void printStatistics ( ) { } public void getStatistics ( List < SummaryStatistics > statList ) { } }

Fix:
totalTimeStatstics . addValue ( ( ( duration ) + ( serializeTime ) ) ) ;