Beispiel #1
0
  def testParseDstatFile(self):
    path = os.path.join(os.path.dirname(__file__), '..', 'data',
                        'dstat-result.csv')
    with open(path) as f:
      labels, out = dstat.ParseCsvFile(f)

    self.assertEqual(len(labels), len(out[0]))
    self.assertEqual(out.shape, (383, 62))
    self.assertEqual([
        'epoch__epoch', 'usr__total cpu usage', 'sys__total cpu usage',
        'idl__total cpu usage', 'wai__total cpu usage', 'hiq__total cpu usage',
        'siq__total cpu usage', '1m__load avg', '5m__load avg', '15m__load avg',
        'read__io/total', 'writ__io/total', 'read__io/sda', 'writ__io/sda',
        'read__dsk/total', 'writ__dsk/total', 'read__dsk/sda', 'writ__dsk/sda',
        'recv__net/total', 'send__net/total', 'in__paging', 'out__paging',
        'int__system', 'csw__system', '12__interrupts', '25__interrupts',
        '30__interrupts', 'run__procs', 'blk__procs', 'new__procs',
        'used__memory usage', 'buff__memory usage', 'cach__memory usage',
        'free__memory usage', 'used__swap', 'free__swap', 'files__filesystem',
        'inodes__filesystem', 'msg__sysv ipc', 'sem__sysv ipc', 'shm__sysv ipc',
        'lis__tcp sockets', 'act__tcp sockets', 'syn__tcp sockets',
        'tim__tcp sockets', 'clo__tcp sockets', 'lis__udp', 'act__udp',
        'raw__raw', 'tot__sockets', 'tcp__sockets', 'udp__sockets',
        'raw__sockets', 'frg__sockets', 'dgm__unix sockets',
        'str__unix sockets', 'lis__unix sockets', 'act__unix sockets',
        'majpf__virtual memory', 'minpf__virtual memory',
        'alloc__virtual memory', 'free__virtual memory'], labels)
 def _Analyze(role, file):
   with open(os.path.join(self.output_directory,
                          os.path.basename(file)), 'r') as f:
     fp = iter(f)
     labels, out = dstat.ParseCsvFile(fp)
     vm_util.RunThreaded(
         _AnalyzeEvent,
         [((role, labels, out, e), {}) for e in events.TracingEvent.events])