airbnb-ruby-prof 0.0.1

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.
Files changed (116) hide show
  1. data/CHANGES +483 -0
  2. data/LICENSE +25 -0
  3. data/README.rdoc +426 -0
  4. data/Rakefile +51 -0
  5. data/bin/ruby-prof +279 -0
  6. data/bin/ruby-prof-check-trace +45 -0
  7. data/examples/flat.txt +50 -0
  8. data/examples/graph.dot +84 -0
  9. data/examples/graph.html +823 -0
  10. data/examples/graph.txt +139 -0
  11. data/examples/multi.flat.txt +23 -0
  12. data/examples/multi.graph.html +760 -0
  13. data/examples/multi.grind.dat +114 -0
  14. data/examples/multi.stack.html +547 -0
  15. data/examples/stack.html +547 -0
  16. data/ext/ruby_prof/extconf.rb +67 -0
  17. data/ext/ruby_prof/rp_call_info.c +374 -0
  18. data/ext/ruby_prof/rp_call_info.h +59 -0
  19. data/ext/ruby_prof/rp_fast_call_tree_printer.c +247 -0
  20. data/ext/ruby_prof/rp_fast_call_tree_printer.h +10 -0
  21. data/ext/ruby_prof/rp_measure.c +71 -0
  22. data/ext/ruby_prof/rp_measure.h +56 -0
  23. data/ext/ruby_prof/rp_measure_allocations.c +74 -0
  24. data/ext/ruby_prof/rp_measure_cpu_time.c +134 -0
  25. data/ext/ruby_prof/rp_measure_gc_runs.c +71 -0
  26. data/ext/ruby_prof/rp_measure_gc_time.c +58 -0
  27. data/ext/ruby_prof/rp_measure_memory.c +75 -0
  28. data/ext/ruby_prof/rp_measure_process_time.c +69 -0
  29. data/ext/ruby_prof/rp_measure_wall_time.c +43 -0
  30. data/ext/ruby_prof/rp_method.c +717 -0
  31. data/ext/ruby_prof/rp_method.h +79 -0
  32. data/ext/ruby_prof/rp_stack.c +221 -0
  33. data/ext/ruby_prof/rp_stack.h +81 -0
  34. data/ext/ruby_prof/rp_thread.c +312 -0
  35. data/ext/ruby_prof/rp_thread.h +36 -0
  36. data/ext/ruby_prof/ruby_prof.c +800 -0
  37. data/ext/ruby_prof/ruby_prof.h +64 -0
  38. data/ext/ruby_prof/vc/ruby_prof.sln +32 -0
  39. data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +108 -0
  40. data/ext/ruby_prof/vc/ruby_prof_19.vcxproj +110 -0
  41. data/ext/ruby_prof/vc/ruby_prof_20.vcxproj +110 -0
  42. data/lib/ruby-prof.rb +63 -0
  43. data/lib/ruby-prof/aggregate_call_info.rb +76 -0
  44. data/lib/ruby-prof/assets/call_stack_printer.css.html +117 -0
  45. data/lib/ruby-prof/assets/call_stack_printer.js.html +385 -0
  46. data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
  47. data/lib/ruby-prof/assets/flame_graph_printer.lib.css.html +149 -0
  48. data/lib/ruby-prof/assets/flame_graph_printer.lib.js.html +707 -0
  49. data/lib/ruby-prof/assets/flame_graph_printer.page.js.html +56 -0
  50. data/lib/ruby-prof/assets/flame_graph_printer.tmpl.html.erb +39 -0
  51. data/lib/ruby-prof/call_info.rb +111 -0
  52. data/lib/ruby-prof/call_info_visitor.rb +40 -0
  53. data/lib/ruby-prof/compatibility.rb +186 -0
  54. data/lib/ruby-prof/method_info.rb +109 -0
  55. data/lib/ruby-prof/printers/abstract_printer.rb +85 -0
  56. data/lib/ruby-prof/printers/call_info_printer.rb +41 -0
  57. data/lib/ruby-prof/printers/call_stack_printer.rb +260 -0
  58. data/lib/ruby-prof/printers/call_tree_printer.rb +130 -0
  59. data/lib/ruby-prof/printers/dot_printer.rb +132 -0
  60. data/lib/ruby-prof/printers/fast_call_tree_printer.rb +87 -0
  61. data/lib/ruby-prof/printers/flame_graph_html_printer.rb +59 -0
  62. data/lib/ruby-prof/printers/flame_graph_json_printer.rb +157 -0
  63. data/lib/ruby-prof/printers/flat_printer.rb +70 -0
  64. data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +64 -0
  65. data/lib/ruby-prof/printers/graph_html_printer.rb +244 -0
  66. data/lib/ruby-prof/printers/graph_printer.rb +116 -0
  67. data/lib/ruby-prof/printers/multi_printer.rb +58 -0
  68. data/lib/ruby-prof/profile.rb +22 -0
  69. data/lib/ruby-prof/profile/exclude_common_methods.rb +201 -0
  70. data/lib/ruby-prof/rack.rb +95 -0
  71. data/lib/ruby-prof/task.rb +147 -0
  72. data/lib/ruby-prof/thread.rb +35 -0
  73. data/lib/ruby-prof/version.rb +4 -0
  74. data/lib/ruby-prof/walker.rb +95 -0
  75. data/lib/unprof.rb +10 -0
  76. data/ruby-prof.gemspec +56 -0
  77. data/test/aggregate_test.rb +136 -0
  78. data/test/basic_test.rb +128 -0
  79. data/test/block_test.rb +74 -0
  80. data/test/call_info_test.rb +78 -0
  81. data/test/call_info_visitor_test.rb +31 -0
  82. data/test/duplicate_names_test.rb +32 -0
  83. data/test/dynamic_method_test.rb +55 -0
  84. data/test/enumerable_test.rb +21 -0
  85. data/test/exceptions_test.rb +16 -0
  86. data/test/exclude_methods_test.rb +146 -0
  87. data/test/exclude_threads_test.rb +53 -0
  88. data/test/fiber_test.rb +79 -0
  89. data/test/issue137_test.rb +63 -0
  90. data/test/line_number_test.rb +71 -0
  91. data/test/measure_allocations_test.rb +26 -0
  92. data/test/measure_cpu_time_test.rb +213 -0
  93. data/test/measure_gc_runs_test.rb +32 -0
  94. data/test/measure_gc_time_test.rb +36 -0
  95. data/test/measure_memory_test.rb +33 -0
  96. data/test/measure_process_time_test.rb +63 -0
  97. data/test/measure_wall_time_test.rb +255 -0
  98. data/test/module_test.rb +45 -0
  99. data/test/multi_measure_test.rb +38 -0
  100. data/test/multi_printer_test.rb +83 -0
  101. data/test/no_method_class_test.rb +15 -0
  102. data/test/pause_resume_test.rb +166 -0
  103. data/test/prime.rb +54 -0
  104. data/test/printers_test.rb +255 -0
  105. data/test/printing_recursive_graph_test.rb +127 -0
  106. data/test/rack_test.rb +93 -0
  107. data/test/recursive_test.rb +212 -0
  108. data/test/singleton_test.rb +38 -0
  109. data/test/stack_printer_test.rb +65 -0
  110. data/test/stack_test.rb +138 -0
  111. data/test/start_stop_test.rb +112 -0
  112. data/test/test_helper.rb +264 -0
  113. data/test/thread_test.rb +187 -0
  114. data/test/unique_call_path_test.rb +202 -0
  115. data/test/yarv_test.rb +55 -0
  116. metadata +211 -0
