1730 def main(argv=[__name__]):
1746 (PerfSuiteArgs[
'create'],
1747 PerfSuiteArgs[
'castordir'],
1748 PerfSuiteArgs[
'TimeSizeEvents'],
1749 PerfSuiteArgs[
'IgProfEvents'],
1750 PerfSuiteArgs[
'CallgrindEvents'],
1751 PerfSuiteArgs[
'MemcheckEvents'],
1752 PerfSuiteArgs[
'cmsScimark'],
1753 PerfSuiteArgs[
'cmsScimarkLarge'],
1754 PerfSuiteArgs[
'cmsdriverOptions'],
1755 PerfSuiteArgs[
'cmsdriverPUOptions'],
1756 PerfSuiteArgs[
'stepOptions'],
1757 PerfSuiteArgs[
'quicktest'],
1758 PerfSuiteArgs[
'profilers'],
1759 PerfSuiteArgs[
'cpus'],
1760 PerfSuiteArgs[
'cores'],
1761 PerfSuiteArgs[
'prevrel'],
1762 PerfSuiteArgs[
'bypasshlt'],
1763 PerfSuiteArgs[
'runonspare'],
1764 PerfSuiteArgs[
'perfsuitedir'],
1765 PerfSuiteArgs[
'logfile'],
1766 PerfSuiteArgs[
'TimeSizeCandles'],
1767 PerfSuiteArgs[
'IgProfCandles'],
1768 PerfSuiteArgs[
'CallgrindCandles'],
1769 PerfSuiteArgs[
'MemcheckCandles'],
1770 PerfSuiteArgs[
'TimeSizePUCandles'],
1771 PerfSuiteArgs[
'IgProfPUCandles'],
1772 PerfSuiteArgs[
'CallgrindPUCandles'],
1773 PerfSuiteArgs[
'MemcheckPUCandles'],
1774 PerfSuiteArgs[
'PUInputFile'],
1775 PerfSuiteArgs[
'userInputFile'],
1776 PerfSuiteArgs[
'MailLogRecipients'],
1777 PerfSuiteArgs[
'tarball']
1778 ) = suite.optionParse(argv)
1780 if PerfSuiteArgs[
'create']:
1781 suite.createIgVolume()
1783 if not PerfSuiteArgs[
'logfile'] ==
None:
1784 if os.path.exists(PerfSuiteArgs[
'logfile']):
1785 oldlogfile=PerfSuiteArgs[
'logfile']+
"_"+time.strftime(
"%d-%m-%Y_%H:%M:%S")
1787 mvOldLogfile=subprocess.Popen(
"mv %s %s"%(PerfSuiteArgs[
'logfile'],oldlogfile), shell=
True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
1788 mvOldLogfileExitCode=mvOldLogfile.wait()
1791 ActualLogfile = open(PerfSuiteArgs[
'logfile'],
"w")
1792 if mvOldLogfileExitCode:
1793 ActualLogfile.write(
"Please check what happened: A file named %s existed already and the attempt to move it to %s produced the following output: %s\n"%(PerfSuiteArgs[
'logfile'],oldlogfile,mvOldLogfile.stdout))
1795 ActualLogfile.write(
"***WARNING! A file named %s existed already!\n***It has been moved to %s before starting the current logfile!\n"%(PerfSuiteArgs[
'logfile'],oldlogfile))
1796 except (OSError, IOError)
as detail:
1797 ActualLogfile.write(
"Failed to open the intended logfile %s, detail error:\n%s"%(PerfSuiteArgs[
'logfile'],detail))
1801 ActualLogfile = open(PerfSuiteArgs[
'logfile'],
"w")
1802 except (OSError, IOError)
as detail:
1803 ActualLogfile.write(
"Failed to open the intended logfile %s, detail error:\n%s"%(PerfSuiteArgs[
'logfile'],detail))
1804 ActualLogfile.flush()
1807 ActualLogfile.write(
"Performance suite invoked with command line:\n")
1808 cmdline=reduce(
lambda x,y:x+
" "+y,sys.argv)
1809 ActualLogfile.write(cmdline+
"\n")
1810 ActualLogfile.flush()
1813 ActualLogfile.write(
"Initial PerfSuite Arguments:\n")
1814 for key
in PerfSuiteArgs.keys():
1815 ActualLogfile.write(
"%s %s\n"%(key,PerfSuiteArgs[key]))
1816 ActualLogfile.flush()
1819 PerfSuiteArgs[
'cpu_list'] = PerfSuiteArgs[
'cpus']
1822 if len(PerfSuiteArgs[
'cpus']) > 1:
1823 ActualLogfile.write(
"More than 1 cpu: threading the Performance Suite!\n")
1824 outputdir=PerfSuiteArgs[
'perfsuitedir']
1825 runonspare=PerfSuiteArgs[
'runonspare']
1826 cpus=PerfSuiteArgs[
'cpus']
1827 cores=PerfSuiteArgs[
'cores']
1829 for core
in range(PerfSuiteArgs[
'cores']):
1830 cmsScimarkLaunch_pslist={}
1831 if len(cpus) != cores:
1832 if (core
not in cpus):
1834 ActualLogfile.write(
"Submitting cmsScimarkLaunch.csh to run on core cpu "+str(core)+
"\n")
1835 subcmd =
"cd %s ; cmsScimarkLaunch.csh %s" % (outputdir, str(core))
1836 command=
"taskset -c %s sh -c \"%s\" &" % (str(core), subcmd)
1838 ActualLogfile.write(command+
"\n")
1841 cmsScimarkLaunch_pslist[core]=subprocess.Popen(command,shell=
True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
1842 ActualLogfile.write(
"Spawned %s \n with PID %s"%(command,cmsScimarkLaunch_pslist[core].pid))
1843 ActualLogfile.flush()
1844 PerfSuiteArgs[
'runonspare']=
False
1845 logfile=PerfSuiteArgs[
'logfile']
1853 cpudir = os.path.join(outputdir,
"cpu_%s" % cpu)
1854 if not os.path.exists(cpudir):
1856 PerfSuiteArgs[
'perfsuitedir']=cpudir
1857 PerfSuiteArgs[
'cpus']=[cpu]
1858 if PerfSuiteArgs[
'logfile']:
1859 PerfSuiteArgs[
'logfile']=os.path.join(cpudir,os.path.basename(PerfSuiteArgs[
'logfile']))
1861 PerfSuiteArgs[
'logfile']=os.path.join(cpudir,
"cmsPerfSuiteThread.log")
1863 suitethread[cpu]=PerfThread(**PerfSuiteArgs)
1865 ActualLogfile.write(
"Launching PerfSuite thread on cpu%s"%cpu)
1866 ActualLogfile.flush()
1869 suitethread[cpu].
start()
1871 while reduce(
lambda x,y: x
or y, map(
lambda x: x.isAlive(),suitethread.values())):
1875 except (KeyboardInterrupt, SystemExit):
1877 ActualLogfile.write(
"All PerfSuite threads have completed!\n")
1878 ActualLogfile.flush()
1881 suite.runPerfSuite(**PerfSuiteArgs)