/
githubmirror
/
jekyll
Обзор
Документация
Войти
/
githubmirror
/
jekyll
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4.3.3
script/stackprof
49 строк
1 KB
Bogdan
Define path with __dir__ (#6087)
26 июл 2017, 02:20
26 июл 2017, 02:20
8f1959b
Код
Авторство
О чём код?
#!/usr/bin/env ruby require "bundler/setup" require "json" require "stackprof" require File.expand_path("../lib/jekyll", __dir__) MODE = ARGV.first || "cpu" PROF_OUTPUT_FILE = File.expand_path("../tmp/stackprof-#{MODE}-#{Time.now.strftime("%Y%m%d%H%M")}.dump", __dir__) puts "Stackprof Mode: #{MODE}" unless File.exist?(PROF_OUTPUT_FILE) StackProf.run( mode: MODE.to_sym, interval: 100, raw: true, out: PROF_OUTPUT_FILE ) do puts "GC Stats:", JSON.pretty_generate(GC.stat) GC.disable Jekyll::Commands::Build.process({'source' => 'docs'}) puts 'GC Stats:' GC.start(full_mark: true, immediate_sweep: false) puts JSON.pretty_generate(GC.stat) end end options = { sort: true, limit: 30, format: :text, } # You can also do other things. Examples: # https://github.com/tmm1/stackprof/blob/master/bin/stackprof report = StackProf::Report.new(Marshal.load(IO.binread(PROF_OUTPUT_FILE))) report.print_text( options[:sort], options[:limit], options[:select_files], options[:reject_files], options[:select_names], options[:reject_names] ) puts "Results stored in #{PROF_OUTPUT_FILE}"