Beispiel #1
0
def get_sim_desc_from_num(num):
	prefix="#SIM_DESC="
	bob_variant_prefix="#BOB_VARIANT="
	f = open(config.get_marss_dir_path("simulate%d.sh"%num));
	sim_desc=""
	bob_variant=""
	for line in f:
		if line.startswith(prefix):
			sim_desc = line[len(prefix)+1:].strip("\" \n")
		if line.startswith(bob_variant_prefix):
			bob_variant = "_"+line[len(bob_variant_prefix)+1:].strip("\" \n")
	return sim_desc+bob_variant
Beispiel #2
0
    def get_cycle_info(self, blksize=(16 * 1024)):
        logfile_name = config.get_marss_dir_path("run%d.log" % self.num)
        try:
            f = open(logfile_name, "rb")
        except IOError:
            self.status = "NOTHING"
            self.isRunning = False
            return False
        size = os.path.getsize(logfile_name)
        read_size = min(size, blksize)
        if (size > blksize):
            f.seek((-1 * read_size), 2)  # 2 = offset from the end of the file

        lastLines = f.read(read_size).split("\n")[:-2]
        lastLines.reverse()
        #		print lastLines
        lastLine = ""

        #find the last line to get cycle info from
        for line in lastLines:
            if "Completed " in line:
                lastLine = line
                break
        if len(lastLine) == 0:
            return False

        #figure out if there has been any user activity recently (if not, stalled)
        self.stalled = True
        for line in lastLines:
            lineFields = filter(lambda p: len(p) > 0, line.split())
            if not is_all_kernel(lineFields[10:]):
                self.stalled = False
                break

        lastLineFields = filter(lambda p: len(p) > 0, lastLine.split())
        self.cycleNumber = int(lastLineFields[1])
        self.RIPs = " ".join(map(rip_type, lastLineFields[10:]))
        #		self.RIPs = " ".join(lastLineFields[10:])
        return True
Beispiel #3
0
	def get_cycle_info(self,blksize=(16*1024)):
		logfile_name = config.get_marss_dir_path("run%d.log" %self.num)
		try:
			f = open(logfile_name,"rb")
		except IOError:
			self.status="NOTHING"
			self.isRunning=False;
			return False;
		size = os.path.getsize(logfile_name)
		read_size = min(size,blksize)
		if (size > blksize):
			f.seek((-1*read_size),2) # 2 = offset from the end of the file
			
		lastLines = f.read(read_size).split("\n")[:-2]
		lastLines.reverse()
#		print lastLines
		lastLine = ""

		#find the last line to get cycle info from
		for line in lastLines:
			if "Completed " in line:
				lastLine = line; 
				break;
		if len(lastLine) == 0:
			return False	

		#figure out if there has been any user activity recently (if not, stalled)
		self.stalled=True;
		for line in lastLines:
			lineFields = filter(lambda p: len(p) > 0, line.split())
			if not is_all_kernel(lineFields[10:]):
				self.stalled=False;
				break;
		
		lastLineFields = filter(lambda p: len(p) > 0, lastLine.split())
		self.cycleNumber = int(lastLineFields[1])
		self.RIPs = " ".join(map(rip_type, lastLineFields[10:]))
#		self.RIPs = " ".join(lastLineFields[10:])
		return True;
	d = datetime.datetime.now()
	posix_time = int(time.mktime(d.timetuple()))

	run_desc=None
	string_arr=[]
	if len(sys.argv) < 2:
		print "need at least run number"
		exit();
	
	run_num = int(sys.argv[1]);
	run_desc = get_sim_desc_from_num(run_num); 
	if len(sys.argv) == 3:
		run_desc = sys.argv[2];
	
	graph_output_file = "out.png"
	log_file_base_name = config.get_marss_dir_path("run%d.log"%(run_num))

	x_axis_desc = AxisDescription("Cycle Number")
	if not os.path.exists(log_file_base_name):
		print "ERROR: Can't find log file '%s'" % log_file_base_name
		exit();
	g = []
	# eventually the memlog thing is going away, but for now, decide which stats to use
	memlog_file_name = "%s.memlog"%(log_file_base_name)
	if not os.path.exists(memlog_file_name):
		memlog_file_name = config.get_marss_dir_path("run%d.csv")%run_num

		if not os.path.exists(memlog_file_name):
			print "ERROR: Can't find a marss stats file"
			exit();
		else:
    d = datetime.datetime.now()
    posix_time = int(time.mktime(d.timetuple()))

    run_desc = None
    string_arr = []
    if len(sys.argv) < 2:
        print "need at least run number"
        exit()

    run_num = int(sys.argv[1])
    run_desc = get_sim_desc_from_num(run_num)
    if len(sys.argv) == 3:
        run_desc = sys.argv[2]

    graph_output_file = "out.png"
    log_file_base_name = config.get_marss_dir_path("run%d.log" % (run_num))

    x_axis_desc = AxisDescription("Cycle Number")
    if not os.path.exists(log_file_base_name):
        print "ERROR: Can't find log file '%s'" % log_file_base_name
        exit()
    g = []
    # eventually the memlog thing is going away, but for now, decide which stats to use
    memlog_file_name = "%s.memlog" % (log_file_base_name)
    if not os.path.exists(memlog_file_name):
        memlog_file_name = config.get_marss_dir_path("run%d.csv") % run_num

        if not os.path.exists(memlog_file_name):
            print "ERROR: Can't find a marss stats file"
            exit()
        else: