ruby-prof 0.11.0.rc1 → 0.11.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/CHANGES +20 -5
  2. data/README.rdoc +10 -3
  3. data/ext/ruby_prof/rp_call_info.c +108 -79
  4. data/ext/ruby_prof/rp_call_info.h +1 -0
  5. data/ext/ruby_prof/rp_measure_cpu_time.c +111 -111
  6. data/ext/ruby_prof/rp_measure_gc_runs.c +1 -1
  7. data/ext/ruby_prof/rp_measure_memory.c +1 -1
  8. data/ext/ruby_prof/rp_measure_process_time.c +71 -71
  9. data/ext/ruby_prof/rp_measure_wall_time.c +1 -1
  10. data/ext/ruby_prof/rp_method.c +143 -73
  11. data/ext/ruby_prof/rp_method.h +7 -4
  12. data/ext/ruby_prof/rp_stack.c +16 -1
  13. data/ext/ruby_prof/rp_stack.h +4 -1
  14. data/ext/ruby_prof/rp_thread.c +165 -35
  15. data/ext/ruby_prof/rp_thread.h +8 -2
  16. data/ext/ruby_prof/ruby_prof.c +164 -171
  17. data/ext/ruby_prof/ruby_prof.h +53 -54
  18. data/ext/ruby_prof/vc/ruby_prof.sln +26 -0
  19. data/ext/ruby_prof/vc/ruby_prof.vcxproj +109 -0
  20. data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +105 -0
  21. data/lib/ruby-prof/aggregate_call_info.rb +9 -7
  22. data/lib/ruby-prof/call_info.rb +2 -27
  23. data/lib/ruby-prof/call_info_visitor.rb +42 -0
  24. data/lib/ruby-prof/{empty.png → images/empty.png} +0 -0
  25. data/lib/ruby-prof/{minus.png → images/minus.png} +0 -0
  26. data/lib/ruby-prof/{plus.png → images/plus.png} +0 -0
  27. data/lib/ruby-prof/method_info.rb +13 -15
  28. data/lib/ruby-prof/{abstract_printer.rb → printers/abstract_printer.rb} +36 -2
  29. data/lib/ruby-prof/printers/call_info_printer.rb +40 -0
  30. data/lib/ruby-prof/{call_stack_printer.rb → printers/call_stack_printer.rb} +11 -16
  31. data/lib/ruby-prof/{call_tree_printer.rb → printers/call_tree_printer.rb} +4 -4
  32. data/lib/ruby-prof/{dot_printer.rb → printers/dot_printer.rb} +11 -31
  33. data/lib/ruby-prof/{flat_printer.rb → printers/flat_printer.rb} +26 -35
  34. data/lib/ruby-prof/{flat_printer_with_line_numbers.rb → printers/flat_printer_with_line_numbers.rb} +14 -25
  35. data/lib/ruby-prof/printers/graph_html_printer.rb +248 -0
  36. data/lib/ruby-prof/{graph_printer.rb → printers/graph_printer.rb} +31 -73
  37. data/lib/ruby-prof/{multi_printer.rb → printers/multi_printer.rb} +0 -0
  38. data/lib/ruby-prof/profile.rb +27 -22
  39. data/lib/ruby-prof/rack.rb +22 -12
  40. data/ruby-prof.gemspec +58 -0
  41. data/test/aggregate_test.rb +6 -6
  42. data/test/call_info_visitor_test.rb +31 -0
  43. data/test/duplicate_names_test.rb +1 -1
  44. data/test/dynamic_method_test.rb +1 -1
  45. data/test/enumerable_test.rb +1 -1
  46. data/test/exclude_threads_test.rb +2 -2
  47. data/test/gc_test.rb +35 -0
  48. data/test/line_number_test.rb +2 -2
  49. data/test/measure_cpu_time_test.rb +5 -5
  50. data/test/measure_process_time_test.rb +5 -5
  51. data/test/measure_wall_time_test.rb +5 -5
  52. data/test/method_elimination_test.rb +3 -3
  53. data/test/module_test.rb +1 -1
  54. data/test/no_method_class_test.rb +1 -1
  55. data/test/printers_test.rb +16 -8
  56. data/test/recursive_test.rb +115 -91
  57. data/test/stack_test.rb +1 -1
  58. data/test/start_stop_test.rb +13 -13
  59. data/test/summarize_test.rb +48 -0
  60. data/test/test_suite.rb +1 -0
  61. data/test/thread_test.rb +16 -12
  62. data/test/unique_call_path_test.rb +10 -10
  63. metadata +64 -85
  64. data/lib/1.8/ruby_prof.so +0 -0
  65. data/lib/1.9/ruby_prof.exp +0 -0
  66. data/lib/1.9/ruby_prof.ilk +0 -0
  67. data/lib/1.9/ruby_prof.lib +0 -0
  68. data/lib/1.9/ruby_prof.pdb +0 -0
  69. data/lib/1.9/ruby_prof.so +0 -0
  70. data/lib/ruby-prof.rb +0 -70
  71. data/lib/ruby-prof/graph_html_printer.rb +0 -286
  72. data/lib/ruby-prof/symbol_to_proc.rb +0 -10
  73. data/lib/ruby_prof.exp +0 -0
  74. data/lib/ruby_prof.ilk +0 -0
  75. data/lib/ruby_prof.lib +0 -0
  76. data/lib/ruby_prof.pdb +0 -0
  77. data/lib/ruby_prof.so +0 -0
  78. data/lib/unprof.rb +0 -10
  79. data/test/do_nothing.rb +0 -0
