Exemplo n.º 1
0
Arquivo: test.py Projeto: kabe/parp
def main(argv):
    """Main

    Arguments:
    - `argv`:
    """
    if len(argv) < 2:
        sys.stderr.write("Usage: %s LOGFILE FUNCMAPFILE" % (argv[0]))
        sys.exit(1)
    maploader = nm.loader.Loader(argv[2])
    maploader.load_all()
    loader = Loader(argv[1], maploader)
    loader.load_all()
Exemplo n.º 2
0
def load_profs(logdir, funcmapfile):
    dir_contents = os.listdir(logdir)
    funcmap = nm.loader.Loader(funcmapfile)
    funcmap.load_all()
    profs = [Loader(os.path.join(logdir, f), funcmap)
             for f in dir_contents if f.startswith("profile")]
    [loader.load_all() for loader in profs]
    return profs, loader
Exemplo n.º 3
0
    def load_profs(self, logdir, funcmapfile):
        """Load profile logs files under the specified directory.

        @param logdir directory name for profile logs
        @param funcmapfile name of function-address mapping file
        @return profiles list
        """
        dir_contents = os.listdir(logdir)
        funcmap = nm.loader.Loader(funcmapfile)
        funcmap.load_all()
        profs = [Loader(os.path.join(logdir, f), funcmap)
                 for f in dir_contents if f.startswith("profile")]
        [loader.load_all() for loader in profs]
        ## Profile logs
        self.profs = profs
Exemplo n.º 4
0
def main(argv):
    """Main

    Arguments:
    - `argv`:
    """
    if len(argv) < 2:
        sys.stderr.write("Usage: %s LOGDIR FUNCMAPFILE" % (argv[0]))
        sys.exit(1)
    # Data Prepare
    logdir = argv[1]
    funcmapfile = argv[2]
    dir_contents = os.listdir(logdir)
    funcmap = nm.loader.Loader(funcmapfile)
    funcmap.load_all()
    profs = [Loader(os.path.join(logdir, f), funcmap)
             for f in dir_contents if f.startswith("profile")]
    [loader.load_all() for loader in profs]
    # Unique nodes list
    nodes = [attr.find("value").string
             for loader in profs
             for attr in loader.soup.findAll("attribute")
             if attr.find("name").string == "Node Name"]
    nodeset = set(nodes)
    # Profgroup
    profgroup_dic = dict()
    profgroup_dic["procs"] = len(profs)
    #loader = profs[0]
    lcands = filter(lambda prof: prof.filename.endswith("profile.0.0.0"), profs)
    assert(len(lcands) == 1)
    loader = lcands[0]
    print loader.filename
    #print loader.soup
    for attr in loader.soup.findAll("attribute"):
        #print [attr.find("name").string, attr.find("value").string]
        if attr.find("name").string == "Executable":
            appname = attr.find("value").string
            profgroup_dic["application"] = appname
        if attr.find("name").string == "Hostname":
            cl_name = hostname2clustername(attr.find("value").string)
            profgroup_dic["place"] = cl_name
        #if attr.find("name").string == "Hostname":
    profgroup_dic["nodes"] = len(nodeset)
    print "Metadata: %s" % (str(profgroup_dic))
    # Profile
    group_id = "dummy"
    for loader in profs:
        # Insert profile info
        rank = filename2rank(loader.filename)
        for funcname, func in loader.profile.function.iteritems():
            pdic = dict()
            pdic["rank"] = rank
            #print "Processing %s ..." % (funcname)
            pdic["funcname"] = funcname
            pdic["profgroup_id"] = group_id
            try:
                pdic["incl"] = func.attr["incl"]
                pdic["excl"] = func.attr["excl"]
                pdic["subrs"] = func.attr["subrs"]
                pdic["calls"] = func.attr["calls"]
                pdic["group_s"] = func.attr["group"]
            except KeyError, e:
                raise
            try:
                pass
                #print rdic
            finally:
                pass