示例#1
0
    def setUp(self):
        self.name = "Process tree unittest"
        self.rootdir = os.path.join(os.path.dirname(sys.argv[0]), '../../examples/1/')

        parser = main._mk_options_parser()
        options, args = parser.parse_args(['--q', self.rootdir])
        writer = main._mk_writer(options)
        trace = parsing.Trace(writer, args, options)

        self.ps_stats = parsing.parse_file(writer, trace, self.mk_fname('proc_ps.log')).ps_stats
        self.processtree = process_tree.ProcessTree(writer, None, self.ps_stats, \
            self.ps_stats.sample_period, None, options.prune, None, None, False, for_testing = True)
示例#2
0
    def setUp(self):
        self.name = "Process tree unittest"
        self.rootdir = os.path.join(os.path.dirname(sys.argv[0]),
                                    '../../examples/1/')

        parser = main._mk_options_parser()
        options, args = parser.parse_args(['--q', self.rootdir])
        writer = main._mk_writer(options)
        trace = parsing.Trace(writer, args, options)

        parsing.parse_file(writer, trace, self.mk_fname('proc_ps.log'))
        trace.compile(writer)
        self.processtree = process_tree.ProcessTree(writer, None, trace.ps_stats, \
            trace.ps_stats.sample_period, None, options.prune, None, None, False, for_testing = True)
示例#3
0
import sys, os, re, struct, operator, math
from collections import defaultdict
import unittest

sys.path.insert(0, os.getcwd())

import pybootchartgui.parsing as parsing
import pybootchartgui.main as main

debug = False

def floatEq(f1, f2):
	return math.fabs(f1-f2) < 0.00001

bootchart_dir = os.path.join(os.path.dirname(sys.argv[0]), '../../examples/1/')
parser = main._mk_options_parser()
options, args = parser.parse_args(['--q', bootchart_dir])
writer = main._mk_writer(options)

class TestBCParser(unittest.TestCase):
    
	def setUp(self):
		self.name = "My first unittest"
		self.rootdir = bootchart_dir

	def mk_fname(self,f):
		return os.path.join(self.rootdir, f)

	def testParseHeader(self):
		trace = parsing.Trace(writer, args, options)
		state = parsing.parse_file(writer, trace, self.mk_fname('header'))
#!/usr/bin/env python

import sys
from pybootchartgui import main
from pybootchartgui import parsing

if __name__ == '__main__':
    argv = sys.argv[1:]
    parser = main._mk_options_parser()
    options, args = parser.parse_args(argv)
    writer = main._mk_writer(options)
    res = parsing.parse(writer, args, options.prune, options.crop_after,
                        options.annotate)
    duration = float(res[3].duration) / 100
    print res[0]['title']
    print "uname:", res[0]['system.uname']
    print "release:", res[0]['system.release']
    print "CPU:", res[0]['system.cpu']
    print "kernel options:", res[0]['system.kernel.options']
    print "time:", duration