Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
211174a3
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
211174a3
编写于
1月 30, 2012
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4767 from lest/patch-2
merge MRI performance methods into one file
上级
7cdb1228
94cd8d74
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
56 deletion
+26
-56
activesupport/lib/active_support/testing/performance/ruby.rb
activesupport/lib/active_support/testing/performance/ruby.rb
+26
-8
activesupport/lib/active_support/testing/performance/ruby/yarv.rb
...pport/lib/active_support/testing/performance/ruby/yarv.rb
+0
-48
未找到文件。
activesupport/lib/active_support/testing/performance/ruby.rb
浏览文件 @
211174a3
...
...
@@ -86,9 +86,12 @@ def profile
end
protected
# overridden by each implementation
def
with_gc_stats
GC
::
Profiler
.
enable
GC
.
start
yield
ensure
GC
::
Profiler
.
disable
end
end
...
...
@@ -124,27 +127,42 @@ def measure
class
Memory
<
DigitalInformationUnit
Mode
=
RubyProf
::
MEMORY
if
RubyProf
.
const_defined?
(
:MEMORY
)
# Ruby 1.9 + GCdata patch
if
GC
.
respond_to?
(
:malloc_allocated_size
)
def
measure
GC
.
malloc_allocated_size
end
end
end
class
Objects
<
Amount
Mode
=
RubyProf
::
ALLOCATIONS
if
RubyProf
.
const_defined?
(
:ALLOCATIONS
)
# Ruby 1.9 + GCdata patch
if
GC
.
respond_to?
(
:malloc_allocations
)
def
measure
GC
.
malloc_allocations
end
end
end
class
GcRuns
<
Amount
Mode
=
RubyProf
::
GC_RUNS
if
RubyProf
.
const_defined?
(
:GC_RUNS
)
def
measure
GC
.
count
end
end
class
GcTime
<
Time
Mode
=
RubyProf
::
GC_TIME
if
RubyProf
.
const_defined?
(
:GC_TIME
)
def
measure
GC
::
Profiler
.
total_time
end
end
end
end
end
end
if
RUBY_VERSION
.
between?
(
'1.9.2'
,
'2.0'
)
require
'active_support/testing/performance/ruby/yarv'
else
$stderr
.
puts
'Update your ruby interpreter to be able to run benchmarks.'
exit
end
activesupport/lib/active_support/testing/performance/ruby/yarv.rb
已删除
100644 → 0
浏览文件 @
7cdb1228
module
ActiveSupport
module
Testing
module
Performance
module
Metrics
class
Base
protected
def
with_gc_stats
GC
::
Profiler
.
enable
GC
.
start
yield
ensure
GC
::
Profiler
.
disable
end
end
class
Memory
<
DigitalInformationUnit
# Ruby 1.9 + GCdata patch
if
GC
.
respond_to?
(
:malloc_allocated_size
)
def
measure
GC
.
malloc_allocated_size
end
end
end
class
Objects
<
Amount
# Ruby 1.9 + GCdata patch
if
GC
.
respond_to?
(
:malloc_allocations
)
def
measure
GC
.
malloc_allocations
end
end
end
class
GcRuns
<
Amount
def
measure
GC
.
count
end
end
class
GcTime
<
Time
def
measure
GC
::
Profiler
.
total_time
end
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录