ruby-prof 1.0.0
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 +523 -0
- data/LICENSE +25 -0
- data/README.rdoc +5 -0
- data/Rakefile +110 -0
- data/bin/ruby-prof +380 -0
- data/bin/ruby-prof-check-trace +45 -0
- data/ext/ruby_prof/extconf.rb +36 -0
- data/ext/ruby_prof/rp_allocation.c +292 -0
- data/ext/ruby_prof/rp_allocation.h +31 -0
- data/ext/ruby_prof/rp_call_info.c +283 -0
- data/ext/ruby_prof/rp_call_info.h +35 -0
- data/ext/ruby_prof/rp_measure_allocations.c +52 -0
- data/ext/ruby_prof/rp_measure_memory.c +42 -0
- data/ext/ruby_prof/rp_measure_process_time.c +63 -0
- data/ext/ruby_prof/rp_measure_wall_time.c +62 -0
- data/ext/ruby_prof/rp_measurement.c +236 -0
- data/ext/ruby_prof/rp_measurement.h +49 -0
- data/ext/ruby_prof/rp_method.c +642 -0
- data/ext/ruby_prof/rp_method.h +70 -0
- data/ext/ruby_prof/rp_profile.c +881 -0
- data/ext/ruby_prof/rp_profile.h +36 -0
- data/ext/ruby_prof/rp_stack.c +196 -0
- data/ext/ruby_prof/rp_stack.h +56 -0
- data/ext/ruby_prof/rp_thread.c +338 -0
- data/ext/ruby_prof/rp_thread.h +36 -0
- data/ext/ruby_prof/ruby_prof.c +48 -0
- data/ext/ruby_prof/ruby_prof.h +17 -0
- data/ext/ruby_prof/vc/ruby_prof.sln +31 -0
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +143 -0
- data/lib/ruby-prof.rb +53 -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/assets/graph_printer.html.erb +356 -0
- data/lib/ruby-prof/call_info.rb +57 -0
- data/lib/ruby-prof/call_info_visitor.rb +38 -0
- data/lib/ruby-prof/compatibility.rb +109 -0
- data/lib/ruby-prof/exclude_common_methods.rb +198 -0
- data/lib/ruby-prof/measurement.rb +14 -0
- data/lib/ruby-prof/method_info.rb +90 -0
- data/lib/ruby-prof/printers/abstract_printer.rb +118 -0
- data/lib/ruby-prof/printers/call_info_printer.rb +51 -0
- data/lib/ruby-prof/printers/call_stack_printer.rb +269 -0
- data/lib/ruby-prof/printers/call_tree_printer.rb +151 -0
- data/lib/ruby-prof/printers/dot_printer.rb +132 -0
- data/lib/ruby-prof/printers/flat_printer.rb +52 -0
- data/lib/ruby-prof/printers/graph_html_printer.rb +64 -0
- data/lib/ruby-prof/printers/graph_printer.rb +114 -0
- data/lib/ruby-prof/printers/multi_printer.rb +127 -0
- data/lib/ruby-prof/profile.rb +33 -0
- data/lib/ruby-prof/rack.rb +171 -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 +26 -0
- data/test/alias_test.rb +129 -0
- data/test/basic_test.rb +129 -0
- data/test/call_info_visitor_test.rb +31 -0
- data/test/duplicate_names_test.rb +32 -0
- data/test/dynamic_method_test.rb +53 -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/line_number_test.rb +161 -0
- data/test/marshal_test.rb +119 -0
- data/test/measure_allocations.rb +30 -0
- data/test/measure_allocations_test.rb +385 -0
- data/test/measure_allocations_trace_test.rb +385 -0
- data/test/measure_memory_trace_test.rb +756 -0
- data/test/measure_process_time_test.rb +849 -0
- data/test/measure_times.rb +54 -0
- data/test/measure_wall_time_test.rb +459 -0
- data/test/multi_printer_test.rb +71 -0
- data/test/no_method_class_test.rb +15 -0
- data/test/parser_timings.rb +24 -0
- data/test/pause_resume_test.rb +166 -0
- data/test/prime.rb +56 -0
- data/test/printer_call_tree_test.rb +31 -0
- data/test/printer_flat_test.rb +68 -0
- data/test/printer_graph_html_test.rb +60 -0
- data/test/printer_graph_test.rb +41 -0
- data/test/printers_test.rb +141 -0
- data/test/printing_recursive_graph_test.rb +81 -0
- data/test/rack_test.rb +157 -0
- data/test/recursive_test.rb +210 -0
- data/test/singleton_test.rb +38 -0
- data/test/stack_printer_test.rb +64 -0
- data/test/start_stop_test.rb +109 -0
- data/test/test_helper.rb +24 -0
- data/test/thread_test.rb +144 -0
- data/test/unique_call_path_test.rb +190 -0
- data/test/yarv_test.rb +56 -0
- metadata +189 -0
|
@@ -0,0 +1,36 @@
|
|
|
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 __RP_THREAD__
|
|
5
|
+
#define __RP_THREAD__
|
|
6
|
+
|
|
7
|
+
#include "ruby_prof.h"
|
|
8
|
+
#include "rp_stack.h"
|
|
9
|
+
|
|
10
|
+
/* Profiling information for a thread. */
|
|
11
|
+
typedef struct
|
|
12
|
+
{
|
|
13
|
+
// Runtime
|
|
14
|
+
VALUE object; /* Cache to wrapped object */
|
|
15
|
+
VALUE fiber; /* Fiber */
|
|
16
|
+
prof_stack_t* stack; /* Stack of frames */
|
|
17
|
+
bool trace; /* Are we tracking this thread */
|
|
18
|
+
|
|
19
|
+
VALUE thread_id; /* Thread id */
|
|
20
|
+
VALUE fiber_id; /* Fiber id */
|
|
21
|
+
VALUE methods; /* Array of RubyProf::MethodInfo */
|
|
22
|
+
st_table* method_table; /* Methods called in the thread */
|
|
23
|
+
} thread_data_t;
|
|
24
|
+
|
|
25
|
+
void rp_init_thread(void);
|
|
26
|
+
st_table * threads_table_create(void);
|
|
27
|
+
thread_data_t *threads_table_lookup(void *profile, VALUE fiber);
|
|
28
|
+
thread_data_t* threads_table_insert(void *profile, VALUE fiber);
|
|
29
|
+
void switch_thread(void *profile, thread_data_t *thread_data, double measurement);
|
|
30
|
+
void threads_table_free(st_table *table);
|
|
31
|
+
VALUE prof_thread_wrap(thread_data_t *thread);
|
|
32
|
+
void prof_thread_mark(void *data);
|
|
33
|
+
int pause_thread(st_data_t key, st_data_t value, st_data_t data);
|
|
34
|
+
int unpause_thread(st_data_t key, st_data_t value, st_data_t data);
|
|
35
|
+
|
|
36
|
+
#endif //__RP_THREAD__
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
/* ruby-prof tracks the time spent executing every method in ruby programming.
|
|
5
|
+
The main players are:
|
|
6
|
+
|
|
7
|
+
profile_t - This represents 1 profile.
|
|
8
|
+
thread_data_t - Stores data about a single thread.
|
|
9
|
+
prof_stack_t - The method call stack in a particular thread
|
|
10
|
+
prof_method_t - Profiling information about each method
|
|
11
|
+
prof_call_info_t - Keeps track a method's callers and callees.
|
|
12
|
+
|
|
13
|
+
The final result is an instance of a profile object which has a hash table of
|
|
14
|
+
thread_data_t, keyed on the thread id. Each thread in turn has a hash table
|
|
15
|
+
of prof_method_t, keyed on the method id. A hash table is used for quick
|
|
16
|
+
look up when doing a profile. However, it is exposed to Ruby as an array.
|
|
17
|
+
|
|
18
|
+
Each prof_method_t has two hash tables, parent and children, of prof_call_info_t.
|
|
19
|
+
These objects keep track of a method's callers (who called the method) and its
|
|
20
|
+
callees (who the method called). These are keyed the method id, but once again,
|
|
21
|
+
are exposed to Ruby as arrays. Each prof_call_into_t maintains a pointer to the
|
|
22
|
+
caller or callee method, thereby making it easy to navigate through the call
|
|
23
|
+
hierarchy in ruby - which is very helpful for creating call graphs.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#include "ruby_prof.h"
|
|
27
|
+
|
|
28
|
+
#include "rp_allocation.h"
|
|
29
|
+
#include "rp_measurement.h"
|
|
30
|
+
#include "rp_method.h"
|
|
31
|
+
#include "rp_call_info.h"
|
|
32
|
+
#include "rp_profile.h"
|
|
33
|
+
#include "rp_stack.h"
|
|
34
|
+
#include "rp_thread.h"
|
|
35
|
+
|
|
36
|
+
VALUE mProf;
|
|
37
|
+
|
|
38
|
+
void Init_ruby_prof()
|
|
39
|
+
{
|
|
40
|
+
mProf = rb_define_module("RubyProf");
|
|
41
|
+
|
|
42
|
+
rp_init_allocation();
|
|
43
|
+
rp_init_call_info();
|
|
44
|
+
rp_init_measure();
|
|
45
|
+
rp_init_method_info();
|
|
46
|
+
rp_init_profile();
|
|
47
|
+
rp_init_thread();
|
|
48
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 <ruby/debug.h>
|
|
9
|
+
#include <stdio.h>
|
|
10
|
+
#include <stdbool.h>
|
|
11
|
+
|
|
12
|
+
extern VALUE mProf;
|
|
13
|
+
|
|
14
|
+
// This method is not exposed in Ruby header files - at least not as of Ruby 2.6.3 :(
|
|
15
|
+
extern size_t rb_obj_memsize_of(VALUE);
|
|
16
|
+
|
|
17
|
+
#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,143 @@
|
|
|
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\ruby-2.6.3vc\include\ruby-2.6.0\x64-mswin64_140;C:\msys64\usr\local\ruby-2.6.3vc\include\ruby-2.6.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
106
|
+
<Optimization>Disabled</Optimization>
|
|
107
|
+
<PreprocessorDefinitions>HAVE_RB_TRACEARG_CALLEE_ID;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
108
|
+
</ClCompile>
|
|
109
|
+
<Link>
|
|
110
|
+
<AdditionalLibraryDirectories>C:\msys64\usr\local\ruby-2.6.3vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
111
|
+
<AdditionalDependencies>x64-vcruntime140-ruby260.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
112
|
+
<ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
|
|
113
|
+
</Link>
|
|
114
|
+
</ItemDefinitionGroup>
|
|
115
|
+
<ItemGroup>
|
|
116
|
+
<ClInclude Include="..\rp_allocation.h" />
|
|
117
|
+
<ClInclude Include="..\rp_call_info.h" />
|
|
118
|
+
<ClInclude Include="..\rp_measurement.h" />
|
|
119
|
+
<ClInclude Include="..\rp_method.h" />
|
|
120
|
+
<ClInclude Include="..\rp_profile.h" />
|
|
121
|
+
<ClInclude Include="..\rp_stack.h" />
|
|
122
|
+
<ClInclude Include="..\rp_thread.h" />
|
|
123
|
+
<ClInclude Include="..\ruby_prof.h" />
|
|
124
|
+
<ClInclude Include="..\version.h" />
|
|
125
|
+
</ItemGroup>
|
|
126
|
+
<ItemGroup>
|
|
127
|
+
<ClCompile Include="..\rp_allocation.c" />
|
|
128
|
+
<ClCompile Include="..\rp_call_info.c" />
|
|
129
|
+
<ClCompile Include="..\rp_measurement.c" />
|
|
130
|
+
<ClCompile Include="..\rp_measure_allocations.c" />
|
|
131
|
+
<ClCompile Include="..\rp_measure_memory.c" />
|
|
132
|
+
<ClCompile Include="..\rp_measure_process_time.c" />
|
|
133
|
+
<ClCompile Include="..\rp_measure_wall_time.c" />
|
|
134
|
+
<ClCompile Include="..\rp_method.c" />
|
|
135
|
+
<ClCompile Include="..\rp_profile.c" />
|
|
136
|
+
<ClCompile Include="..\rp_stack.c" />
|
|
137
|
+
<ClCompile Include="..\rp_thread.c" />
|
|
138
|
+
<ClCompile Include="..\ruby_prof.c" />
|
|
139
|
+
</ItemGroup>
|
|
140
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
141
|
+
<ImportGroup Label="ExtensionTargets">
|
|
142
|
+
</ImportGroup>
|
|
143
|
+
</Project>
|
data/lib/ruby-prof.rb
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
require 'ruby-prof/version'
|
|
12
|
+
require 'ruby-prof/call_info'
|
|
13
|
+
require 'ruby-prof/compatibility'
|
|
14
|
+
require 'ruby-prof/measurement'
|
|
15
|
+
require 'ruby-prof/method_info'
|
|
16
|
+
require 'ruby-prof/profile'
|
|
17
|
+
require 'ruby-prof/rack'
|
|
18
|
+
require 'ruby-prof/thread'
|
|
19
|
+
|
|
20
|
+
module RubyProf
|
|
21
|
+
autoload :AggregateCallInfo, 'ruby-prof/aggregate_call_info'
|
|
22
|
+
autoload :CallInfoVisitor, 'ruby-prof/call_info_visitor'
|
|
23
|
+
|
|
24
|
+
autoload :AbstractPrinter, 'ruby-prof/printers/abstract_printer'
|
|
25
|
+
autoload :CallInfoPrinter, 'ruby-prof/printers/call_info_printer'
|
|
26
|
+
autoload :CallStackPrinter, 'ruby-prof/printers/call_stack_printer'
|
|
27
|
+
autoload :CallTreePrinter, 'ruby-prof/printers/call_tree_printer'
|
|
28
|
+
autoload :DotPrinter, 'ruby-prof/printers/dot_printer'
|
|
29
|
+
autoload :FlatPrinter, 'ruby-prof/printers/flat_printer'
|
|
30
|
+
autoload :GraphHtmlPrinter, 'ruby-prof/printers/graph_html_printer'
|
|
31
|
+
autoload :GraphPrinter, 'ruby-prof/printers/graph_printer'
|
|
32
|
+
autoload :MultiPrinter, 'ruby-prof/printers/multi_printer'
|
|
33
|
+
|
|
34
|
+
# :nodoc:
|
|
35
|
+
# Checks if the user specified the clock mode via
|
|
36
|
+
# the RUBY_PROF_MEASURE_MODE environment variable
|
|
37
|
+
def self.figure_measure_mode
|
|
38
|
+
case ENV["RUBY_PROF_MEASURE_MODE"]
|
|
39
|
+
when "wall", "wall_time"
|
|
40
|
+
RubyProf.measure_mode = RubyProf::WALL_TIME
|
|
41
|
+
when "allocations"
|
|
42
|
+
RubyProf.measure_mode = RubyProf::ALLOCATIONS
|
|
43
|
+
when "memory"
|
|
44
|
+
RubyProf.measure_mode = RubyProf::MEMORY
|
|
45
|
+
when "process", "process_time"
|
|
46
|
+
RubyProf.measure_mode = RubyProf::PROCESS_TIME
|
|
47
|
+
else
|
|
48
|
+
# the default is defined in the measure_mode reader
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
RubyProf::figure_measure_mode
|
|
@@ -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>
|