Skip to content

Commit

Permalink
proof of concept for measuring number of types (based on -Xlang -prin…
Browse files Browse the repository at this point in the history
…t-stats)
  • Loading branch information
ecrypa committed Oct 13, 2019
1 parent 3322ce7 commit 6578fc6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion metabench.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ file(WRITE "${METABENCH_RB_PATH}"
" # Peak memory usage \n"
" result['PEAK_MEMORY'] = stdout.match(/\\[PEAK_MEMORY: (.+)\\]/i).captures[0].to_f \n"
" \n"
" # Number of types \n"
" result['TYPE_COUNT'] = stdout.match(/\\[TYPE_COUNT: (.+)\\]/i).captures[0].to_i \n"
" \n"
" # Size of the generated executable in KB \n"
" result['EXECUTABLE_SIZE'] = File.size(exe_file).to_f / 1000 \n"
" \n"
Expand Down Expand Up @@ -517,6 +520,8 @@ file(WRITE "${COMPILE_RB_PATH}"
" stdout, stderr, status = Open3.capture3(*command_line) \n"
"}.total \n"
"$stdout.puts(stdout) \n"
"type_count = `#{ARGV.join(' ')} -Xclang -print-stats 2>&1 | grep 'types total' | awk '{printf(\"%s\", $1);}'` \n"
"$stdout.puts(%{[TYPE_COUNT: #{type_count}]}) \n"
"$stdout.puts(%{[compilation command: #{command_line.join(' ')}]}) \n"
"$stdout.puts(%{[COMPILATION_TIME: #{time}]}) \n"
"$stderr.puts(stderr) \n"
Expand Down Expand Up @@ -634,7 +639,7 @@ file(WRITE "${CHART_HTML_ERB_PATH}"
" data.forEach(function(dataset) { \n"
" dataset.values = dataset.values.map(function(value) { \n"
" new_value = {'n': value['n'], 'base': {}, 'total': {}}; \n"
" ['COMPILATION_TIME', 'LINK_TIME', 'EXECUTABLE_SIZE', 'PEAK_MEMORY'].forEach(function(aspect) { \n"
" ['COMPILATION_TIME', 'LINK_TIME', 'EXECUTABLE_SIZE', 'PEAK_MEMORY', 'TYPE_COUNT'].forEach(function(aspect) { \n"
" new_value['base'][aspect] = value.base.map(function(v){ return dataset.scale * v[aspect]; }); \n"
" new_value['total'][aspect] = value.total.map(function(v){ return dataset.scale * v[aspect]; }); \n"
" }); \n"
Expand All @@ -659,6 +664,10 @@ file(WRITE "${CHART_HTML_ERB_PATH}"
" 'PEAK_MEMORY': { \n"
" axisLabel: 'Peak memory usage', \n"
" tickFormat: function(val){ return d3.format('.0f')(val) + 'kb'; } \n"
" }, \n"
" 'TYPE_COUNT': { \n"
" axisLabel: 'Number of types', \n"
" tickFormat: function(val){ return d3.format('.2e')(val); } \n"
" } \n"
" }; \n"
" \n"
Expand Down

0 comments on commit 6578fc6

Please sign in to comment.