@@ -0,0 +1,64 @@
1
+ /* Copyright (C) 2005-2013 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
+ #include "rp_fast_call_tree_printer.h"
36
+
37
+ extern VALUE mProf;
38
+ extern VALUE cProfile;
39
+
40
+ void method_key(prof_method_key_t* key, VALUE klass, ID mid);
41
+
42
+ typedef struct
43
+ {
44
+ st_table* threads_tbl;
45
+ st_table* exclude_threads_tbl;
46
+ st_table* include_threads_tbl;
47
+ st_table* exclude_methods_tbl;
48
+ thread_data_t* last_thread_data;
49
+ prof_measurements_t* measurements_at_pause_resume;
50
+ int merge_fibers;
51
+
52
+ VALUE main_thread_id;
53
+ uintptr_t next_thread_index;
54
+
55
+ VALUE running;
56
+ VALUE paused;
57
+
58
+ prof_measurer_t* measurer;
59
+ prof_measurements_t* measurements;
60
+ VALUE threads;
61
+ } prof_profile_t;
62
+
63
+
64
+ #endif //__RUBY_PROF_H__
@@ -0,0 +1,32 @@
1
+ 
2
+ Microsoft Visual Studio Solution File, Format Version 11.00
3
+ # Visual Studio 2010
4
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof_18", "ruby_prof_18.vcxproj", "{7789FC23-D053-4733-9ED1-D6CE099E1237}"
5
+ EndProject
6
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof_19", "ruby_prof_19.vcxproj", "{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}"
7
+ EndProject
8
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof_20", "ruby_prof_20.vcxproj", "{6B4978F4-3B5F-4D38-81A8-069EC28CC069}"
9
+ EndProject
10
+ Global
11
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
12
+ Debug|Win32 = Debug|Win32
13
+ Release|Win32 = Release|Win32
14
+ EndGlobalSection
15
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
16
+ {7789FC23-D053-4733-9ED1-D6CE099E1237}.Debug|Win32.ActiveCfg = Debug|Win32
17
+ {7789FC23-D053-4733-9ED1-D6CE099E1237}.Debug|Win32.Build.0 = Debug|Win32
18
+ {7789FC23-D053-4733-9ED1-D6CE099E1237}.Release|Win32.ActiveCfg = Release|Win32
19
+ {7789FC23-D053-4733-9ED1-D6CE099E1237}.Release|Win32.Build.0 = Release|Win32
20
+ {5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Debug|Win32.ActiveCfg = Debug|Win32
21
+ {5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Debug|Win32.Build.0 = Debug|Win32
22
+ {5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Release|Win32.ActiveCfg = Release|Win32
23
+ {5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Release|Win32.Build.0 = Release|Win32
24
+ {6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Debug|Win32.ActiveCfg = Debug|Win32
25
+ {6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Debug|Win32.Build.0 = Debug|Win32
26
+ {6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Release|Win32.ActiveCfg = Release|Win32
27
+ {6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Release|Win32.Build.0 = Release|Win32
28
+ EndGlobalSection
29
+ GlobalSection(SolutionProperties) = preSolution
30
+ HideSolutionNode = FALSE
31
+ EndGlobalSection
32
+ EndGlobal
@@ -0,0 +1,108 @@
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="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <ItemGroup>
14
+ <ClInclude Include="..\rp_call_info.h" />
15
+ <ClInclude Include="..\rp_measure.h" />
16
+ <ClInclude Include="..\rp_method.h" />
17
+ <ClInclude Include="..\rp_stack.h" />
18
+ <ClInclude Include="..\rp_thread.h" />
19
+ <ClInclude Include="..\ruby_prof.h" />
20
+ <ClInclude Include="..\version.h" />
21
+ </ItemGroup>
22
+ <ItemGroup>
23
+ <ClCompile Include="..\rp_call_info.c" />
24
+ <ClCompile Include="..\rp_measure.c" />
25
+ <ClCompile Include="..\rp_measure_allocations.c" />
26
+ <ClCompile Include="..\rp_measure_cpu_time.c" />
27
+ <ClCompile Include="..\rp_measure_gc_runs.c" />
28
+ <ClCompile Include="..\rp_measure_gc_time.c" />
29
+ <ClCompile Include="..\rp_measure_memory.c" />
30
+ <ClCompile Include="..\rp_measure_process_time.c" />
31
+ <ClCompile Include="..\rp_measure_wall_time.c" />
32
+ <ClCompile Include="..\rp_method.c" />
33
+ <ClCompile Include="..\rp_stack.c" />
34
+ <ClCompile Include="..\rp_thread.c" />
35
+ <ClCompile Include="..\ruby_prof.c" />
36
+ </ItemGroup>
37
+ <PropertyGroup Label="Globals">
38
+ <ProjectGuid>{7789FC23-D053-4733-9ED1-D6CE099E1237}</ProjectGuid>
39
+ <Keyword>Win32Proj</Keyword>
40
+ <RootNamespace>ruby_prof_18</RootNamespace>
41
+ </PropertyGroup>
42
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
43
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
44
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
45
+ <UseDebugLibraries>true</UseDebugLibraries>
46
+ <CharacterSet>Unicode</CharacterSet>
47
+ </PropertyGroup>
48
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
49
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
50
+ <UseDebugLibraries>false</UseDebugLibraries>
51
+ <WholeProgramOptimization>true</WholeProgramOptimization>
52
+ <CharacterSet>Unicode</CharacterSet>
53
+ </PropertyGroup>
54
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
55
+ <ImportGroup Label="ExtensionSettings">
56
+ </ImportGroup>
57
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
58
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
59
+ </ImportGroup>
60
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
61
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62
+ </ImportGroup>
63
+ <PropertyGroup Label="UserMacros" />
64
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
65
+ <LinkIncremental>true</LinkIncremental>
66
+ <OutDir>C:\MinGW\local\src\ruby-prof\lib\1.8</OutDir>
67
+ <TargetExt>.so</TargetExt>
68
+ <TargetName>ruby_prof</TargetName>
69
+ </PropertyGroup>
70
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
71
+ <LinkIncremental>false</LinkIncremental>
72
+ </PropertyGroup>
73
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74
+ <ClCompile>
75
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
76
+ <WarningLevel>Level3</WarningLevel>
77
+ <Optimization>Disabled</Optimization>
78
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_18_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
79
+ <AdditionalIncludeDirectories>C:\MinGW\local\ruby187vc\lib\ruby\1.8\i386-mswin32_100</AdditionalIncludeDirectories>
80
+ </ClCompile>
81
+ <Link>
82
+ <SubSystem>Windows</SubSystem>
83
+ <GenerateDebugInformation>true</GenerateDebugInformation>
84
+ <AdditionalLibraryDirectories>C:\MinGW\local\ruby187vc\lib</AdditionalLibraryDirectories>
85
+ <AdditionalDependencies>msvcr100-ruby18.lib;%(AdditionalDependencies)</AdditionalDependencies>
86
+ <ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
87
+ </Link>
88
+ </ItemDefinitionGroup>
89
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
90
+ <ClCompile>
91
+ <WarningLevel>Level3</WarningLevel>
92
+ <PrecompiledHeader>Use</PrecompiledHeader>
93
+ <Optimization>MaxSpeed</Optimization>
94
+ <FunctionLevelLinking>true</FunctionLevelLinking>
95
+ <IntrinsicFunctions>true</IntrinsicFunctions>
96
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_18_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
97
+ </ClCompile>
98
+ <Link>
99
+ <SubSystem>Windows</SubSystem>
100
+ <GenerateDebugInformation>true</GenerateDebugInformation>
101
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
102
+ <OptimizeReferences>true</OptimizeReferences>
103
+ </Link>
104
+ </ItemDefinitionGroup>
105
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
106
+ <ImportGroup Label="ExtensionTargets">
107
+ </ImportGroup>
108
+ </Project>
@@ -0,0 +1,110 @@
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="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <PropertyGroup Label="Globals">
14
+ <ProjectGuid>{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}</ProjectGuid>
15
+ <Keyword>Win32Proj</Keyword>
16
+ <RootNamespace>ruby_prof</RootNamespace>
17
+ </PropertyGroup>
18
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
20
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
21
+ <UseDebugLibraries>true</UseDebugLibraries>
22
+ <CharacterSet>Unicode</CharacterSet>
23
+ </PropertyGroup>
24
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
25
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
26
+ <UseDebugLibraries>false</UseDebugLibraries>
27
+ <WholeProgramOptimization>true</WholeProgramOptimization>
28
+ <CharacterSet>Unicode</CharacterSet>
29
+ </PropertyGroup>
30
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31
+ <ImportGroup Label="ExtensionSettings">
32
+ </ImportGroup>
33
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
34
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
35
+ </ImportGroup>
36
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
37
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38
+ </ImportGroup>
39
+ <PropertyGroup Label="UserMacros" />
40
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
41
+ <LinkIncremental>true</LinkIncremental>
42
+ <OutDir>..\..\..\lib\1.9</OutDir>
43
+ <TargetExt>.so</TargetExt>
44
+ <TargetName>ruby_prof</TargetName>
45
+ </PropertyGroup>
46
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
47
+ <LinkIncremental>false</LinkIncremental>
48
+ </PropertyGroup>
49
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
50
+ <ClCompile>
51
+ <PrecompiledHeader>
52
+ </PrecompiledHeader>
53
+ <WarningLevel>Level3</WarningLevel>
54
+ <Optimization>Disabled</Optimization>
55
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
56
+ <AdditionalIncludeDirectories>C:\MinGW\local\ruby193vc\include\ruby-1.9.1;C:\MinGW\local\ruby193vc\include\ruby-1.9.1\i386-mswin32_100;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
57
+ </ClCompile>
58
+ <Link>
59
+ <SubSystem>Windows</SubSystem>
60
+ <GenerateDebugInformation>true</GenerateDebugInformation>
61
+ <AdditionalLibraryDirectories>C:\MinGW\local\ruby193vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
62
+ <AdditionalDependencies>msvcr100-ruby191.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>
63
+ <ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
64
+ </Link>
65
+ </ItemDefinitionGroup>
66
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
67
+ <ClCompile>
68
+ <WarningLevel>Level3</WarningLevel>
69
+ <PrecompiledHeader>
70
+ </PrecompiledHeader>
71
+ <Optimization>MaxSpeed</Optimization>
72
+ <FunctionLevelLinking>true</FunctionLevelLinking>
73
+ <IntrinsicFunctions>true</IntrinsicFunctions>
74
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
75
+ </ClCompile>
76
+ <Link>
77
+ <SubSystem>Windows</SubSystem>
78
+ <GenerateDebugInformation>true</GenerateDebugInformation>
79
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
80
+ <OptimizeReferences>true</OptimizeReferences>
81
+ </Link>
82
+ </ItemDefinitionGroup>
83
+ <ItemGroup>
84
+ <ClInclude Include="..\rp_call_info.h" />
85
+ <ClInclude Include="..\rp_measure.h" />
86
+ <ClInclude Include="..\rp_method.h" />
87
+ <ClInclude Include="..\rp_stack.h" />
88
+ <ClInclude Include="..\rp_thread.h" />
89
+ <ClInclude Include="..\ruby_prof.h" />
90
+ <ClInclude Include="..\version.h" />
91
+ </ItemGroup>
92
+ <ItemGroup>
93
+ <ClCompile Include="..\rp_call_info.c" />
94
+ <ClCompile Include="..\rp_measure.c" />
95
+ <ClCompile Include="..\rp_measure_allocations.c" />
96
+ <ClCompile Include="..\rp_measure_cpu_time.c" />
97
+ <ClCompile Include="..\rp_measure_gc_runs.c" />
98
+ <ClCompile Include="..\rp_measure_gc_time.c" />
99
+ <ClCompile Include="..\rp_measure_memory.c" />
100
+ <ClCompile Include="..\rp_measure_process_time.c" />
101
+ <ClCompile Include="..\rp_measure_wall_time.c" />
102
+ <ClCompile Include="..\rp_method.c" />
103
+ <ClCompile Include="..\rp_stack.c" />
104
+ <ClCompile Include="..\rp_thread.c" />
105
+ <ClCompile Include="..\ruby_prof.c" />
106
+ </ItemGroup>
107
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
108
+ <ImportGroup Label="ExtensionTargets">
109
+ </ImportGroup>
110
+ </Project>
@@ -0,0 +1,110 @@
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="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <PropertyGroup Label="Globals">
14
+ <ProjectGuid>{6B4978F4-3B5F-4D38-81A8-069EC28CC069}</ProjectGuid>
15
+ <Keyword>Win32Proj</Keyword>
16
+ <RootNamespace>ruby_prof</RootNamespace>
17
+ </PropertyGroup>
18
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
20
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
21
+ <UseDebugLibraries>true</UseDebugLibraries>
22
+ <CharacterSet>Unicode</CharacterSet>
23
+ </PropertyGroup>
24
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
25
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
26
+ <UseDebugLibraries>false</UseDebugLibraries>
27
+ <WholeProgramOptimization>true</WholeProgramOptimization>
28
+ <CharacterSet>Unicode</CharacterSet>
29
+ </PropertyGroup>
30
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31
+ <ImportGroup Label="ExtensionSettings">
32
+ </ImportGroup>
33
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
34
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
35
+ </ImportGroup>
36
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
37
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38
+ </ImportGroup>
39
+ <PropertyGroup Label="UserMacros" />
40
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
41
+ <LinkIncremental>true</LinkIncremental>
42
+ <OutDir>..\..\..\lib\2.0</OutDir>
43
+ <TargetExt>.so</TargetExt>
44
+ <TargetName>ruby_prof</TargetName>
45
+ </PropertyGroup>
46
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
47
+ <LinkIncremental>false</LinkIncremental>
48
+ </PropertyGroup>
49
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
50
+ <ClCompile>
51
+ <PrecompiledHeader>
52
+ </PrecompiledHeader>
53
+ <WarningLevel>Level3</WarningLevel>
54
+ <Optimization>Disabled</Optimization>
55
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
56
+ <AdditionalIncludeDirectories>C:\MinGW\local\ruby200vc\include\ruby-2.0.0;C:\MinGW\local\ruby200vc\include\ruby-2.0.0\i386-mswin32_100;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
57
+ </ClCompile>
58
+ <Link>
59
+ <SubSystem>Windows</SubSystem>
60
+ <GenerateDebugInformation>true</GenerateDebugInformation>
61
+ <AdditionalLibraryDirectories>C:\MinGW\local\ruby200vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
62
+ <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>
63
+ <ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
64
+ </Link>
65
+ </ItemDefinitionGroup>
66
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
67
+ <ClCompile>
68
+ <WarningLevel>Level3</WarningLevel>
69
+ <PrecompiledHeader>
70
+ </PrecompiledHeader>
71
+ <Optimization>MaxSpeed</Optimization>
72
+ <FunctionLevelLinking>true</FunctionLevelLinking>
73
+ <IntrinsicFunctions>true</IntrinsicFunctions>
74
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
75
+ </ClCompile>
76
+ <Link>
77
+ <SubSystem>Windows</SubSystem>
78
+ <GenerateDebugInformation>true</GenerateDebugInformation>
79
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
80
+ <OptimizeReferences>true</OptimizeReferences>
81
+ </Link>
82
+ </ItemDefinitionGroup>
83
+ <ItemGroup>
84
+ <ClInclude Include="..\rp_call_info.h" />
85
+ <ClInclude Include="..\rp_measure.h" />
86
+ <ClInclude Include="..\rp_method.h" />
87
+ <ClInclude Include="..\rp_stack.h" />
88
+ <ClInclude Include="..\rp_thread.h" />
89
+ <ClInclude Include="..\ruby_prof.h" />
90
+ <ClInclude Include="..\version.h" />
91
+ </ItemGroup>
92
+ <ItemGroup>
93
+ <ClCompile Include="..\rp_call_info.c" />
94
+ <ClCompile Include="..\rp_measure.c" />
95
+ <ClCompile Include="..\rp_measure_allocations.c" />
96
+ <ClCompile Include="..\rp_measure_cpu_time.c" />
97
+ <ClCompile Include="..\rp_measure_gc_runs.c" />
98
+ <ClCompile Include="..\rp_measure_gc_time.c" />
99
+ <ClCompile Include="..\rp_measure_memory.c" />
100
+ <ClCompile Include="..\rp_measure_process_time.c" />
101
+ <ClCompile Include="..\rp_measure_wall_time.c" />
102
+ <ClCompile Include="..\rp_method.c" />
103
+ <ClCompile Include="..\rp_stack.c" />
104
+ <ClCompile Include="..\rp_thread.c" />
105
+ <ClCompile Include="..\ruby_prof.c" />
106
+ </ItemGroup>
107
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
108
+ <ImportGroup Label="ExtensionTargets">
109
+ </ImportGroup>
110
+ </Project>
@@ -0,0 +1,63 @@
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/method_info'
15
+ require 'ruby-prof/profile'
16
+ require 'ruby-prof/rack'
17
+ require 'ruby-prof/thread'
18
+ require 'ruby-prof/walker'
19
+
20
+ require 'ruby-prof/printers/fast_call_tree_printer'
21
+
22
+ module RubyProf
23
+ autoload :AggregateCallInfo, 'ruby-prof/aggregate_call_info'
24
+ autoload :CallInfoVisitor, 'ruby-prof/call_info_visitor'
25
+
26
+ autoload :AbstractPrinter, 'ruby-prof/printers/abstract_printer'
27
+ autoload :CallInfoPrinter, 'ruby-prof/printers/call_info_printer'
28
+ autoload :CallStackPrinter, 'ruby-prof/printers/call_stack_printer'
29
+ autoload :CallTreePrinter, 'ruby-prof/printers/call_tree_printer'
30
+ autoload :DotPrinter, 'ruby-prof/printers/dot_printer'
31
+ autoload :FlatPrinter, 'ruby-prof/printers/flat_printer'
32
+ autoload :FlatPrinterWithLineNumbers, 'ruby-prof/printers/flat_printer_with_line_numbers'
33
+ autoload :FlameGraphHtmlPrinter, 'ruby-prof/printers/flame_graph_html_printer'
34
+ autoload :FlameGraphJsonPrinter, 'ruby-prof/printers/flame_graph_json_printer'
35
+ autoload :GraphHtmlPrinter, 'ruby-prof/printers/graph_html_printer'
36
+ autoload :GraphPrinter, 'ruby-prof/printers/graph_printer'
37
+ autoload :MultiPrinter, 'ruby-prof/printers/multi_printer'
38
+
39
+ # Checks if the user specified the clock mode via
40
+ # the RUBY_PROF_MEASURE_MODE environment variable
41
+ def self.figure_measure_mode
42
+ case ENV["RUBY_PROF_MEASURE_MODE"]
43
+ when "wall", "wall_time"
44
+ RubyProf.measure_mode = RubyProf::WALL_TIME
45
+ when "cpu", "cpu_time"
46
+ RubyProf.measure_mode = RubyProf::CPU_TIME
47
+ when "allocations"
48
+ RubyProf.measure_mode = RubyProf::ALLOCATIONS
49
+ when "memory"
50
+ RubyProf.measure_mode = RubyProf::MEMORY
51
+ when "process", "process_time"
52
+ RubyProf.measure_mode = RubyProf::PROCESS_TIME
53
+ when "gc_time"
54
+ RubyProf.measure_mode = RubyProf::GC_TIME
55
+ when "gc_runs"
56
+ RubyProf.measure_mode = RubyProf::GC_RUNS
57
+ else
58
+ # the default is defined in the measure_mode reader
59
+ end
60
+ end
61
+ end
62
+
63
+ RubyProf::figure_measure_mode