@@ -39,8 +39,9 @@ def __call__(self, parser, namespace, values, option_string=None):
3939run_parser .add_argument ('bin' , help = 'ITK build directory' , action = FullPaths )
4040run_parser .add_argument ('benchmark_bin' ,
4141 help = 'ITK performance benchmarks build directory' , action = FullPaths )
42- run_parser .add_argument ('-g' , '--git-tag' ,
43- help = 'ITK Git tag' , default = 'master' )
42+ run_parser .add_argument ('-r' , '--rev-list' ,
43+ help = 'Arguments for "git rev-list" to select the range of commits to benchmark, for example: "--no-merges v4.10.0..v5.0rc1"' ,
44+ default = '--no-merges HEAD~1..' )
4445
4546upload_parser = subparsers .add_parser ('upload' ,
4647 help = 'upload the benchmarks to data.kitware.com' )
@@ -99,13 +100,7 @@ def check_for_required_programs(command):
99100 sys .stderr .write ("Could not import plotly, please run 'python -m pip install plotly'\n " )
100101 sys .exit (1 )
101102
102- def create_run_directories (itk_src , itk_bin , benchmark_bin , git_tag ):
103- if not os .path .exists (os .path .join (itk_src , '.git' )):
104- dirname = os .path .dirname (itk_src )
105- if not os .path .exists (dirname ):
106- os .makedirs (dirname )
107- subprocess .check_call (['git' , 'clone' ,
108- 'https://github.com/InsightSoftwareConsortium/ITK.git' , itk_src ])
103+ def initialize_directories (itk_src , itk_bin , benchmark_bin , git_tag ):
109104 os .chdir (itk_src )
110105 # Stash any uncommited changes
111106 subprocess .check_call (['git' , 'stash' ])
@@ -293,30 +288,41 @@ def has_sha(filepath):
293288benchmark_src = os .path .abspath (os .path .dirname (__file__ ))
294289
295290if args .command == 'run' :
296- create_run_directories (args .src , args .bin ,
297- args .benchmark_bin ,
298- args .git_tag )
291+ itk_src = args .src
292+ if not os .path .exists (os .path .join (itk_src , '.git' )):
293+ dirname = os .path .dirname (itk_src )
294+ if not os .path .exists (dirname ):
295+ os .makedirs (dirname )
296+ subprocess .check_call (['git' , 'clone' ,
297+ 'https://github.com/InsightSoftwareConsortium/ITK.git' , itk_src ])
298+ os .chdir (itk_src )
299+ revisions = subprocess .check_output ('git rev-list ' + args .rev_list ,
300+ shell = True , universal_newlines = True )
301+ for revision in revisions .split ():
302+ initialize_directories (args .src , args .bin ,
303+ args .benchmark_bin ,
304+ revision )
299305
300- print ('\n \n ITK Repository Information:' )
301- itk_information = extract_itk_information (args .src )
302- print (itk_information )
303- os .environ ['ITKPERFORMANCEBENCHMARK_AUX_JSON' ] = \
304- json .dumps (itk_information )
306+ print ('\n \n ITK Repository Information:' )
307+ itk_information = extract_itk_information (args .src )
308+ print (itk_information )
309+ os .environ ['ITKPERFORMANCEBENCHMARK_AUX_JSON' ] = \
310+ json .dumps (itk_information )
305311
306312
307- print ('\n Building ITK...' )
308- build_itk (args .src , args .bin )
313+ print ('\n Building ITK...' )
314+ build_itk (args .src , args .bin )
309315
310- itk_has_buildinformation = check_for_build_information (args .src )
316+ itk_has_buildinformation = check_for_build_information (args .src )
311317
312- print ('\n Building benchmarks...' )
313- build_benchmarks (benchmark_src , args .benchmark_bin , args .bin ,
314- itk_has_buildinformation )
318+ print ('\n Building benchmarks...' )
319+ build_benchmarks (benchmark_src , args .benchmark_bin , args .bin ,
320+ itk_has_buildinformation )
315321
316- print ('\n Running benchmarks...' )
317- run_benchmarks (args .benchmark_bin , itk_information )
322+ print ('\n Running benchmarks...' )
323+ run_benchmarks (args .benchmark_bin , itk_information )
318324
319- print ('\n Done running performance benchmarks.' )
325+ print ('\n Done running performance benchmarks.' )
320326elif args .command == 'upload' :
321327 upload_benchmark_results (args .benchmark_bin , args .api_key )
322328elif args .command == 'revisions' :
0 commit comments