def __init__(self, testname, device, options=None): ''' Constructor @param testname Name of the test, specifies the output file @param device The tested device, a device object ''' ## The name of the test, is used to give the resulting files a name self.__testname = testname ## The tested device, a Device object self.__device = device ## User defined options self.__options = options ## A fio job used to run the tests self.__fioJob = FioJob() ## A list of filenames representing the generated plots self.__figures = [] ## Measurement overview tables, from which plots are generated self.__tables = []
def __init__(self,testname,device,options=None): ''' Constructor @param testname Name of the test, specifies the output file @param device The tested device, a device object ''' ## The name of the test, is used to give the resulting files a name self.__testname = testname ## The tested device, a Device object self.__device = device ## User defined options self.__options = options ## A fio job used to run the tests self.__fioJob = FioJob() ## A list of filenames representing the generated plots self.__figures = [] ## Measurement overview tables, from which plots are generated self.__tables = []
def precondition(self,nj=1,iod=1): ''' Workload independent preconditioning for SSDs. Write two times the device with streaming I/O. @return True if precontioning succeded @exception RuntimeError if fio command fails ''' job = FioJob() job.initialize() job.addKVArg("filename",self.getDevPath()) job.addKVArg("bs","128k") job.addKVArg("rw","write") job.addKVArg("direct","1") job.addSglArg("minimal") job.addKVArg("numjobs",str(nj)) job.addKVArg("ioengine","libaio") job.addKVArg("iodepth",str(iod)) job.addSglArg("group_reporting") job.addSglArg('refill_buffers') for i in range(SSD.wlIndPrecRnds): logging.info("# Starting preconditioning round "+str(i)) job.addKVArg("name", self.getDevName() + '-run' + str(i)) call,out = job.start() if call == False: logging.error("# Could not carry out workload independent preconditioning") raise RuntimeError, "precondition error, fio command error" else: logging.info(out) logging.info("# Finished workload independent preconditioning") return True
class DeviceTest(object): ''' Representing a performance test, run on a device. ''' __metaclass__ = ABCMeta def __init__(self, testname, device, options=None): ''' Constructor @param testname Name of the test, specifies the output file @param device The tested device, a device object ''' ## The name of the test, is used to give the resulting files a name self.__testname = testname ## The tested device, a Device object self.__device = device ## User defined options self.__options = options ## A fio job used to run the tests self.__fioJob = FioJob() ## A list of filenames representing the generated plots self.__figures = [] ## Measurement overview tables, from which plots are generated self.__tables = [] def getTestname(self): return self.__testname def getDevice(self): return self.__device def getOptions(self): return self.__options def getFioJob(self): return self.__fioJob def getFigures(self): return self.__figures def getTables(self): return self.__tables def setFigures(self, fig): ''' Set the list of filenames, representing generated figures. @param fig A list of figure filenames. ''' self.__figures = fig def addFigure(self, fig): ''' Add a filename to the figure list. @param fig The figure - a filename - to add ''' self.__figures.append(fig) def addTable(self, tb): ''' Add an overview measurement table. @param tb The table to add ''' self.__tables.append(tb) def initialize(self): ''' Initialize Device and FioJob to setup params. ''' self.getDevice().initialize() self.initFio() self.__fioJob.checkFioVersion() def initFio(self): ''' Initializes the fio job to run a performance test. @return An initialized fio job object ''' self.__fioJob.initialize() self.__fioJob.addKVArg("filename", self.__device.getDevPath()) self.__fioJob.addKVArg("name", self.__testname) self.__fioJob.addKVArg("direct", "1") self.__fioJob.addSglArg("minimal") self.__fioJob.addKVArg("ioengine", "libaio") self.__fioJob.addSglArg("time_based") if self.__options == None: self.__fioJob.addKVArg("numjobs", str(1)) self.__fioJob.addKVArg("iodepth", str(1)) self.__fioJob.addKVArg("runtime", str(60)) else: if self.getOptions().getNj() != None: self.__fioJob.addKVArg("numjobs", str(self.getOptions().getNj())) if self.getOptions().getIod() != None: self.__fioJob.addKVArg("iodepth", str(self.getOptions().getIod())) if self.getOptions().getRuntime() != None: self.__fioJob.addKVArg("runtime", str(self.getOptions().getRuntime())) if self.getOptions().getXargs() != None: for arg in self.getOptions().getXargs(): self.__fioJob.addSglArg(arg) self.__fioJob.addSglArg("group_reporting") @abstractmethod def testRound(self): ''' A test round for a specific device performance test. ''' @abstractmethod def runRounds(self): ''' Run the specific test rounds. ''' @abstractmethod def run(self): ''' Run the type specific performance test. ''' @abstractmethod def toXml(self): ''' Get the Xml representation of a test. ''' @abstractmethod def fromXml(self): ''' Load a test from a Xml representation. ''' @abstractmethod def genPlots(self): ''' Generate plots for a test. '''
def precondition(self, nj=1, iod=1): ''' Workload independent preconditioning for SSDs. Write two times the device with streaming I/O. @return True if precontioning succeded @exception RuntimeError if fio command fails ''' job = FioJob() job.initialize() job.addKVArg("filename", self.getDevPath()) job.addKVArg("bs", "128k") job.addKVArg("rw", "write") job.addKVArg("direct", "1") job.addSglArg("minimal") job.addKVArg("numjobs", str(nj)) job.addKVArg("ioengine", "libaio") job.addKVArg("iodepth", str(iod)) job.addSglArg("group_reporting") job.addSglArg('refill_buffers') for i in range(SSD.wlIndPrecRnds): logging.info("# Starting preconditioning round " + str(i)) job.addKVArg("name", self.getDevName() + '-run' + str(i)) call, out = job.start() if call == False: logging.error( "# Could not carry out workload independent preconditioning" ) raise RuntimeError, "precondition error, fio command error" else: logging.info(out) logging.info("# Finished workload independent preconditioning") return True
class DeviceTest(object): ''' Representing a performance test, run on a device. ''' __metaclass__ = ABCMeta def __init__(self,testname,device,options=None): ''' Constructor @param testname Name of the test, specifies the output file @param device The tested device, a device object ''' ## The name of the test, is used to give the resulting files a name self.__testname = testname ## The tested device, a Device object self.__device = device ## User defined options self.__options = options ## A fio job used to run the tests self.__fioJob = FioJob() ## A list of filenames representing the generated plots self.__figures = [] ## Measurement overview tables, from which plots are generated self.__tables = [] def getTestname(self): return self.__testname def getDevice(self): return self.__device def getOptions(self): return self.__options def getFioJob(self): return self.__fioJob def getFigures(self): return self.__figures def getTables(self): return self.__tables def setFigures(self,fig): ''' Set the list of filenames, representing generated figures. @param fig A list of figure filenames. ''' self.__figures = fig def addFigure(self,fig): ''' Add a filename to the figure list. @param fig The figure - a filename - to add ''' self.__figures.append(fig) def addTable(self,tb): ''' Add an overview measurement table. @param tb The table to add ''' self.__tables.append(tb) def initialize(self): ''' Initialize Device and FioJob to setup params. ''' self.getDevice().initialize() self.initFio() self.__fioJob.checkFioVersion() def initFio(self): ''' Initializes the fio job to run a performance test. @return An initialized fio job object ''' self.__fioJob.initialize() self.__fioJob.addKVArg("filename",self.__device.getDevPath()) self.__fioJob.addKVArg("name",self.__testname) self.__fioJob.addKVArg("direct","1") self.__fioJob.addSglArg("minimal") self.__fioJob.addKVArg("ioengine","libaio") self.__fioJob.addSglArg("time_based") if self.__options == None: self.__fioJob.addKVArg("numjobs",str(1)) self.__fioJob.addKVArg("iodepth",str(1)) self.__fioJob.addKVArg("runtime",str(60)) else: if self.getOptions().getNj() != None: self.__fioJob.addKVArg("numjobs",str(self.getOptions().getNj())) if self.getOptions().getIod() != None: self.__fioJob.addKVArg("iodepth",str(self.getOptions().getIod())) if self.getOptions().getRuntime() != None: self.__fioJob.addKVArg("runtime",str(self.getOptions().getRuntime())) if self.getOptions().getXargs() != None: for arg in self.getOptions().getXargs(): self.__fioJob.addSglArg(arg) self.__fioJob.addSglArg("group_reporting") @abstractmethod def testRound(self): ''' A test round for a specific device performance test. ''' @abstractmethod def runRounds(self): ''' Run the specific test rounds. ''' @abstractmethod def run(self): ''' Run the type specific performance test. ''' @abstractmethod def toXml(self): ''' Get the Xml representation of a test. ''' @abstractmethod def fromXml(self): ''' Load a test from a Xml representation. ''' @abstractmethod def genPlots(self): ''' Generate plots for a test. '''