original_docstring: Print out a summary of disk statistics...
  
          @param max_zscore: the number of standard deviations above the mean
              we'd like to filter
          @type max_zscore: int
  
          @return: NOTHING
          
docstring: Print out a summary of disk statistics
docstring_tokens: Print out a summary of disk statistics
code: def print_disk_summary(self, max_zscore=4):
          """Print out a summary of disk statistics...
  
          @param max_zscore: the number of standard deviations above the mean
              we'd like to filter
          @type max_zscore: int
  
          @return: NOTHING
          """
  
          if len(self.tracelog['trace_io'].keys()) < 1:
              print "No disk data collected."
              return
  
          # total number of seconds the trace ran...
          trace_elapsed_secs = self.tracelog['stop_epoch'] -\
               self.tracelog['start_epoch']
  
          # disk io size buckets
          d_buckets_k = [i for i in range(0,9437184,1048576)]
          m_buckets_k = [i for i in range(0,1048576,131072)]
          d_buckets = dict((k, int(0)) for k in d_buckets_k)
          m_buckets = dict((k, int(0)) for k in m_buckets_k)
                                                              
  
          # summarize some disk stats
          if self.verbose:
              print "Disk Summary:"
              print "*" * 80
              for k, v in sorted(self.tracelog['trace_io']['disks'].iteritems()):
                  formatstr = "Disk: {0}, IOPS: {1}, Avg_IO_T: {2:.3f}, " + \
                      "Avg_IO_Sz: {3}, Longest_IO: {4:.3f}, Total_Bytes: {5}, " + \
                      "Total_IO_Time: {6:.3f}"
                  try:
                      print formatstr.format(
                      k, v['stats']['num_iops'], 
                      v['stats']['avg_io_tm'],
                      v['stats']['avg_io_sz'], 
                      v['stats']['longest_io'],
                      v['stats']['total_bytes_io'],
                      v['stats']['total_time_io'])
                     
                      if v['stats']['avg_io_sz'] < 1048576:
                          bucket = m_buckets
                          bucket_k = m_buckets_k
                      else:
                          bucket = d_buckets
                          bucket_k = d_buckets_k
  
                      # populate the iosize buckets
                      #from IPython import embed; embed()
                      for io in v['iosizes'][k]:
                          b_index = self._populate_buckets(bucket_k, io)
                          b_key = bucket_k[b_index - 1]
                          bucket[b_key] += 1
  
                      # print the buckets
                      print "\tIO Size buckets: " + ', '.join(["{0}: {1}".format(k, v) for k, v in sorted(bucket.iteritems())])
  
                      # clear the buckets for the next disk
                      for k in bucket:
                          bucket[k] = 0
  
                  except ValueError as ve:
                      continue
  
          print
          print
          print "Disks with Avg IO times > {0} standard deviations".format(
                  max_zscore)
          print "Average IO Times (data: {0:.4f}, metadata: {1:.4f})".format(
              self.tracelog['trace_io']['stats']['avg_io_tm_data'], 
              self.tracelog['trace_io']['stats']['avg_io_tm_meta'])
          print "Deviation Variance: ( data: {0:.2f}, metadata: {1:.2f})".format(
                  max_zscore * (self.tracelog['trace_io']['stats']['stddev_io_data_var']),
                  max_zscore * (self.tracelog['trace_io']['stats']['stddev_io_meta_var']) )
  
          print "*" * 80
  
          for k, v in sorted(self.tracelog['trace_io']['disks'].iteritems()):
              if not v['stats']['avg_io_tm']:
                  continue    # some disks just dont have the right fields...
              else:
                  d_io_tm = v['stats']['avg_io_tm']
                  strfrmt = "Disk: {0}, Avg_IO_Time {1:.4f}, ZScore: {2:.4f}"
  
              try:
                  if v['stats']['avg_io_sz'] > 1048576: # data disks
                      mean = self.tracelog['trace_io']['stats']['avg_io_tm_data']
                      stddev = self.tracelog['trace_io']['stats']['stddev_io_data']
                      zs = zscore(d_io_tm, mean, stddev)
                      if zs > max_zscore:
                          print strfrmt.format(k, d_io_tm, zs)
  
                  else:   # metadata
                      mean = self.tracelog['trace_io']['stats']['avg_io_tm_meta']
                      stddev = self.tracelog['trace_io']['stats']['stddev_io_meta']
                      zs = zscore(d_io_tm, mean, stddev)
                      if zs > max_zscore:
                          print strfrmt.format(k, d_io_tm, zs)
  
                      # populate the iosize buckets
                      #for io in v['iosizes']:
                      #    p = _populate_buckets(m_bucket_k, io)
                      #    m_buckets[p] += 1
  
              except TypeError as te:
                  print "TypeError: {0}".format(te)
                  continue
  
          total_bytes = self.tracelog['trace_io']['stats']['total_bytes']
          total_iops = self.tracelog['trace_io']['stats']['total_iops']
  
          print
          print
          print "Totals:"
          print "*" * 80
          print "Total Gigabytes Read/Written: {0}".format(float(total_bytes) / 1024 / 1024 / 1024)
          print "Total IO Operations: {0}".format(total_iops)
          print "Total IO Trace Time: {0} secs".format(trace_elapsed_secs)
          print "Total GB/s: {0:.3f}".format(
                  float(total_bytes / 1024 / 1024 / 1024) / float(trace_elapsed_secs))
