This is a simple example of script to run the test write/read performance of third party software of the drive in Windows environment.Please let me know if you find any place can be better improved, thanks.#! /usr/bin/env pythonimport sys, osimport PCMark import PCMTestfrom decimal import Decimalimport reimport timeclass PCMark(PCMTest) :    DesktopInteractive = True    def __init__(self, cliArgs=[],logger=None) :        PCMTest.__init__(self, cliArgs=cliArgs,logger=logger,subclassName=name)     def _run(self):        pcm = PCMark(self.logger)        counter = 0        readScore = 0        readScores = []        writeScores = []        rdReadScores = []        rdWriteScores = []        rndReadScores = []        rndWrt4Scores = []        rndRd32Scores = []        rndWrt32Scores = []        while counter < 3:            #self.logger.info(Sleeping for 3 minutes before starting the PCM)            #time.sleep(60*3)            counter = counter + 1            self.resultsFile = PCM.run(3,10)            #PCM1            ReadResults = re.findall(Read :.*\d*\.\d* ,self.resultsFile)[0]                   readScore = self.getNumber(seqReadResults)            readScores.append(readScore)            #PCM2            writeResults = re.findall(Write :.*\d*\.\d* ,self.resultsFile)[0]                      writeScore = self.getNumber(writeResults)            writeScores.append(writeScore)            #PCM3            rdWriteResults = re.findall(#3 Read:.*\d*\.\d* ,self.resultsFile)[0]                      rdWriteScore = self.getNumber(rdWriteResults)            rdReadScores.append(rdWriteScore)               #PCM4            rdWriteResults = re.findall(#4 Write :.*\d*\.\d* ,self.resultsFile)[0]                      rdWriteScore = self.getNumber(rdWriteResults)            rdWriteScores.append(rdWriteScore)                                       for score in readScores:            self.logger.info(Read score was: + str(score) + )        averagereadScore = self.averageScores(readScores)            self.logger.info(Avg #1 read: + str(averagereadScore))        if self.checkScores(readScores,averagereadScore):             self.logger.info(Passed because the score was good.)            else:             self.testFailed(Failing because average score was too low.,False)             for score in writeScores:            self.logger.info(Write score was: + str(score))        averagewriteScore = self.averageScores(writeScores)            self.logger.info(Average Sequential Write speed was: + str(averagewriteScore))        if self.checkScores(writeScores,averagewriteScore):             self.logger.info(Passed because the score was good.)            else:             self.testFailed(Failing because average score was too low.,False)           #read        for score in rdReadScores:            self.logger.info(Rd score was: + str(score))        averagerdWriteScore = self.averageScores(rdReadScores)            self.logger.info(Average rd score was: + str(averagerdWriteScore))        if self.checkScores(rdReadScores,averagerdWriteScore):             self.logger.info(Passed because the score was good.)            else:             self.testFailed(Failing because average score was too low.,False)           # write        for score in rdWriteScores:            self.logger.info(Wrt score was: + str(score))        averagerdWriteScore = self.averageScores(rdWriteScores)            self.logger.info(Average wrt score was  + str(averagerdWriteScore))        if self.checkScores(rdWriteScores,averagerdWriteScore):             self.logger.info(Passed because the score was good.)            else:             self.testFailed(Failing because average score was too low.,False)       def averageScores(self, scores):        total = 0        error = 0        for score in scores:            total = total + score            if score == 0:                error =1        averageScores = total / len(scores)        return float(averageScores)    def getNumber(self, results):        numbers = 0        numbers = float(re.findall(\d*\.\d*,results)[0])        return float(numbers)    def checkScores(self, scores, average):        min = average * .01        self.logger.info(Min limit is: %.0i %min)        for score in scores:             if score < min:                 self.logger.info(Score is too low: + str(score))                return False        return Trueif __name__ == __main__:    Main()
Testing third parth software performance
python;python 2.7;io;benchmarking