def measureAnimationTime(node, timerName, timerInterval, timerOutputType, resultFileName, simulationDeltaTime, iterations):

    # timer
    Sofa.timerSetInterval(timerName, timerInterval) # Set the number of steps neded to compute the timer
    Sofa.timerSetEnabled(timerName, True)
    resultFileName = resultFileName + ".log"
    rootNode = node.getRoot()

    with open(resultFileName, "w+") as outputFile :
        outputFile.write("{")
        i = 0
        Sofa.timerSetOutputType(timerName, timerOutputType)
        while i < iterations:
            Sofa.timerBegin(timerName)
            rootNode.simulationStep(simulationDeltaTime)
            result = Sofa.timerEnd(timerName, rootNode)
            if result != None :
                outputFile.write(result + ",")
                oldResult = result
            i = i+1
        last_pose = outputFile.tell()
        outputFile.seek(last_pose - 1)
        outputFile.write("\n}")
        outputFile.seek(7)
        firstStep = outputFile.read(1)
        outputFile.close()
        Sofa.timerSetEnabled(timerName, 0)

        print "[Scene info]: end of simulation."
    return 0
    def createTimeProfiler(self):
        print 'Time statistics file: ' + self.estFolder + '/' + self.opt['time']['time_statistics_file']
        Sofa.timerSetInterval(self.opt['time']['timer_name'], self.opt['time']['iterations_interval'])    ### Set the number of steps neded to compute the timer
        Sofa.timerSetOutputType(self.opt['time']['timer_name'], 'json')    ### Set output file format
        with open(self.estFolder + '/' + self.opt['time']['time_statistics_file'], "a") as outputFile:
            outputFile.write('{')
            outputFile.close()

        return 0