JezK
Edit File: log_benchmark_block-i.ri
U:RDoc::AnyMethod[iI"log_benchmark_block:EFI";UnionStationHooks::RequestReporter#log_benchmark_block;FF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"HLogs a benchmarking activity, for display in the activity timeline.;To:RDoc::Markup::BlankLine o; ; [I"JAn activity is a block in the activity timeline in the Union Station ;TI"@user interace. It has a name, a begin time and an end time.;T@o; ; [ I"FThe primary use case of this method is to integrate with Rails's ;TI"Obenchmarking API (`ActiveSupport::Benchmarkable`). The Rails benchmarking ;TI"MAPI allows you to run a block and to log how long that block has taken. ;TI"KBut you can also use it to integrate with the Ruby standard library's ;TI"`Benchmark` class.;T@o; ; [ I"(You can wrap a benchmark call in a ;TI"N`UnionStationHooks.log_benchmark_block` call, so that an entry for it is ;TI"Odisplayed in the acitivity timeline. This method measures the time before ;TI"and after the block runs.;T@o; ; [I"OThe difference between this method and {#log_user_activity_block} is that ;TI"Gthis method generates timeline blocks of a different color, as to ;TI"Edifferentiate user-defined activities from benchmark activities.;T@o; ; [ I"JIf your app is a Rails app, then the `union_station_hooks_rails` gem ;TI"1automatically calls this for you every time ;TI"G`ActiveSupport::Benchmarkable#benchmark` is called. This includes ;TI"7`benchmark` calls from controllers and from views.;T@o; ; [I"N@param title A title for this benchmark. It can be any arbitrary name but;To:RDoc::Markup::Verbatim; [I"may not contain newlines. ;T:@format0o; ; [I",@return The return value of the block. ;TI"H@yield The block is expected to perform the benchmarking activity. ;TI"@example Rails example;To;; [ I"G# This example shows what to put inside a Rails controller action ;TI"N# method. Note that the `log_benchmark_block` call is automatically done ;TI"=# for you if you use the union_station_hooks_rails gem. ;TI"DUnionStationHooks.log_benchmark_block('Process data files') do ;TI"* benchmark('Process data files') do ;TI"# expensive_files_operation ;TI" end ;TI"end;T; 0: @fileI"{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/misc.rb;T:0@omit_headings_from_table_of_contents_below00I"