1729 def main(argv=[__name__]):
1745 (PerfSuiteArgs[
'create'],
1746 PerfSuiteArgs[
'castordir'],
1747 PerfSuiteArgs[
'TimeSizeEvents'],
1748 PerfSuiteArgs[
'IgProfEvents'],
1749 PerfSuiteArgs[
'CallgrindEvents'],
1750 PerfSuiteArgs[
'MemcheckEvents'],
1751 PerfSuiteArgs[
'cmsScimark'],
1752 PerfSuiteArgs[
'cmsScimarkLarge'],
1753 PerfSuiteArgs[
'cmsdriverOptions'],
1754 PerfSuiteArgs[
'cmsdriverPUOptions'],
1755 PerfSuiteArgs[
'stepOptions'],
1756 PerfSuiteArgs[
'quicktest'],
1757 PerfSuiteArgs[
'profilers'],
1758 PerfSuiteArgs[
'cpus'],
1759 PerfSuiteArgs[
'cores'],
1760 PerfSuiteArgs[
'prevrel'],
1761 PerfSuiteArgs[
'bypasshlt'],
1762 PerfSuiteArgs[
'runonspare'],
1763 PerfSuiteArgs[
'perfsuitedir'],
1764 PerfSuiteArgs[
'logfile'],
1765 PerfSuiteArgs[
'TimeSizeCandles'],
1766 PerfSuiteArgs[
'IgProfCandles'],
1767 PerfSuiteArgs[
'CallgrindCandles'],
1768 PerfSuiteArgs[
'MemcheckCandles'],
1769 PerfSuiteArgs[
'TimeSizePUCandles'],
1770 PerfSuiteArgs[
'IgProfPUCandles'],
1771 PerfSuiteArgs[
'CallgrindPUCandles'],
1772 PerfSuiteArgs[
'MemcheckPUCandles'],
1773 PerfSuiteArgs[
'PUInputFile'],
1774 PerfSuiteArgs[
'userInputFile'],
1775 PerfSuiteArgs[
'MailLogRecipients'],
1776 PerfSuiteArgs[
'tarball']
1777 ) = suite.optionParse(argv)
1779 if PerfSuiteArgs[
'create']:
1780 suite.createIgVolume()
1782 if not PerfSuiteArgs[
'logfile'] ==
None:
1783 if os.path.exists(PerfSuiteArgs[
'logfile']):
1784 oldlogfile=PerfSuiteArgs[
'logfile']+
"_"+time.strftime(
"%d-%m-%Y_%H:%M:%S")
1786 mvOldLogfile=subprocess.Popen(
"mv %s %s"%(PerfSuiteArgs[
'logfile'],oldlogfile), shell=
True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
1787 mvOldLogfileExitCode=mvOldLogfile.wait()
1790 ActualLogfile = open(PerfSuiteArgs[
'logfile'],
"w")
1791 if mvOldLogfileExitCode:
1792 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))
1794 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))
1795 except (OSError, IOError), detail:
1796 ActualLogfile.write(
"Failed to open the intended logfile %s, detail error:\n%s"%(PerfSuiteArgs[
'logfile'],detail))
1800 ActualLogfile = open(PerfSuiteArgs[
'logfile'],
"w")
1801 except (OSError, IOError), detail:
1802 ActualLogfile.write(
"Failed to open the intended logfile %s, detail error:\n%s"%(PerfSuiteArgs[
'logfile'],detail))
1803 ActualLogfile.flush()
1806 ActualLogfile.write(
"Performance suite invoked with command line:\n")
1807 cmdline=reduce(
lambda x,y:x+
" "+y,sys.argv)
1808 ActualLogfile.write(cmdline+
"\n")
1809 ActualLogfile.flush()
1812 ActualLogfile.write(
"Initial PerfSuite Arguments:\n")
1813 for key
in PerfSuiteArgs.keys():
1814 ActualLogfile.write(
"%s %s\n"%(key,PerfSuiteArgs[key]))
1815 ActualLogfile.flush()
1818 PerfSuiteArgs[
'cpu_list'] = PerfSuiteArgs[
'cpus']
1821 if len(PerfSuiteArgs[
'cpus']) > 1:
1822 ActualLogfile.write(
"More than 1 cpu: threading the Performance Suite!\n")
1823 outputdir=PerfSuiteArgs[
'perfsuitedir']
1824 runonspare=PerfSuiteArgs[
'runonspare']
1825 cpus=PerfSuiteArgs[
'cpus']
1826 cores=PerfSuiteArgs[
'cores']
1828 for core
in range(PerfSuiteArgs[
'cores']):
1829 cmsScimarkLaunch_pslist={}
1830 if len(cpus) != cores:
1831 if (core
not in cpus):
1833 ActualLogfile.write(
"Submitting cmsScimarkLaunch.csh to run on core cpu "+str(core)+
"\n")
1834 subcmd =
"cd %s ; cmsScimarkLaunch.csh %s" % (outputdir, str(core))
1835 command=
"taskset -c %s sh -c \"%s\" &" % (str(core), subcmd)
1837 ActualLogfile.write(command+
"\n")
1840 cmsScimarkLaunch_pslist[core]=subprocess.Popen(command,shell=
True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
1841 ActualLogfile.write(
"Spawned %s \n with PID %s"%(command,cmsScimarkLaunch_pslist[core].pid))
1842 ActualLogfile.flush()
1843 PerfSuiteArgs[
'runonspare']=
False
1844 logfile=PerfSuiteArgs[
'logfile']
1852 cpudir = os.path.join(outputdir,
"cpu_%s" % cpu)
1853 if not os.path.exists(cpudir):
1855 PerfSuiteArgs[
'perfsuitedir']=cpudir
1856 PerfSuiteArgs[
'cpus']=[cpu]
1857 if PerfSuiteArgs[
'logfile']:
1858 PerfSuiteArgs[
'logfile']=os.path.join(cpudir,os.path.basename(PerfSuiteArgs[
'logfile']))
1860 PerfSuiteArgs[
'logfile']=os.path.join(cpudir,
"cmsPerfSuiteThread.log")
1862 suitethread[cpu]=PerfThread(**PerfSuiteArgs)
1864 ActualLogfile.write(
"Launching PerfSuite thread on cpu%s"%cpu)
1865 ActualLogfile.flush()
1868 suitethread[cpu].
start()
1870 while reduce(
lambda x,y: x
or y,
map(
lambda x: x.isAlive(),suitethread.values())):
1874 except (KeyboardInterrupt, SystemExit):
1876 ActualLogfile.write(
"All PerfSuite threads have completed!\n")
1877 ActualLogfile.flush()
1880 suite.runPerfSuite(**PerfSuiteArgs)