@@ -1,54 +1,53 @@
1
- /* Copyright (C) 2005-2011 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 <stdio.h>
8
- #include <ruby.h>
9
-
10
- #if RUBY_VERSION == 186
11
- # error 1.8.6 is not supported. Please upgrade to 1.8.7 or 1.9.2 or higher.
12
- #endif
13
-
14
- #if RUBY_VERSION == 190
15
- # error 1.9.0 is not supported. Please upgrade to 1.9.2 or higher.
16
- #endif
17
-
18
- #if RUBY_VERSION == 191
19
- # error 1.9.1 is not supported. Please upgrade to 1.9.2 or higher.
20
- #endif
21
-
22
- #ifndef RUBY_VM
23
- #include <node.h>
24
- typedef rb_event_t rb_event_flag_t;
25
- #define rb_sourcefile() (node ? node->nd_file : 0)
26
- #define rb_sourceline() (node ? nd_line(node) : 0)
27
- #endif
28
-
29
- #include "version.h"
30
-
31
- #include "rp_measure.h"
32
- #include "rp_method.h"
33
- #include "rp_call_info.h"
34
- #include "rp_stack.h"
35
- #include "rp_thread.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
- VALUE running;
45
- prof_measurer_t* measurer;
46
- double measurement;
47
- VALUE threads;
48
- st_table* threads_tbl;
49
- st_table* exclude_threads_tbl;
50
- thread_data_t* last_thread_data;
51
- } prof_profile_t;
52
-
53
-
54
- #endif //__RUBY_PROF_H__
1
+ /* Copyright (C) 2005-2011 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_VERSION == 186
11
+ # error 1.8.6 is not supported. Please upgrade to 1.8.7 or 1.9.2 or higher.
12
+ #endif
13
+
14
+ #if RUBY_VERSION == 190
15
+ # error 1.9.0 is not supported. Please upgrade to 1.9.2 or higher.
16
+ #endif
17
+
18
+ #if RUBY_VERSION == 191
19
+ # error 1.9.1 is not supported. Please upgrade to 1.9.2 or higher.
20
+ #endif
21
+
22
+ #ifndef RUBY_VM
23
+ #include <node.h>
24
+ typedef rb_event_t rb_event_flag_t;
25
+ #define rb_sourcefile() (node ? node->nd_file : 0)
26
+ #define rb_sourceline() (node ? nd_line(node) : 0)
27
+ #endif
28
+
29
+ #include "version.h"
30
+
31
+ #include "rp_measure.h"
32
+ #include "rp_method.h"
33
+ #include "rp_call_info.h"
34
+ #include "rp_stack.h"
35
+ #include "rp_thread.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
+ VALUE running;
45
+ prof_measurer_t* measurer;
46
+ VALUE threads;
47
+ st_table* threads_tbl;
48
+ st_table* exclude_threads_tbl;
49
+ thread_data_t* last_thread_data;
50
+ } prof_profile_t;
51
+
52
+
53
+ #endif //__RUBY_PROF_H__
@@ -0,0 +1,26 @@
1
+ 
2
+ Microsoft Visual Studio Solution File, Format Version 11.00
3
+ # Visual Studio 2010
4
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof", "ruby_prof.vcxproj", "{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}"
5
+ EndProject
6
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof_18", "ruby_prof_18.vcxproj", "{7789FC23-D053-4733-9ED1-D6CE099E1237}"
7
+ EndProject
8
+ Global
9
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
10
+ Debug|Win32 = Debug|Win32
11
+ Release|Win32 = Release|Win32
12
+ EndGlobalSection
13
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
14
+ {5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Debug|Win32.ActiveCfg = Debug|Win32
15
+ {5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Debug|Win32.Build.0 = Debug|Win32
16
+ {5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Release|Win32.ActiveCfg = Release|Win32
17
+ {5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Release|Win32.Build.0 = Release|Win32
18
+ {7789FC23-D053-4733-9ED1-D6CE099E1237}.Debug|Win32.ActiveCfg = Debug|Win32
19
+ {7789FC23-D053-4733-9ED1-D6CE099E1237}.Debug|Win32.Build.0 = Debug|Win32
20
+ {7789FC23-D053-4733-9ED1-D6CE099E1237}.Release|Win32.ActiveCfg = Release|Win32
21
+ {7789FC23-D053-4733-9ED1-D6CE099E1237}.Release|Win32.Build.0 = Release|Win32
22
+ EndGlobalSection
23
+ GlobalSection(SolutionProperties) = preSolution
24
+ HideSolutionNode = FALSE
25
+ EndGlobalSection
26
+ EndGlobal
@@ -0,0 +1,109 @@
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>C:\MinGW\local\src\ruby-prof\lib\1.9</OutDir>
43
+ <TargetExt>.so</TargetExt>
44
+ </PropertyGroup>
45
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
46
+ <LinkIncremental>false</LinkIncremental>
47
+ </PropertyGroup>
48
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
49
+ <ClCompile>
50
+ <PrecompiledHeader>
51
+ </PrecompiledHeader>
52
+ <WarningLevel>Level3</WarningLevel>
53
+ <Optimization>Disabled</Optimization>
54
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
55
+ <AdditionalIncludeDirectories>C:\MinGW\local\ruby193vc\include\ruby-1.9.1;C:\MinGW\local\ruby193vc\include\ruby-1.9.1\i386-mswin32_100;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
56
+ </ClCompile>
57
+ <Link>
58
+ <SubSystem>Windows</SubSystem>
59
+ <GenerateDebugInformation>true</GenerateDebugInformation>
60
+ <AdditionalLibraryDirectories>C:\MinGW\local\ruby193vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
61
+ <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>
62
+ <ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
63
+ </Link>
64
+ </ItemDefinitionGroup>
65
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
66
+ <ClCompile>
67
+ <WarningLevel>Level3</WarningLevel>
68
+ <PrecompiledHeader>
69
+ </PrecompiledHeader>
70
+ <Optimization>MaxSpeed</Optimization>
71
+ <FunctionLevelLinking>true</FunctionLevelLinking>
72
+ <IntrinsicFunctions>true</IntrinsicFunctions>
73
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
74
+ </ClCompile>
75
+ <Link>
76
+ <SubSystem>Windows</SubSystem>
77
+ <GenerateDebugInformation>true</GenerateDebugInformation>
78
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
79
+ <OptimizeReferences>true</OptimizeReferences>
80
+ </Link>
81
+ </ItemDefinitionGroup>
82
+ <ItemGroup>
83
+ <ClInclude Include="..\rp_call_info.h" />
84
+ <ClInclude Include="..\rp_measure.h" />
85
+ <ClInclude Include="..\rp_method.h" />
86
+ <ClInclude Include="..\rp_stack.h" />
87
+ <ClInclude Include="..\rp_thread.h" />
88
+ <ClInclude Include="..\ruby_prof.h" />
89
+ <ClInclude Include="..\version.h" />
90
+ </ItemGroup>
91
+ <ItemGroup>
92
+ <ClCompile Include="..\rp_call_info.c" />
93
+ <ClCompile Include="..\rp_measure.c" />
94
+ <ClCompile Include="..\rp_measure_allocations.c" />
95
+ <ClCompile Include="..\rp_measure_cpu_time.c" />
96
+ <ClCompile Include="..\rp_measure_gc_runs.c" />
97
+ <ClCompile Include="..\rp_measure_gc_time.c" />
98
+ <ClCompile Include="..\rp_measure_memory.c" />
99
+ <ClCompile Include="..\rp_measure_process_time.c" />
100
+ <ClCompile Include="..\rp_measure_wall_time.c" />
101
+ <ClCompile Include="..\rp_method.c" />
102
+ <ClCompile Include="..\rp_stack.c" />
103
+ <ClCompile Include="..\rp_thread.c" />
104
+ <ClCompile Include="..\ruby_prof.c" />
105
+ </ItemGroup>
106
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
107
+ <ImportGroup Label="ExtensionTargets">
108
+ </ImportGroup>
109
+ </Project>
@@ -0,0 +1,105 @@
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
+ </PropertyGroup>
68
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
69
+ <LinkIncremental>false</LinkIncremental>
70
+ </PropertyGroup>
71
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
72
+ <ClCompile>
73
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
74
+ <WarningLevel>Level3</WarningLevel>
75
+ <Optimization>Disabled</Optimization>
76
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_18_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
77
+ <AdditionalIncludeDirectories>C:\MinGW\local\ruby187vc\lib\ruby\1.8\i386-mswin32_100</AdditionalIncludeDirectories>
78
+ </ClCompile>
79
+ <Link>
80
+ <SubSystem>Windows</SubSystem>
81
+ <GenerateDebugInformation>true</GenerateDebugInformation>
82
+ <AdditionalLibraryDirectories>C:\MinGW\local\ruby187vc\lib</AdditionalLibraryDirectories>
83
+ <AdditionalDependencies>msvcr100-ruby18.lib;%(AdditionalDependencies)</AdditionalDependencies>
84
+ </Link>
85
+ </ItemDefinitionGroup>
86
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
87
+ <ClCompile>
88
+ <WarningLevel>Level3</WarningLevel>
89
+ <PrecompiledHeader>Use</PrecompiledHeader>
90
+ <Optimization>MaxSpeed</Optimization>
91
+ <FunctionLevelLinking>true</FunctionLevelLinking>
92
+ <IntrinsicFunctions>true</IntrinsicFunctions>
93
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_18_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
94
+ </ClCompile>
95
+ <Link>
96
+ <SubSystem>Windows</SubSystem>
97
+ <GenerateDebugInformation>true</GenerateDebugInformation>
98
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
99
+ <OptimizeReferences>true</OptimizeReferences>
100
+ </Link>
101
+ </ItemDefinitionGroup>
102
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
103
+ <ImportGroup Label="ExtensionTargets">
104
+ </ImportGroup>
105
+ </Project>
@@ -3,6 +3,7 @@
3
3
  module RubyProf
4
4
  class AggregateCallInfo
5
5
  attr_reader :call_infos
6
+
6
7
  def initialize(call_infos)
7
8
  if call_infos.length == 0
8
9
  raise(ArgumentError, "Must specify at least one call info.")
@@ -29,19 +30,19 @@ module RubyProf
29
30
  end
30
31
 
31
32
  def total_time
32
- aggregate_minimal(:total_time)
33
+ aggregate_without_recursion(:total_time)
33
34
  end
34
35
 
35
36
  def self_time
36
- aggregate(:self_time)
37
+ aggregate_without_recursion(:self_time)
37
38
  end
38
39
 
39
40
  def wait_time
40
- aggregate(:wait_time)
41
+ aggregate_without_recursion(:wait_time)
41
42
  end
42
43
 
43
44
  def children_time
44
- aggregate_minimal(:children_time)
45
+ aggregate_without_recursion(:children_time)
45
46
  end
46
47
 
47
48
  def called
@@ -49,7 +50,7 @@ module RubyProf
49
50
  end
50
51
 
51
52
  def to_s
52
- "#{call_infos.first.full_name}"
53
+ "#{call_infos.first.target.full_name}"
53
54
  end
54
55
 
55
56
  private
@@ -57,12 +58,13 @@ module RubyProf
57
58
  def aggregate(method_name)
58
59
  self.call_infos.inject(0) do |sum, call_info|
59
60
  sum += call_info.send(method_name)
61
+ sum
60
62
  end
61
63
  end
62
64
 
63
- def aggregate_minimal(method_name)
65
+ def aggregate_without_recursion(method_name)
64
66
  self.call_infos.inject(0) do |sum, call_info|
65
- sum += call_info.send(method_name) if call_info.minimal?
67
+ sum += call_info.send(method_name) unless call_info.recursive
66
68
  sum
67
69
  end
68
70
  end
@@ -2,16 +2,7 @@
2
2
 
3
3
  module RubyProf
4
4
  class CallInfo
5
- def depth
6
- result = 0
7
- call_info = self.parent
8
-
9
- while call_info
10
- result += 1
11
- call_info = call_info.parent
12
- end
13
- result
14
- end
5
+ attr_accessor :recursive
15
6
 
16
7
  def children_time
17
8
  children.inject(0) do |sum, call_info|
@@ -43,22 +34,7 @@ module RubyProf
43
34
  end
44
35
 
45
36
  def to_s
46
- "#{call_sequence}"
47
- end
48
-
49
- def minimal?
50
- @minimal
51
- end
52
-
53
- def compute_minimality(parent_methods)
54
- if parent_methods.include?(target)
55
- @minimal = false
56
- else
57
- @minimal = true
58
- parent_methods << target unless children.empty?
59
- end
60
- children.each {|ci| ci.compute_minimality(parent_methods)}
61
- parent_methods.delete(target) if @minimal && !children.empty?
37
+ "#{self.target.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, ct: #{self.children_time})"
62
38
  end
63
39
 
64
40
  # eliminate call info from the call tree.
@@ -109,6 +85,5 @@ module RubyProf
109
85
  other.children.clear
110
86
  other.target.call_infos.delete(other)
111
87
  end
112
-
113
88
  end
114
89
  end