code_tokens: def print_disk_summary ( self , max_zscore = 4 ) : if len ( self . tracelog [ 'trace_io' ] . keys ( ) ) < 1 : print "No disk data collected." return trace_elapsed_secs = self . tracelog [ 'stop_epoch' ] - self . tracelog [ 'start_epoch' ] d_buckets_k = [ i for i in range ( 0 , 9437184 , 1048576 ) ] m_buckets_k = [ i for i in range ( 0 , 1048576 , 131072 ) ] d_buckets = dict ( ( k , int ( 0 ) ) for k in d_buckets_k ) m_buckets = dict ( ( k , int ( 0 ) ) for k in m_buckets_k ) if self . verbose : print "Disk Summary:" print "*" * 80 for k , v in sorted ( self . tracelog [ 'trace_io' ] [ 'disks' ] . iteritems ( ) ) : formatstr = "Disk: {0}, IOPS: {1}, Avg_IO_T: {2:.3f}, " + "Avg_IO_Sz: {3}, Longest_IO: {4:.3f}, Total_Bytes: {5}, " + "Total_IO_Time: {6:.3f}" try : print formatstr . format ( k , v [ 'stats' ] [ 'num_iops' ] , v [ 'stats' ] [ 'avg_io_tm' ] , v [ 'stats' ] [ 'avg_io_sz' ] , v [ 'stats' ] [ 'longest_io' ] , v [ 'stats' ] [ 'total_bytes_io' ] , v [ 'stats' ] [ 'total_time_io' ] ) if v [ 'stats' ] [ 'avg_io_sz' ] < 1048576 : bucket = m_buckets bucket_k = m_buckets_k else : bucket = d_buckets bucket_k = d_buckets_k for io in v [ 'iosizes' ] [ k ] : b_index = self . _populate_buckets ( bucket_k , io ) b_key = bucket_k [ b_index - 1 ] bucket [ b_key ] += 1 print "\tIO Size buckets: " + ', ' . join ( [ "{0}: {1}" . format ( k , v ) for k , v in sorted ( bucket . iteritems ( ) ) ] ) for k in bucket : bucket [ k ] = 0 except ValueError as ve : continue print print print "Disks with Avg IO times > {0} standard deviations" . format ( max_zscore ) print "Average IO Times (data: {0:.4f}, metadata: {1:.4f})" . format ( self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'avg_io_tm_data' ] , self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'avg_io_tm_meta' ] ) print "Deviation Variance: ( data: {0:.2f}, metadata: {1:.2f})" . format ( max_zscore * ( self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'stddev_io_data_var' ] ) , max_zscore * ( self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'stddev_io_meta_var' ] ) ) print "*" * 80 for k , v in sorted ( self . tracelog [ 'trace_io' ] [ 'disks' ] . iteritems ( ) ) : if not v [ 'stats' ] [ 'avg_io_tm' ] : continue else : d_io_tm = v [ 'stats' ] [ 'avg_io_tm' ] strfrmt = "Disk: {0}, Avg_IO_Time {1:.4f}, ZScore: {2:.4f}" try : if v [ 'stats' ] [ 'avg_io_sz' ] > 1048576 : mean = self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'avg_io_tm_data' ] stddev = self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'stddev_io_data' ] zs = zscore ( d_io_tm , mean , stddev ) if zs > max_zscore : print strfrmt . format ( k , d_io_tm , zs ) else : mean = self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'avg_io_tm_meta' ] stddev = self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'stddev_io_meta' ] zs = zscore ( d_io_tm , mean , stddev ) if zs > max_zscore : print strfrmt . format ( k , d_io_tm , zs ) except TypeError as te : print "TypeError: {0}" . format ( te ) continue total_bytes = self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'total_bytes' ] total_iops = self . tracelog [ 'trace_io' ] [ 'stats' ] [ 'total_iops' ] print print print "Totals:" print "*" * 80 print "Total Gigabytes Read/Written: {0}" . format ( float ( total_bytes ) / 1024 / 1024 / 1024 ) print "Total IO Operations: {0}" . format ( total_iops ) print "Total IO Trace Time: {0} secs" . format ( trace_elapsed_secs ) print "Total GB/s: {0:.3f}" . format ( float ( total_bytes / 1024 / 1024 / 1024 ) / float ( trace_elapsed_secs ) )
short_docstring: Print out a summary of disk statistics...
short_docstring_tokens: Print out a summary of disk statistics ...
comment: """Print out a summary of disk statistics...
  
          @param max_zscore: the number of standard deviations above the mean
              we'd like to filter
          @type max_zscore: int
  
          @return: NOTHING
          """$SEP$# total number of seconds the trace ran...$SEP$# disk io size buckets$SEP$# summarize some disk stats$SEP$# populate the iosize buckets$SEP$#from IPython import embed; embed()$SEP$# print the buckets$SEP$# clear the buckets for the next disk$SEP$# some disks just dont have the right fields...$SEP$# data disks$SEP$# metadata$SEP$# populate the iosize buckets$SEP$#for io in v['iosizes']:$SEP$#    p = _populate_buckets(m_bucket_k, io)$SEP$#    m_buckets[p] += 1