def test_A(self): for eachVm in vm_files(self.path): inputfile = os.path.join(self.path, eachVm) g2 = get_graph(inputfile) g2.info() crnew = newcr.CloudRegGraph(g2) crold = oldcr.CloudRegGraph(g2) self.assertEqual(crnew.number_of_edges(), crold.number_of_edges())
def cloudgraph(self): for eachVm in vm_files(self.path): inputfile = os.path.join(self.path, eachVm) g2 = get_graph(inputfile) g2.info() #try: cr2 = CloudRegGraph(g2) cr2.info() cr2.snapshot(self.path + "\\CloudGraphs\\" + g2.name)
def cloudgraph(self): for eachVm in vm_files(self.path): inputfile =os.path.join(self.path, eachVm) g2 = get_graph( inputfile ) g2.info() #try: cr2 = CloudRegGraph(g2) cr2.info() cr2.snapshot(self.path + "\\CloudGraphs\\" +g2.name )
def circuitgraph(self): print u"命令行帮助,可选命令如下" print u"grh:输入一个文件名称,分别生成两个图(包含和不包含PIPO),保存图的信息到\\test\\GexfDotGraphs下" print u"fanout:输入一个文件名称,统计其中组合逻辑和FD节点的扇出数目统计" print u"get:输入一个文件,获取并返回图.打印图的基本信息" cmd = raw_input("graph>:") if cmd == "grh": for eachfile in vm_files(self.path): inputfile = os.path.join(self.path, eachfile) save_graphs(inputfile, self.path + "\\GraphGexf") if cmd == "fanout": g1 = get_graph() fanout_stat(g1) if cmd == "get": fname = raw_input("plz enter filename:") g1 = get_graph(os.path.join(self.path, fname)) g1.info() else: return None
def circuitgraph(self): print u"命令行帮助,可选命令如下" print u"grh:输入一个文件名称,分别生成两个图(包含和不包含PIPO),保存图的信息到\\test\\GexfDotGraphs下" print u"fanout:输入一个文件名称,统计其中组合逻辑和FD节点的扇出数目统计" print u"get:输入一个文件,获取并返回图.打印图的基本信息" cmd = raw_input("graph>:") if cmd == "grh" : for eachfile in vm_files(self.path): inputfile = os.path.join( self.path, eachfile) save_graphs(inputfile, self.path + "\\GraphGexf") if cmd == "fanout": g1 = get_graph() fanout_stat(g1) if cmd == "get": fname = raw_input("plz enter filename:") g1 = get_graph(os.path.join(self.path, fname) ) g1.info() else: return None
def testCrgraphBase(self): path = self.path print path for eachVm in vm_files(path): g2 = get_graph(path+eachVm) # 输入netlist 文件,得到 CircuitGraph对象g2 g2.info() #打印原图的详细信息 cr2 = CloudRegGraph(g2) cr2.info() cr2.to_gexf_file(path+"graph\\%s_crgraph.gexf" % cr2.name) if cr2.number_of_nodes() <= 100: cr2.paint(path+"graph\\")
def crgraph(self): opath = os.path.join(self.path, "oldCrgraphs") if not os.path.exists(opath): os.mkdir(opath) for eachVm in vm_files(self.path): inputfile = os.path.join(self.path, eachVm) g2 = get_graph(inputfile) g2.info() cr2 = old.CloudRegGraph(g2, debug=True) cr2.info() cr2.to_gexf_file(opath + "\\%s_crgraph.gexf" % cr2.name) cr2.snapshot(opath)
def crgraph(self): opath = os.path.join(self.path, "oldCrgraphs") if not os.path.exists(opath): os.mkdir( opath ) for eachVm in vm_files(self.path): inputfile =os.path.join(self.path, eachVm) g2 = get_graph( inputfile ) g2.info() cr2 = old.CloudRegGraph(g2, debug = True) cr2.info() cr2.to_gexf_file( opath + "\\%s_crgraph.gexf" % cr2.name) cr2.snapshot(opath)
def main(): srcpath = raw_input("plz enter path:") for eachVm in vm_files( srcpath ): inputfile = os.path.join( srcpath, eachVm) g = get_graph( inputfile ) g.info() cr = CloudRegGraph( g ) cr.info() # 每一个统计5次 for j in range(0, 10): scanfds = ballast( cr ) with open( os.path.join(srcpath, cr.name[:-11] + "_balScanFDs.txt" ), 'w') as out: for fd in scanfds: out.write("%s %s\n " % (fd.cellref, fd.name) ) out.write( "FD NUMBER: %d" % len(cr.constfds + cr.fds) ) out.write( "SCAN_FD number: %d" % len( scanfds) ) print "FD number:", len(cr.constfds + cr.fds) print "SCAN_FD number: ", len(scanfds)
def main(): srcpath = raw_input("plz enter path:") for eachVm in vm_files(srcpath): inputfile = os.path.join(srcpath, eachVm) g = get_graph(inputfile) g.info() cr = CloudRegGraph(g) cr.info() # 每一个统计5次 for j in range(0, 10): scanfds = ballast(cr) with open(os.path.join(srcpath, cr.name[:-11] + "_balScanFDs.txt"), 'w') as out: for fd in scanfds: out.write("%s %s\n " % (fd.cellref, fd.name)) out.write("FD NUMBER: %d" % len(cr.constfds + cr.fds)) out.write("SCAN_FD number: %d" % len(scanfds)) print "FD number:", len(cr.constfds + cr.fds) print "SCAN_FD number: ", len(scanfds)
time_matlab = 0.0 serverSocket.close() #将自环加进来 start = time.clock() selfloops = cr.selfloop_edges() cr.remove_edges_from( selfloops) time_all = time_matlab + (time.clock() - start) #写入时间统计文件. fobj = open("test\\timeStats_opt.txt", 'a') fobj.write("%s, %.4f\n" % (cr.name[:-11], time_all) ) fobj.close() for edge in selfloops: scan_fds += cr.arcs[ edge] #assert balanced assert pb.__check(cr) return scan_fds if __name__ == "__main__": path = raw_input("plz enter path>") for eachvm in vm_files( path ): g = get_graph( os.path.join(path, eachvm) ) for i in range(0,1): cr = CloudRegGraph( g ) cr.info() scan_fds = get_scan_fds(cr, path) with StdOutRedirect( os.path.join(path, cr.name[:-11]+"_optScanFDs.txt")): print "\n".join([ "%s %s" % (fd.cellref, fd.name) for fd in scan_fds] )