ruby-prof 0.18.0-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGES +500 -0
- data/LICENSE +25 -0
- data/README.rdoc +487 -0
- data/Rakefile +113 -0
- data/bin/ruby-prof +345 -0
- data/bin/ruby-prof-check-trace +45 -0
- data/examples/flat.txt +50 -0
- data/examples/graph.dot +84 -0
- data/examples/graph.html +823 -0
- data/examples/graph.txt +139 -0
- data/examples/multi.flat.txt +23 -0
- data/examples/multi.graph.html +760 -0
- data/examples/multi.grind.dat +114 -0
- data/examples/multi.stack.html +547 -0
- data/examples/stack.html +547 -0
- data/ext/ruby_prof/extconf.rb +68 -0
- data/ext/ruby_prof/rp_call_info.c +425 -0
- data/ext/ruby_prof/rp_call_info.h +53 -0
- data/ext/ruby_prof/rp_measure.c +40 -0
- data/ext/ruby_prof/rp_measure.h +45 -0
- data/ext/ruby_prof/rp_measure_allocations.c +76 -0
- data/ext/ruby_prof/rp_measure_cpu_time.c +136 -0
- data/ext/ruby_prof/rp_measure_gc_runs.c +73 -0
- data/ext/ruby_prof/rp_measure_gc_time.c +60 -0
- data/ext/ruby_prof/rp_measure_memory.c +77 -0
- data/ext/ruby_prof/rp_measure_process_time.c +71 -0
- data/ext/ruby_prof/rp_measure_wall_time.c +45 -0
- data/ext/ruby_prof/rp_method.c +630 -0
- data/ext/ruby_prof/rp_method.h +75 -0
- data/ext/ruby_prof/rp_stack.c +173 -0
- data/ext/ruby_prof/rp_stack.h +63 -0
- data/ext/ruby_prof/rp_thread.c +277 -0
- data/ext/ruby_prof/rp_thread.h +27 -0
- data/ext/ruby_prof/ruby_prof.c +794 -0
- data/ext/ruby_prof/ruby_prof.h +60 -0
- data/ext/ruby_prof/vc/ruby_prof.sln +31 -0
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +141 -0
- data/lib/2.6.3/ruby_prof.so +0 -0
- data/lib/ruby-prof.rb +68 -0
- data/lib/ruby-prof/aggregate_call_info.rb +76 -0
- data/lib/ruby-prof/assets/call_stack_printer.css.html +117 -0
- data/lib/ruby-prof/assets/call_stack_printer.js.html +385 -0
- data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
- data/lib/ruby-prof/call_info.rb +115 -0
- data/lib/ruby-prof/call_info_visitor.rb +40 -0
- data/lib/ruby-prof/compatibility.rb +179 -0
- data/lib/ruby-prof/method_info.rb +121 -0
- data/lib/ruby-prof/printers/abstract_printer.rb +104 -0
- data/lib/ruby-prof/printers/call_info_printer.rb +41 -0
- data/lib/ruby-prof/printers/call_stack_printer.rb +265 -0
- data/lib/ruby-prof/printers/call_tree_printer.rb +143 -0
- data/lib/ruby-prof/printers/dot_printer.rb +132 -0
- data/lib/ruby-prof/printers/flat_printer.rb +70 -0
- data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +83 -0
- data/lib/ruby-prof/printers/graph_html_printer.rb +249 -0
- data/lib/ruby-prof/printers/graph_printer.rb +116 -0
- data/lib/ruby-prof/printers/multi_printer.rb +84 -0
- data/lib/ruby-prof/profile.rb +26 -0
- data/lib/ruby-prof/profile/exclude_common_methods.rb +207 -0
- data/lib/ruby-prof/profile/legacy_method_elimination.rb +50 -0
- data/lib/ruby-prof/rack.rb +174 -0
- data/lib/ruby-prof/task.rb +147 -0
- data/lib/ruby-prof/thread.rb +35 -0
- data/lib/ruby-prof/version.rb +3 -0
- data/lib/unprof.rb +10 -0
- data/ruby-prof.gemspec +58 -0
- data/test/abstract_printer_test.rb +53 -0
- data/test/aggregate_test.rb +136 -0
- data/test/basic_test.rb +128 -0
- data/test/block_test.rb +74 -0
- data/test/call_info_test.rb +78 -0
- data/test/call_info_visitor_test.rb +31 -0
- data/test/duplicate_names_test.rb +32 -0
- data/test/dynamic_method_test.rb +55 -0
- data/test/enumerable_test.rb +21 -0
- data/test/exceptions_test.rb +24 -0
- data/test/exclude_methods_test.rb +146 -0
- data/test/exclude_threads_test.rb +53 -0
- data/test/fiber_test.rb +79 -0
- data/test/issue137_test.rb +63 -0
- data/test/line_number_test.rb +80 -0
- data/test/measure_allocations_test.rb +26 -0
- data/test/measure_cpu_time_test.rb +212 -0
- data/test/measure_gc_runs_test.rb +32 -0
- data/test/measure_gc_time_test.rb +36 -0
- data/test/measure_memory_test.rb +33 -0
- data/test/measure_process_time_test.rb +61 -0
- data/test/measure_wall_time_test.rb +255 -0
- data/test/method_elimination_test.rb +84 -0
- data/test/module_test.rb +45 -0
- data/test/multi_printer_test.rb +104 -0
- data/test/no_method_class_test.rb +15 -0
- data/test/pause_resume_test.rb +166 -0
- data/test/prime.rb +54 -0
- data/test/printers_test.rb +275 -0
- data/test/printing_recursive_graph_test.rb +127 -0
- data/test/rack_test.rb +157 -0
- data/test/recursive_test.rb +215 -0
- data/test/singleton_test.rb +38 -0
- data/test/stack_printer_test.rb +77 -0
- data/test/stack_test.rb +138 -0
- data/test/start_stop_test.rb +112 -0
- data/test/test_helper.rb +267 -0
- data/test/thread_test.rb +187 -0
- data/test/unique_call_path_test.rb +202 -0
- data/test/yarv_test.rb +55 -0
- metadata +199 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
/* Copyright (C) 2005-2019 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com>
|
2
|
+
Please see the LICENSE file for copyright and distribution information */
|
3
|
+
|
4
|
+
#ifndef __RUBY_PROF_H__
|
5
|
+
#define __RUBY_PROF_H__
|
6
|
+
|
7
|
+
#include <ruby.h>
|
8
|
+
#include <stdio.h>
|
9
|
+
|
10
|
+
#if RUBY_PROF_RUBY_VERSION == 10806
|
11
|
+
# error 1.8.6 is not supported. Please upgrade to 1.9.3 or higher.
|
12
|
+
#endif
|
13
|
+
|
14
|
+
#if RUBY_PROF_RUBY_VERSION == 10807
|
15
|
+
# error 1.8.7 is not supported. Please upgrade to 1.9.3 or higher.
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#if RUBY_PROF_RUBY_VERSION == 10900
|
19
|
+
# error 1.9.0 is not supported. Please upgrade to 1.9.3 or higher.
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#if RUBY_PROF_RUBY_VERSION == 10901
|
23
|
+
# error 1.9.1 is not supported. Please upgrade to 1.9.3 or higher.
|
24
|
+
#endif
|
25
|
+
|
26
|
+
#if RUBY_PROF_RUBY_VERSION == 10902
|
27
|
+
# error 1.9.2 is not supported. Please upgrade to 1.9.3 or higher.
|
28
|
+
#endif
|
29
|
+
|
30
|
+
#include "rp_measure.h"
|
31
|
+
#include "rp_method.h"
|
32
|
+
#include "rp_call_info.h"
|
33
|
+
#include "rp_stack.h"
|
34
|
+
#include "rp_thread.h"
|
35
|
+
|
36
|
+
extern VALUE mProf;
|
37
|
+
extern VALUE cProfile;
|
38
|
+
|
39
|
+
void method_key(prof_method_key_t* key, VALUE klass, ID mid);
|
40
|
+
|
41
|
+
typedef struct
|
42
|
+
{
|
43
|
+
VALUE running;
|
44
|
+
VALUE paused;
|
45
|
+
|
46
|
+
prof_measurer_t* measurer;
|
47
|
+
VALUE threads;
|
48
|
+
|
49
|
+
st_table* threads_tbl;
|
50
|
+
st_table* exclude_threads_tbl;
|
51
|
+
st_table* include_threads_tbl;
|
52
|
+
st_table* exclude_methods_tbl;
|
53
|
+
thread_data_t* last_thread_data;
|
54
|
+
double measurement_at_pause_resume;
|
55
|
+
int merge_fibers;
|
56
|
+
int allow_exceptions;
|
57
|
+
} prof_profile_t;
|
58
|
+
|
59
|
+
|
60
|
+
#endif //__RUBY_PROF_H__
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
3
|
+
# Visual Studio Version 16
|
4
|
+
VisualStudioVersion = 16.0.28803.452
|
5
|
+
MinimumVisualStudioVersion = 10.0.40219.1
|
6
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof", "ruby_prof.vcxproj", "{6B4978F4-3B5F-4D38-81A8-069EC28CC069}"
|
7
|
+
EndProject
|
8
|
+
Global
|
9
|
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
10
|
+
Debug|x64 = Debug|x64
|
11
|
+
Debug|x86 = Debug|x86
|
12
|
+
Release|x64 = Release|x64
|
13
|
+
Release|x86 = Release|x86
|
14
|
+
EndGlobalSection
|
15
|
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
16
|
+
{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Debug|x64.ActiveCfg = Debug|x64
|
17
|
+
{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Debug|x64.Build.0 = Debug|x64
|
18
|
+
{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Debug|x86.ActiveCfg = Debug|Win32
|
19
|
+
{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Debug|x86.Build.0 = Debug|Win32
|
20
|
+
{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Release|x64.ActiveCfg = Release|x64
|
21
|
+
{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Release|x64.Build.0 = Release|x64
|
22
|
+
{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Release|x86.ActiveCfg = Release|Win32
|
23
|
+
{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Release|x86.Build.0 = Release|Win32
|
24
|
+
EndGlobalSection
|
25
|
+
GlobalSection(SolutionProperties) = preSolution
|
26
|
+
HideSolutionNode = FALSE
|
27
|
+
EndGlobalSection
|
28
|
+
GlobalSection(ExtensibilityGlobals) = postSolution
|
29
|
+
SolutionGuid = {9E7746F2-2467-4738-9746-4472B5CBF1DA}
|
30
|
+
EndGlobalSection
|
31
|
+
EndGlobal
|
@@ -0,0 +1,141 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
3
|
+
<ItemGroup Label="ProjectConfigurations">
|
4
|
+
<ProjectConfiguration Include="Debug|Win32">
|
5
|
+
<Configuration>Debug</Configuration>
|
6
|
+
<Platform>Win32</Platform>
|
7
|
+
</ProjectConfiguration>
|
8
|
+
<ProjectConfiguration Include="Debug|x64">
|
9
|
+
<Configuration>Debug</Configuration>
|
10
|
+
<Platform>x64</Platform>
|
11
|
+
</ProjectConfiguration>
|
12
|
+
<ProjectConfiguration Include="Release|Win32">
|
13
|
+
<Configuration>Release</Configuration>
|
14
|
+
<Platform>Win32</Platform>
|
15
|
+
</ProjectConfiguration>
|
16
|
+
<ProjectConfiguration Include="Release|x64">
|
17
|
+
<Configuration>Release</Configuration>
|
18
|
+
<Platform>x64</Platform>
|
19
|
+
</ProjectConfiguration>
|
20
|
+
</ItemGroup>
|
21
|
+
<PropertyGroup Label="Globals">
|
22
|
+
<ProjectGuid>{6B4978F4-3B5F-4D38-81A8-069EC28CC069}</ProjectGuid>
|
23
|
+
<Keyword>Win32Proj</Keyword>
|
24
|
+
<RootNamespace>ruby_prof</RootNamespace>
|
25
|
+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
26
|
+
</PropertyGroup>
|
27
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
28
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
29
|
+
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
30
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
31
|
+
<CharacterSet>Unicode</CharacterSet>
|
32
|
+
</PropertyGroup>
|
33
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
34
|
+
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
35
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
36
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
37
|
+
<CharacterSet>Unicode</CharacterSet>
|
38
|
+
</PropertyGroup>
|
39
|
+
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
40
|
+
<PlatformToolset>v142</PlatformToolset>
|
41
|
+
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
42
|
+
</PropertyGroup>
|
43
|
+
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
44
|
+
<PlatformToolset>v142</PlatformToolset>
|
45
|
+
</PropertyGroup>
|
46
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
47
|
+
<ImportGroup Label="ExtensionSettings">
|
48
|
+
</ImportGroup>
|
49
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
50
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
51
|
+
</ImportGroup>
|
52
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
53
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
54
|
+
</ImportGroup>
|
55
|
+
<PropertyGroup Label="UserMacros" />
|
56
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
57
|
+
<LinkIncremental>true</LinkIncremental>
|
58
|
+
<OutDir>..\..\..\lib\2.0</OutDir>
|
59
|
+
<TargetExt>.so</TargetExt>
|
60
|
+
<TargetName>ruby_prof</TargetName>
|
61
|
+
</PropertyGroup>
|
62
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
63
|
+
<LinkIncremental>false</LinkIncremental>
|
64
|
+
</PropertyGroup>
|
65
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
66
|
+
<TargetExt>.so</TargetExt>
|
67
|
+
<OutDir>..</OutDir>
|
68
|
+
</PropertyGroup>
|
69
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
70
|
+
<ClCompile>
|
71
|
+
<PrecompiledHeader>
|
72
|
+
</PrecompiledHeader>
|
73
|
+
<WarningLevel>Level3</WarningLevel>
|
74
|
+
<Optimization>Disabled</Optimization>
|
75
|
+
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
76
|
+
<AdditionalIncludeDirectories>C:\MinGW\local\ruby200vc\include\ruby-2.0.0;C:\MinGW\local\ruby200vc\include\ruby-2.0.0\i386-mswin32_100;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
77
|
+
</ClCompile>
|
78
|
+
<Link>
|
79
|
+
<SubSystem>Windows</SubSystem>
|
80
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
81
|
+
<AdditionalLibraryDirectories>C:\MinGW\local\ruby200vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
82
|
+
<AdditionalDependencies>msvcr100-ruby200.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
83
|
+
<ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
|
84
|
+
</Link>
|
85
|
+
</ItemDefinitionGroup>
|
86
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
87
|
+
<ClCompile>
|
88
|
+
<WarningLevel>Level3</WarningLevel>
|
89
|
+
<PrecompiledHeader>
|
90
|
+
</PrecompiledHeader>
|
91
|
+
<Optimization>MaxSpeed</Optimization>
|
92
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
93
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
94
|
+
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
95
|
+
</ClCompile>
|
96
|
+
<Link>
|
97
|
+
<SubSystem>Windows</SubSystem>
|
98
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
99
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
100
|
+
<OptimizeReferences>true</OptimizeReferences>
|
101
|
+
</Link>
|
102
|
+
</ItemDefinitionGroup>
|
103
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
104
|
+
<ClCompile>
|
105
|
+
<AdditionalIncludeDirectories>C:\msys64\usr\local\ruby263vc\include\ruby-2.6.0\x64-mswin64_140;C:\msys64\usr\local\ruby263vc\include\ruby-2.6.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
106
|
+
<Optimization>Disabled</Optimization>
|
107
|
+
</ClCompile>
|
108
|
+
<Link>
|
109
|
+
<AdditionalLibraryDirectories>C:\msys64\usr\local\ruby263vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
110
|
+
<AdditionalDependencies>x64-vcruntime140-ruby260.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
111
|
+
<ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
|
112
|
+
</Link>
|
113
|
+
</ItemDefinitionGroup>
|
114
|
+
<ItemGroup>
|
115
|
+
<ClInclude Include="..\rp_call_info.h" />
|
116
|
+
<ClInclude Include="..\rp_measure.h" />
|
117
|
+
<ClInclude Include="..\rp_method.h" />
|
118
|
+
<ClInclude Include="..\rp_stack.h" />
|
119
|
+
<ClInclude Include="..\rp_thread.h" />
|
120
|
+
<ClInclude Include="..\ruby_prof.h" />
|
121
|
+
<ClInclude Include="..\version.h" />
|
122
|
+
</ItemGroup>
|
123
|
+
<ItemGroup>
|
124
|
+
<ClCompile Include="..\rp_call_info.c" />
|
125
|
+
<ClCompile Include="..\rp_measure.c" />
|
126
|
+
<ClCompile Include="..\rp_measure_allocations.c" />
|
127
|
+
<ClCompile Include="..\rp_measure_cpu_time.c" />
|
128
|
+
<ClCompile Include="..\rp_measure_gc_runs.c" />
|
129
|
+
<ClCompile Include="..\rp_measure_gc_time.c" />
|
130
|
+
<ClCompile Include="..\rp_measure_memory.c" />
|
131
|
+
<ClCompile Include="..\rp_measure_process_time.c" />
|
132
|
+
<ClCompile Include="..\rp_measure_wall_time.c" />
|
133
|
+
<ClCompile Include="..\rp_method.c" />
|
134
|
+
<ClCompile Include="..\rp_stack.c" />
|
135
|
+
<ClCompile Include="..\rp_thread.c" />
|
136
|
+
<ClCompile Include="..\ruby_prof.c" />
|
137
|
+
</ItemGroup>
|
138
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
139
|
+
<ImportGroup Label="ExtensionTargets">
|
140
|
+
</ImportGroup>
|
141
|
+
</Project>
|
Binary file
|
data/lib/ruby-prof.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Load the C-based binding.
|
4
|
+
begin
|
5
|
+
RUBY_VERSION =~ /(\d+\.\d+\.\d+)/
|
6
|
+
require "#{$1}/ruby_prof.so"
|
7
|
+
rescue LoadError
|
8
|
+
require "ruby_prof.so"
|
9
|
+
end
|
10
|
+
|
11
|
+
module RubyProf
|
12
|
+
module DeprecationWarnings
|
13
|
+
def deprecation_warning(feature, recommendation = nil)
|
14
|
+
$stderr.puts "DEPRECATION WARNING: #{feature}"
|
15
|
+
$stderr.puts recommendation unless recommendation.nil?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
extend DeprecationWarnings
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'ruby-prof/version'
|
22
|
+
require 'ruby-prof/call_info'
|
23
|
+
require 'ruby-prof/compatibility'
|
24
|
+
require 'ruby-prof/method_info'
|
25
|
+
require 'ruby-prof/profile'
|
26
|
+
require 'ruby-prof/rack'
|
27
|
+
require 'ruby-prof/thread'
|
28
|
+
|
29
|
+
module RubyProf
|
30
|
+
autoload :AggregateCallInfo, 'ruby-prof/aggregate_call_info'
|
31
|
+
autoload :CallInfoVisitor, 'ruby-prof/call_info_visitor'
|
32
|
+
|
33
|
+
autoload :AbstractPrinter, 'ruby-prof/printers/abstract_printer'
|
34
|
+
autoload :CallInfoPrinter, 'ruby-prof/printers/call_info_printer'
|
35
|
+
autoload :CallStackPrinter, 'ruby-prof/printers/call_stack_printer'
|
36
|
+
autoload :CallTreePrinter, 'ruby-prof/printers/call_tree_printer'
|
37
|
+
autoload :DotPrinter, 'ruby-prof/printers/dot_printer'
|
38
|
+
autoload :FlatPrinter, 'ruby-prof/printers/flat_printer'
|
39
|
+
autoload :FlatPrinterWithLineNumbers, 'ruby-prof/printers/flat_printer_with_line_numbers'
|
40
|
+
autoload :GraphHtmlPrinter, 'ruby-prof/printers/graph_html_printer'
|
41
|
+
autoload :GraphPrinter, 'ruby-prof/printers/graph_printer'
|
42
|
+
autoload :MultiPrinter, 'ruby-prof/printers/multi_printer'
|
43
|
+
|
44
|
+
# Checks if the user specified the clock mode via
|
45
|
+
# the RUBY_PROF_MEASURE_MODE environment variable
|
46
|
+
def self.figure_measure_mode
|
47
|
+
case ENV["RUBY_PROF_MEASURE_MODE"]
|
48
|
+
when "wall", "wall_time"
|
49
|
+
RubyProf.measure_mode = RubyProf::WALL_TIME
|
50
|
+
when "cpu", "cpu_time"
|
51
|
+
RubyProf.measure_mode = RubyProf::CPU_TIME
|
52
|
+
when "allocations"
|
53
|
+
RubyProf.measure_mode = RubyProf::ALLOCATIONS
|
54
|
+
when "memory"
|
55
|
+
RubyProf.measure_mode = RubyProf::MEMORY
|
56
|
+
when "process", "process_time"
|
57
|
+
RubyProf.measure_mode = RubyProf::PROCESS_TIME
|
58
|
+
when "gc_time"
|
59
|
+
RubyProf.measure_mode = RubyProf::GC_TIME
|
60
|
+
when "gc_runs"
|
61
|
+
RubyProf.measure_mode = RubyProf::GC_RUNS
|
62
|
+
else
|
63
|
+
# the default is defined in the measure_mode reader
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
RubyProf::figure_measure_mode
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module RubyProf
|
4
|
+
class AggregateCallInfo
|
5
|
+
attr_reader :call_infos, :method_info
|
6
|
+
|
7
|
+
def initialize(call_infos, method_info)
|
8
|
+
if call_infos.length == 0
|
9
|
+
raise(ArgumentError, "Must specify at least one call info.")
|
10
|
+
end
|
11
|
+
@call_infos = call_infos
|
12
|
+
@method_info = method_info
|
13
|
+
end
|
14
|
+
|
15
|
+
def target
|
16
|
+
call_infos.first.target
|
17
|
+
end
|
18
|
+
|
19
|
+
def parent
|
20
|
+
call_infos.first.parent
|
21
|
+
end
|
22
|
+
|
23
|
+
def line
|
24
|
+
call_infos.first.line
|
25
|
+
end
|
26
|
+
|
27
|
+
def children
|
28
|
+
call_infos.inject(Array.new) do |result, call_info|
|
29
|
+
result.concat(call_info.children)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def total_time
|
34
|
+
aggregate_roots(:total_time)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self_time
|
38
|
+
aggregate_roots(:self_time)
|
39
|
+
end
|
40
|
+
|
41
|
+
def wait_time
|
42
|
+
aggregate_roots(:wait_time)
|
43
|
+
end
|
44
|
+
|
45
|
+
def children_time
|
46
|
+
aggregate_roots(:children_time)
|
47
|
+
end
|
48
|
+
|
49
|
+
def called
|
50
|
+
aggregate_all(:called)
|
51
|
+
end
|
52
|
+
|
53
|
+
def to_s
|
54
|
+
"#{call_infos.first.target.full_name}"
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
# return all call_infos which are not (grand) children of any other node in the list of given call_infos
|
60
|
+
def roots
|
61
|
+
@roots ||= method_info.recursive? ? CallInfo.roots_of(call_infos) : call_infos
|
62
|
+
end
|
63
|
+
|
64
|
+
def aggregate_all(method_name)
|
65
|
+
call_infos.inject(0) do |sum, call_info|
|
66
|
+
sum + call_info.send(method_name)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def aggregate_roots(method_name)
|
71
|
+
roots.inject(0) do |sum, call_info|
|
72
|
+
sum + call_info.send(method_name)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<style type="text/css">
|
2
|
+
<!--
|
3
|
+
body {
|
4
|
+
font-size:70%;
|
5
|
+
padding:0;
|
6
|
+
margin:5px;
|
7
|
+
margin-right:0px;
|
8
|
+
margin-left:0px;
|
9
|
+
background: #ffffff;
|
10
|
+
}
|
11
|
+
ul {
|
12
|
+
margin-left:0px;
|
13
|
+
margin-top:0px;
|
14
|
+
margin-bottom:0px;
|
15
|
+
padding-left:0px;
|
16
|
+
list-style-type:none;
|
17
|
+
}
|
18
|
+
li {
|
19
|
+
margin-left:11px;
|
20
|
+
padding:0px;
|
21
|
+
white-space:nowrap;
|
22
|
+
border-top:1px solid #cccccc;
|
23
|
+
border-left:1px solid #cccccc;
|
24
|
+
border-bottom:none;
|
25
|
+
}
|
26
|
+
.thread {
|
27
|
+
margin-left:11px;
|
28
|
+
background:#708090;
|
29
|
+
padding-top:3px;
|
30
|
+
padding-left:12px;
|
31
|
+
padding-bottom:2px;
|
32
|
+
border-left:1px solid #CCCCCC;
|
33
|
+
border-top:1px solid #CCCCCC;
|
34
|
+
font-weight:bold;
|
35
|
+
}
|
36
|
+
.hidden {
|
37
|
+
display:none;
|
38
|
+
width:0px;
|
39
|
+
height:0px;
|
40
|
+
margin:0px;
|
41
|
+
padding:0px;
|
42
|
+
border-style:none;
|
43
|
+
}
|
44
|
+
.color01 { background:#adbdeb }
|
45
|
+
.color05 { background:#9daddb }
|
46
|
+
.color0 { background:#8d9dcb }
|
47
|
+
.color1 { background:#89bccb }
|
48
|
+
.color2 { background:#56e3e7 }
|
49
|
+
.color3 { background:#32cd70 }
|
50
|
+
.color4 { background:#a3d53c }
|
51
|
+
.color5 { background:#c4cb34 }
|
52
|
+
.color6 { background:#dcb66d }
|
53
|
+
.color7 { background:#cda59e }
|
54
|
+
.color8 { background:#be9d9c }
|
55
|
+
.color9 { background:#cf947a }
|
56
|
+
#commands {
|
57
|
+
font-size:10pt;
|
58
|
+
padding:10px;
|
59
|
+
margin-left:11px;
|
60
|
+
margin-bottom:0px;
|
61
|
+
margin-top:0px;
|
62
|
+
background:#708090;
|
63
|
+
border-top:1px solid #cccccc;
|
64
|
+
border-left:1px solid #cccccc;
|
65
|
+
border-bottom:none;
|
66
|
+
}
|
67
|
+
#titlebar {
|
68
|
+
font-size:10pt;
|
69
|
+
padding:10px;
|
70
|
+
margin-left:11px;
|
71
|
+
margin-bottom:0px;
|
72
|
+
margin-top:10px;
|
73
|
+
background:#8090a0;
|
74
|
+
border-top:1px solid #cccccc;
|
75
|
+
border-left:1px solid #cccccc;
|
76
|
+
border-bottom:none;
|
77
|
+
}
|
78
|
+
#help {
|
79
|
+
font-size:10pt;
|
80
|
+
padding:10px;
|
81
|
+
margin-left:11px;
|
82
|
+
margin-bottom:0px;
|
83
|
+
margin-top:0px;
|
84
|
+
background:#8090a0;
|
85
|
+
display:none;
|
86
|
+
border-top:1px solid #cccccc;
|
87
|
+
border-left:1px solid #cccccc;
|
88
|
+
border-bottom:none;
|
89
|
+
}
|
90
|
+
#sentinel {
|
91
|
+
height: 400px;
|
92
|
+
margin-left:11px;
|
93
|
+
background:#8090a0;
|
94
|
+
border-top:1px solid #cccccc;
|
95
|
+
border-left:1px solid #cccccc;
|
96
|
+
border-bottom:none;
|
97
|
+
}
|
98
|
+
input { margin-left:10px; }
|
99
|
+
|
100
|
+
.toggle {
|
101
|
+
background: url(data:image/png;base64,%s) no-repeat left center;
|
102
|
+
float:left;
|
103
|
+
width:9px;
|
104
|
+
height:9px;
|
105
|
+
margin:2px 1px 1px 1px;
|
106
|
+
}
|
107
|
+
|
108
|
+
.toggle.minus {
|
109
|
+
background-position: -9px 0;
|
110
|
+
}
|
111
|
+
|
112
|
+
.toggle.plus {
|
113
|
+
background-position: -18px 0;
|
114
|
+
}
|
115
|
+
|
116
|
+
-->
|
117
|
+
</style>
|