private void showTimeSeriesAll ( java . util . List < LogReader . Log > logs ) { TimeSeries bytesSentData = new TimeSeries ( "Bytes Sent" , Minute . class ) ; TimeSeries timeTookData = new TimeSeries ( "Average Latency" , Minute . class ) ; TimeSeries nreqData = new TimeSeries ( "Number of Requests" , Minute . class ) ; String intervalS = "5 minute" ; // interval.getText().trim(); // if (intervalS.length() == 0) intervalS = "5 minute"; long period = 1000 * 60 * 5 ; try { TimeDuration tu = new TimeDuration ( intervalS ) ; period = ( long ) ( 1000 * tu . getValueInSeconds ( ) ) ; } catch ( Exception e ) { System . out . printf ( "Illegal Time interval=%s %n" , intervalS ) ; } long current = 0 ; long bytes = 0 ; long timeTook = 0 ; long total_count = 0 ; long count = 0 ; for ( LogReader . Log log : logs ) { long msecs = log . date ; if ( msecs - current > period ) { if ( current > 0 ) { total_count += count ; addPoint ( bytesSentData , timeTookData , nreqData , new Date ( current ) , bytes , count , timeTook ) ; } bytes = 0 ; count = 0 ; timeTook = 0 ; current = msecs ; } bytes += log . getBytes ( ) ; timeTook += log . getMsecs ( ) ; count ++ ; } if ( count > 0 ) addPoint ( bytesSentData , timeTookData , nreqData , new Date ( current ) , bytes , count , timeTook ) ; total_count += count ; System . out . printf ( "showTimeSeriesAll: total_count = %d logs = %d%n" , total_count , logs . size ( ) ) ; MultipleAxisChart mc = new MultipleAxisChart ( "Access Logs" , intervalS + " average" , "Mbytes Sent" , bytesSentData ) ; mc . addSeries ( "Number of Requests" , nreqData ) ; mc . addSeries ( "Average Latency (secs)" , timeTookData ) ; mc . finish ( new java . awt . Dimension ( 1000 , 1000 ) ) ; //MultipleAxisChart mc = new MultipleAxisChart("Bytes Sent", "5 min average", "Mbytes/sec", bytesSentData); //Chart c2 = new Chart("Average Latency", "5 min average", "Millisecs", timeTookData); //Chart c3 = new Chart("Number of Requests/sec", "5 min average", "", nreqData); timeSeriesPanel . removeAll ( ) ; timeSeriesPanel . add ( mc ) ; }
construct the TImeSeries plot for the list of logs passed in