passenger 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (220) hide show
  1. data/NEWS +29 -0
  2. data/build/agents.rb +1 -0
  3. data/build/apache2.rb +2 -1
  4. data/build/cxx_tests.rb +7 -0
  5. data/build/rpm.rb +17 -22
  6. data/doc/cxxapi/Constants_8h_source.html +1 -1
  7. data/doc/cxxapi/Exceptions_8h_source.html +18 -4
  8. data/doc/cxxapi/Logging_8h_source.html +332 -262
  9. data/doc/cxxapi/annotated.html +1 -0
  10. data/doc/cxxapi/classes.html +4 -4
  11. data/doc/cxxapi/group__Exceptions.html +2 -0
  12. data/doc/cxxapi/hierarchy.html +1 -0
  13. data/doc/cxxapi/inherit__graph__35.map +1 -3
  14. data/doc/cxxapi/inherit__graph__35.md5 +1 -1
  15. data/doc/cxxapi/inherit__graph__35.png +0 -0
  16. data/doc/cxxapi/inherit__graph__36.map +3 -1
  17. data/doc/cxxapi/inherit__graph__36.md5 +1 -1
  18. data/doc/cxxapi/inherit__graph__36.png +0 -0
  19. data/doc/cxxapi/inherit__graph__37.map +1 -1
  20. data/doc/cxxapi/inherit__graph__37.md5 +1 -1
  21. data/doc/cxxapi/inherit__graph__37.png +0 -0
  22. data/doc/cxxapi/inherit__graph__38.map +1 -1
  23. data/doc/cxxapi/inherit__graph__38.md5 +1 -1
  24. data/doc/cxxapi/inherit__graph__38.png +0 -0
  25. data/doc/cxxapi/inherit__graph__39.map +1 -1
  26. data/doc/cxxapi/inherit__graph__39.md5 +1 -1
  27. data/doc/cxxapi/inherit__graph__39.png +0 -0
  28. data/doc/cxxapi/inherit__graph__40.map +1 -1
  29. data/doc/cxxapi/inherit__graph__40.md5 +1 -1
  30. data/doc/cxxapi/inherit__graph__40.png +0 -0
  31. data/doc/cxxapi/inherits.html +9 -6
  32. data/doc/cxxapi/namespacePassenger.html +2 -0
  33. data/doc/cxxapi/tree.html +2 -0
  34. data/doc/rdoc/classes/ConditionVariable.html +215 -0
  35. data/doc/rdoc/classes/Exception.html +120 -0
  36. data/doc/rdoc/classes/GC.html +113 -0
  37. data/doc/rdoc/classes/IO.html +221 -0
  38. data/doc/rdoc/classes/PhusionPassenger.html +397 -0
  39. data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +180 -0
  40. data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +647 -0
  41. data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +654 -0
  42. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/InvalidPassword.html +92 -0
  43. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +97 -0
  44. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +96 -0
  45. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +97 -0
  46. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +96 -0
  47. data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +619 -0
  48. data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +142 -0
  49. data/doc/rdoc/classes/PhusionPassenger/AdminTools/MemoryStats.html +368 -0
  50. data/doc/rdoc/classes/PhusionPassenger/AdminTools/MemoryStats/Process.html +231 -0
  51. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance.html +588 -0
  52. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/CorruptedDirectoryError.html +92 -0
  53. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/GenerationsAbsentError.html +92 -0
  54. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Group.html +147 -0
  55. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Process.html +279 -0
  56. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/RoleDeniedError.html +92 -0
  57. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/StaleDirectoryError.html +92 -0
  58. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Stats.html +123 -0
  59. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/UnsupportedGenerationStructureVersionError.html +92 -0
  60. data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger.html +368 -0
  61. data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger/Log.html +299 -0
  62. data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger/SharedData.html +206 -0
  63. data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +155 -0
  64. data/doc/rdoc/classes/PhusionPassenger/AppProcess.html +367 -0
  65. data/doc/rdoc/classes/PhusionPassenger/ClassicRails.html +95 -0
  66. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/ApplicationSpawner.html +351 -0
  67. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/ApplicationSpawner/Error.html +98 -0
  68. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/CGIFixed.html +200 -0
  69. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/FrameworkSpawner.html +410 -0
  70. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/FrameworkSpawner/Error.html +98 -0
  71. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/RequestHandler.html +156 -0
  72. data/doc/rdoc/classes/PhusionPassenger/ClassicRailsExtensions.html +115 -0
  73. data/doc/rdoc/classes/PhusionPassenger/ClassicRailsExtensions/AnalyticsLogging.html +202 -0
  74. data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +172 -0
  75. data/doc/rdoc/classes/PhusionPassenger/DebugLogging.html +273 -0
  76. data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +145 -0
  77. data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +162 -0
  78. data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +141 -0
  79. data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +92 -0
  80. data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +673 -0
  81. data/doc/rdoc/classes/PhusionPassenger/MessageChannel/InvalidHashError.html +92 -0
  82. data/doc/rdoc/classes/PhusionPassenger/MessageClient.html +415 -0
  83. data/doc/rdoc/classes/PhusionPassenger/NativeSupportLoader.html +134 -0
  84. data/doc/rdoc/classes/PhusionPassenger/Packaging.html +129 -0
  85. data/doc/rdoc/classes/PhusionPassenger/PlatformInfo.html +1972 -0
  86. data/doc/rdoc/classes/PhusionPassenger/Plugin.html +237 -0
  87. data/doc/rdoc/classes/PhusionPassenger/Rack.html +91 -0
  88. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +312 -0
  89. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner/Error.html +98 -0
  90. data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +218 -0
  91. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions.html +114 -0
  92. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging.html +259 -0
  93. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ACExtension.html +139 -0
  94. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ASBenchmarkableExtension.html +118 -0
  95. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ExceptionLogger.html +135 -0
  96. data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +378 -0
  97. data/doc/rdoc/classes/PhusionPassenger/Standalone.html +111 -0
  98. data/doc/rdoc/classes/PhusionPassenger/Standalone/AppFinder.html +252 -0
  99. data/doc/rdoc/classes/PhusionPassenger/Standalone/Command.html +161 -0
  100. data/doc/rdoc/classes/PhusionPassenger/Standalone/ConfigFile.html +368 -0
  101. data/doc/rdoc/classes/PhusionPassenger/Standalone/ConfigFile/DisallowedContextError.html +132 -0
  102. data/doc/rdoc/classes/PhusionPassenger/Standalone/HelpCommand.html +151 -0
  103. data/doc/rdoc/classes/PhusionPassenger/Standalone/Main.html +189 -0
  104. data/doc/rdoc/classes/PhusionPassenger/Standalone/PackageRuntimeCommand.html +177 -0
  105. data/doc/rdoc/classes/PhusionPassenger/Standalone/RuntimeInstaller.html +341 -0
  106. data/doc/rdoc/classes/PhusionPassenger/Standalone/StartCommand.html +203 -0
  107. data/doc/rdoc/classes/PhusionPassenger/Standalone/StatusCommand.html +156 -0
  108. data/doc/rdoc/classes/PhusionPassenger/Standalone/StopCommand.html +168 -0
  109. data/doc/rdoc/classes/PhusionPassenger/Standalone/Utils.html +86 -0
  110. data/doc/rdoc/classes/PhusionPassenger/Standalone/VersionCommand.html +135 -0
  111. data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +125 -0
  112. data/doc/rdoc/classes/PhusionPassenger/Utils.html +1543 -0
  113. data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher.html +204 -0
  114. data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher/DirInfo.html +171 -0
  115. data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher/FileInfo.html +140 -0
  116. data/doc/rdoc/classes/PhusionPassenger/Utils/HostsFileParser.html +260 -0
  117. data/doc/rdoc/classes/PhusionPassenger/Utils/PseudoIO.html +194 -0
  118. data/doc/rdoc/classes/PhusionPassenger/Utils/RewindableInput.html +265 -0
  119. data/doc/rdoc/classes/PhusionPassenger/Utils/RewindableInput/Tempfile.html +120 -0
  120. data/doc/rdoc/classes/PhusionPassenger/Utils/UnseekableSocket.html +561 -0
  121. data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +140 -0
  122. data/doc/rdoc/classes/PhusionPassenger/WSGI.html +89 -0
  123. data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +182 -0
  124. data/doc/rdoc/classes/Process.html +115 -0
  125. data/doc/rdoc/classes/Signal.html +139 -0
  126. data/doc/rdoc/created.rid +1 -0
  127. data/doc/rdoc/files/DEVELOPERS_TXT.html +280 -0
  128. data/doc/rdoc/files/README.html +157 -0
  129. data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +130 -0
  130. data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +135 -0
  131. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +126 -0
  132. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +128 -0
  133. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/memory_stats_rb.html +126 -0
  134. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/server_instance_rb.html +132 -0
  135. data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +122 -0
  136. data/doc/rdoc/files/lib/phusion_passenger/analytics_logger_rb.html +129 -0
  137. data/doc/rdoc/files/lib/phusion_passenger/app_process_rb.html +127 -0
  138. data/doc/rdoc/files/lib/phusion_passenger/classic_rails/application_spawner_rb.html +141 -0
  139. data/doc/rdoc/files/lib/phusion_passenger/classic_rails/cgi_fixed_rb.html +126 -0
  140. data/doc/rdoc/files/lib/phusion_passenger/classic_rails/framework_spawner_rb.html +146 -0
  141. data/doc/rdoc/files/lib/phusion_passenger/classic_rails/request_handler_rb.html +125 -0
  142. data/doc/rdoc/files/lib/phusion_passenger/classic_rails_extensions/init_rb.html +132 -0
  143. data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +126 -0
  144. data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +122 -0
  145. data/doc/rdoc/files/lib/phusion_passenger/debug_logging_rb.html +122 -0
  146. data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +147 -0
  147. data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +122 -0
  148. data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +127 -0
  149. data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +120 -0
  150. data/doc/rdoc/files/lib/phusion_passenger/message_client_rb.html +127 -0
  151. data/doc/rdoc/files/lib/phusion_passenger/native_support_rb.html +132 -0
  152. data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
  153. data/doc/rdoc/files/lib/phusion_passenger/platform_info/apache_rb.html +127 -0
  154. data/doc/rdoc/files/lib/phusion_passenger/platform_info/binary_compatibility_rb.html +129 -0
  155. data/doc/rdoc/files/lib/phusion_passenger/platform_info/compiler_rb.html +127 -0
  156. data/doc/rdoc/files/lib/phusion_passenger/platform_info/curl_rb.html +126 -0
  157. data/doc/rdoc/files/lib/phusion_passenger/platform_info/documentation_tools_rb.html +126 -0
  158. data/doc/rdoc/files/lib/phusion_passenger/platform_info/linux_rb.html +126 -0
  159. data/doc/rdoc/files/lib/phusion_passenger/platform_info/operating_system_rb.html +127 -0
  160. data/doc/rdoc/files/lib/phusion_passenger/platform_info/ruby_rb.html +128 -0
  161. data/doc/rdoc/files/lib/phusion_passenger/platform_info/zlib_rb.html +126 -0
  162. data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +122 -0
  163. data/doc/rdoc/files/lib/phusion_passenger/plugin_rb.html +127 -0
  164. data/doc/rdoc/files/lib/phusion_passenger/public_api_rb.html +127 -0
  165. data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +137 -0
  166. data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +125 -0
  167. data/doc/rdoc/files/lib/phusion_passenger/rails3_extensions/init_rb.html +127 -0
  168. data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +122 -0
  169. data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +160 -0
  170. data/doc/rdoc/files/lib/phusion_passenger/standalone/app_finder_rb.html +127 -0
  171. data/doc/rdoc/files/lib/phusion_passenger/standalone/command_rb.html +136 -0
  172. data/doc/rdoc/files/lib/phusion_passenger/standalone/config_file_rb.html +126 -0
  173. data/doc/rdoc/files/lib/phusion_passenger/standalone/help_command_rb.html +126 -0
  174. data/doc/rdoc/files/lib/phusion_passenger/standalone/main_rb.html +126 -0
  175. data/doc/rdoc/files/lib/phusion_passenger/standalone/package_runtime_command_rb.html +127 -0
  176. data/doc/rdoc/files/lib/phusion_passenger/standalone/runtime_installer_rb.html +133 -0
  177. data/doc/rdoc/files/lib/phusion_passenger/standalone/start_command_rb.html +136 -0
  178. data/doc/rdoc/files/lib/phusion_passenger/standalone/status_command_rb.html +126 -0
  179. data/doc/rdoc/files/lib/phusion_passenger/standalone/stop_command_rb.html +126 -0
  180. data/doc/rdoc/files/lib/phusion_passenger/standalone/utils_rb.html +126 -0
  181. data/doc/rdoc/files/lib/phusion_passenger/standalone/version_command_rb.html +127 -0
  182. data/doc/rdoc/files/lib/phusion_passenger/utils/file_system_watcher_rb.html +126 -0
  183. data/doc/rdoc/files/lib/phusion_passenger/utils/hosts_file_parser_rb.html +120 -0
  184. data/doc/rdoc/files/lib/phusion_passenger/utils/rewindable_input_rb.html +100 -0
  185. data/doc/rdoc/files/lib/phusion_passenger/utils/tmpdir_rb.html +122 -0
  186. data/doc/rdoc/files/lib/phusion_passenger/utils/unseekable_socket_rb.html +126 -0
  187. data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +179 -0
  188. data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +132 -0
  189. data/doc/rdoc/fr_class_index.html +139 -0
  190. data/doc/rdoc/fr_file_index.html +108 -0
  191. data/doc/rdoc/fr_method_index.html +439 -0
  192. data/doc/rdoc/index.html +26 -0
  193. data/doc/rdoc/rdoc-style.css +187 -0
  194. data/ext/apache2/Configuration.cpp +41 -0
  195. data/ext/apache2/Configuration.hpp +19 -0
  196. data/ext/apache2/Hooks.cpp +67 -5
  197. data/ext/common/Constants.h +1 -1
  198. data/ext/common/Exceptions.h +14 -0
  199. data/ext/common/Logging.h +76 -6
  200. data/ext/common/LoggingAgent/FilterSupport.h +1317 -0
  201. data/ext/common/LoggingAgent/LoggingServer.h +93 -4
  202. data/ext/common/LoggingAgent/RemoteSender.h +5 -5
  203. data/ext/common/Utils/StrIntUtils.cpp +12 -1
  204. data/ext/common/Utils/StrIntUtils.h +2 -1
  205. data/ext/common/Utils/StringMap.h +100 -0
  206. data/ext/nginx/Configuration.c +0 -1
  207. data/ext/nginx/ContentHandler.c +33 -7
  208. data/lib/phusion_passenger.rb +2 -2
  209. data/lib/phusion_passenger/abstract_request_handler.rb +5 -0
  210. data/lib/phusion_passenger/analytics_logger.rb +77 -11
  211. data/lib/phusion_passenger/dependencies.rb +11 -1
  212. data/lib/phusion_passenger/platform_info.rb +1 -1
  213. data/lib/phusion_passenger/utils.rb +9 -1
  214. data/test/cxx/FilterSupportTest.cpp +276 -0
  215. data/test/cxx/LoggingTest.cpp +28 -0
  216. data/test/cxx/StringMapTest.cpp +70 -0
  217. data/test/integration_tests/cgi_environment_spec.rb +10 -0
  218. metadata +170 -8
  219. data/ext/common/libboost_oxt/aggregate.cpp +0 -10
  220. data/ext/common/libpassenger_common/aggregate.cpp +0 -15
@@ -0,0 +1,142 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <title>Module: PhusionPassenger::AdminTools</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
10
+
11
+ <script language="JavaScript" type="text/javascript">
12
+ // <![CDATA[
13
+
14
+ function toggleSource( id )
15
+ {
16
+ var elem
17
+ var link
18
+
19
+ if( document.getElementById )
20
+ {
21
+ elem = document.getElementById( id )
22
+ link = document.getElementById( "l_" + id )
23
+ }
24
+ else if ( document.all )
25
+ {
26
+ elem = eval( "document.all." + id )
27
+ link = eval( "document.all.l_" + id )
28
+ }
29
+ else
30
+ return false;
31
+
32
+ if( elem.style.display == "block" )
33
+ {
34
+ elem.style.display = "none"
35
+ link.innerHTML = "show source"
36
+ }
37
+ else
38
+ {
39
+ elem.style.display = "block"
40
+ link.innerHTML = "hide source"
41
+ }
42
+ }
43
+
44
+ function openCode( url )
45
+ {
46
+ window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
47
+ }
48
+ // ]]>
49
+ </script>
50
+ </head>
51
+
52
+ <body>
53
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
+ <td class="file-title"><span class="file-title-prefix">Module</span><br />PhusionPassenger::AdminTools</td>
55
+ <td align="right">
56
+ <table cellspacing="0" cellpadding="2">
57
+ <tr valign="top">
58
+ <td>In:</td>
59
+ <td>
60
+ <a href="../../files/lib/phusion_passenger/admin_tools_rb.html">lib/phusion_passenger/admin_tools.rb</a>
61
+ <a href="../../files/lib/phusion_passenger/admin_tools/memory_stats_rb.html">lib/phusion_passenger/admin_tools/memory_stats.rb</a>
62
+ <a href="../../files/lib/phusion_passenger/admin_tools/server_instance_rb.html">lib/phusion_passenger/admin_tools/server_instance.rb</a>
63
+ </td>
64
+ </tr>
65
+ </table>
66
+ </td>
67
+ </tr>
68
+ </table>
69
+ <!-- banner header -->
70
+
71
+ <div id="bodyContent">
72
+ <div id="content">
73
+
74
+
75
+
76
+
77
+ <div class="sectiontitle">Methods</div>
78
+ <ul>
79
+ <li><a href="#M000139">process_is_alive?</a></li>
80
+ <li><a href="#M000138">tmpdir</a></li>
81
+ </ul>
82
+
83
+
84
+
85
+ <div class="sectiontitle">Classes and Modules</div>
86
+ Class <a href="AdminTools/MemoryStats.html" class="link">PhusionPassenger::AdminTools::MemoryStats</a><br />
87
+ Class <a href="AdminTools/ServerInstance.html" class="link">PhusionPassenger::AdminTools::ServerInstance</a><br />
88
+
89
+
90
+
91
+
92
+ <div class="sectiontitle">Public Class methods</div>
93
+ <div class="method">
94
+ <div class="title">
95
+ <a name="M000139"></a><b>process_is_alive?</b>(pid)
96
+ </div>
97
+ <div class="sourcecode">
98
+ <p class="source-link">[ <a href="javascript:toggleSource('M000139_source')" id="l_M000139_source">show source</a> ]</p>
99
+ <div id="M000139_source" class="dyn-source">
100
+ <pre>
101
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools.rb, line 36</span>
102
+ 36: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">process_is_alive?</span>(<span class="ruby-identifier">pid</span>)
103
+ 37: <span class="ruby-keyword kw">begin</span>
104
+ 38: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">kill</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">pid</span>)
105
+ 39: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
106
+ 40: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ESRCH</span>
107
+ 41: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
108
+ 42: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemCallError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
109
+ 43: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
110
+ 44: <span class="ruby-keyword kw">end</span>
111
+ 45: <span class="ruby-keyword kw">end</span>
112
+ </pre>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ <div class="method">
117
+ <div class="title">
118
+ <a name="M000138"></a><b>tmpdir</b>()
119
+ </div>
120
+ <div class="sourcecode">
121
+ <p class="source-link">[ <a href="javascript:toggleSource('M000138_source')" id="l_M000138_source">show source</a> ]</p>
122
+ <div id="M000138_source" class="dyn-source">
123
+ <pre>
124
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools.rb, line 27</span>
125
+ 27: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tmpdir</span>
126
+ 28: [<span class="ruby-value str">&quot;PASSENGER_TEMP_DIR&quot;</span>, <span class="ruby-value str">&quot;PASSENGER_TMPDIR&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
127
+ 29: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-constant">ENV</span>[<span class="ruby-identifier">name</span>].<span class="ruby-identifier">empty?</span>
128
+ 30: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ENV</span>[<span class="ruby-identifier">name</span>]
129
+ 31: <span class="ruby-keyword kw">end</span>
130
+ 32: <span class="ruby-keyword kw">end</span>
131
+ 33: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;/tmp&quot;</span>
132
+ 34: <span class="ruby-keyword kw">end</span>
133
+ </pre>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ </div>
138
+
139
+ </div>
140
+
141
+ </body>
142
+ </html>
@@ -0,0 +1,368 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <title>Class: PhusionPassenger::AdminTools::MemoryStats</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
10
+
11
+ <script language="JavaScript" type="text/javascript">
12
+ // <![CDATA[
13
+
14
+ function toggleSource( id )
15
+ {
16
+ var elem
17
+ var link
18
+
19
+ if( document.getElementById )
20
+ {
21
+ elem = document.getElementById( id )
22
+ link = document.getElementById( "l_" + id )
23
+ }
24
+ else if ( document.all )
25
+ {
26
+ elem = eval( "document.all." + id )
27
+ link = eval( "document.all.l_" + id )
28
+ }
29
+ else
30
+ return false;
31
+
32
+ if( elem.style.display == "block" )
33
+ {
34
+ elem.style.display = "none"
35
+ link.innerHTML = "show source"
36
+ }
37
+ else
38
+ {
39
+ elem.style.display = "block"
40
+ link.innerHTML = "hide source"
41
+ }
42
+ }
43
+
44
+ function openCode( url )
45
+ {
46
+ window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
47
+ }
48
+ // ]]>
49
+ </script>
50
+ </head>
51
+
52
+ <body>
53
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
+ <td class="file-title"><span class="file-title-prefix">Class</span><br />PhusionPassenger::AdminTools::MemoryStats</td>
55
+ <td align="right">
56
+ <table cellspacing="0" cellpadding="2">
57
+ <tr valign="top">
58
+ <td>In:</td>
59
+ <td>
60
+ <a href="../../../files/lib/phusion_passenger/admin_tools/memory_stats_rb.html">lib/phusion_passenger/admin_tools/memory_stats.rb</a>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td>Parent:</td>
65
+ <td>
66
+ Object
67
+ </td>
68
+ </tr>
69
+ </table>
70
+ </td>
71
+ </tr>
72
+ </table>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+ <div id="content">
77
+
78
+
79
+
80
+
81
+ <div class="sectiontitle">Methods</div>
82
+ <ul>
83
+ <li><a href="#M000159">apache_processes</a></li>
84
+ <li><a href="#M000160">nginx_processes</a></li>
85
+ <li><a href="#M000161">passenger_processes</a></li>
86
+ <li><a href="#M000163">platform_provides_private_dirty_rss_information?</a></li>
87
+ <li><a href="#M000164">root_privileges_required_for_private_dirty_rss?</a></li>
88
+ <li><a href="#M000165">should_show_private_dirty_rss?</a></li>
89
+ <li><a href="#M000162">sum_memory_usage</a></li>
90
+ <li><a href="#M000166">system_ram_usage</a></li>
91
+ </ul>
92
+
93
+
94
+
95
+ <div class="sectiontitle">Classes and Modules</div>
96
+ Class <a href="MemoryStats/Process.html" class="link">PhusionPassenger::AdminTools::MemoryStats::Process</a><br />
97
+
98
+
99
+
100
+
101
+ <div class="sectiontitle">Public Instance methods</div>
102
+ <div class="method">
103
+ <div class="title">
104
+ <a name="M000159"></a><b>apache_processes</b>()
105
+ </div>
106
+ <div class="description">
107
+ <p>
108
+ Returns a list of Apache processes, which may be the empty list if Apache
109
+ is not running. If the Apache executable name is unknown then nil will be
110
+ returned.
111
+ </p>
112
+ </div>
113
+ <div class="sourcecode">
114
+ <p class="source-link">[ <a href="javascript:toggleSource('M000159_source')" id="l_M000159_source">show source</a> ]</p>
115
+ <div id="M000159_source" class="dyn-source">
116
+ <pre>
117
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools/memory_stats.rb, line 64</span>
118
+ 64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apache_processes</span>
119
+ 65: <span class="ruby-ivar">@apache_processes</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">begin</span>
120
+ 66: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">PlatformInfo</span>.<span class="ruby-identifier">httpd</span>
121
+ 67: <span class="ruby-identifier">processes</span> = <span class="ruby-identifier">list_processes</span>(<span class="ruby-identifier">:exe</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">PlatformInfo</span>.<span class="ruby-identifier">httpd</span>)
122
+ 68: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">processes</span>.<span class="ruby-identifier">empty?</span>
123
+ 69: <span class="ruby-comment cmt"># On some Linux distros, the Apache worker processes</span>
124
+ 70: <span class="ruby-comment cmt"># are called &quot;httpd.worker&quot;</span>
125
+ 71: <span class="ruby-identifier">processes</span> = <span class="ruby-identifier">list_processes</span>(<span class="ruby-identifier">:exe</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{PlatformInfo.httpd}.worker&quot;</span>)
126
+ 72: <span class="ruby-keyword kw">end</span>
127
+ 73: <span class="ruby-identifier">processes</span>
128
+ 74: <span class="ruby-keyword kw">else</span>
129
+ 75: <span class="ruby-keyword kw">nil</span>
130
+ 76: <span class="ruby-keyword kw">end</span>
131
+ 77: <span class="ruby-keyword kw">end</span>
132
+ 78: <span class="ruby-keyword kw">end</span>
133
+ </pre>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ <div class="method">
138
+ <div class="title">
139
+ <a name="M000160"></a><b>nginx_processes</b>()
140
+ </div>
141
+ <div class="description">
142
+ <p>
143
+ Returns a list of Nginx processes, which may be the empty list if Nginx is
144
+ not running.
145
+ </p>
146
+ </div>
147
+ <div class="sourcecode">
148
+ <p class="source-link">[ <a href="javascript:toggleSource('M000160_source')" id="l_M000160_source">show source</a> ]</p>
149
+ <div id="M000160_source" class="dyn-source">
150
+ <pre>
151
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools/memory_stats.rb, line 82</span>
152
+ 82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nginx_processes</span>
153
+ 83: <span class="ruby-ivar">@nginx_processes</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">list_processes</span>(<span class="ruby-identifier">:exe</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;nginx&quot;</span>)
154
+ 84: <span class="ruby-keyword kw">end</span>
155
+ </pre>
156
+ </div>
157
+ </div>
158
+ </div>
159
+ <div class="method">
160
+ <div class="title">
161
+ <a name="M000161"></a><b>passenger_processes</b>()
162
+ </div>
163
+ <div class="description">
164
+ <p>
165
+ Returns a list of Phusion Passenger processes, which may be the empty list
166
+ if Phusion Passenger is not running.
167
+ </p>
168
+ </div>
169
+ <div class="sourcecode">
170
+ <p class="source-link">[ <a href="javascript:toggleSource('M000161_source')" id="l_M000161_source">show source</a> ]</p>
171
+ <div id="M000161_source" class="dyn-source">
172
+ <pre>
173
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools/memory_stats.rb, line 88</span>
174
+ 88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">passenger_processes</span>
175
+ 89: <span class="ruby-ivar">@passenger_processes</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">list_processes</span>(<span class="ruby-identifier">:match</span> =<span class="ruby-operator">&gt;</span>
176
+ 90: <span class="ruby-regexp re">/((^| )Passenger |(^| )Rails:|(^| )Rack:|PassengerHelperAgent|PassengerWatchdog|PassengerLoggingAgent)/</span>)
177
+ 91: <span class="ruby-keyword kw">end</span>
178
+ </pre>
179
+ </div>
180
+ </div>
181
+ </div>
182
+ <div class="method">
183
+ <div class="title">
184
+ <a name="M000163"></a><b>platform_provides_private_dirty_rss_information?</b>()
185
+ </div>
186
+ <div class="sourcecode">
187
+ <p class="source-link">[ <a href="javascript:toggleSource('M000163_source')" id="l_M000163_source">show source</a> ]</p>
188
+ <div id="M000163_source" class="dyn-source">
189
+ <pre>
190
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools/memory_stats.rb, line 117</span>
191
+ 117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">platform_provides_private_dirty_rss_information?</span>
192
+ 118: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ruby_platform</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/linux/</span>
193
+ 119: <span class="ruby-keyword kw">end</span>
194
+ </pre>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ <div class="method">
199
+ <div class="title">
200
+ <a name="M000164"></a><b>root_privileges_required_for_private_dirty_rss?</b>()
201
+ </div>
202
+ <div class="description">
203
+ <p>
204
+ Returns whether root privileges are required in order to measure private
205
+ dirty RSS. Only meaningful if
206
+ #platform_provides_private_dirty_rss_information? returns true.
207
+ </p>
208
+ </div>
209
+ <div class="sourcecode">
210
+ <p class="source-link">[ <a href="javascript:toggleSource('M000164_source')" id="l_M000164_source">show source</a> ]</p>
211
+ <div id="M000164_source" class="dyn-source">
212
+ <pre>
213
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools/memory_stats.rb, line 123</span>
214
+ 123: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">root_privileges_required_for_private_dirty_rss?</span>
215
+ 124: <span class="ruby-identifier">all_processes</span> = (<span class="ruby-identifier">apache_processes</span> <span class="ruby-operator">||</span> []) <span class="ruby-operator">+</span> <span class="ruby-identifier">nginx_processes</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">passenger_processes</span>
216
+ 125: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">all_processes</span>.<span class="ruby-identifier">any?</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">private_dirty_rss</span>.<span class="ruby-identifier">nil?</span> }
217
+ 126: <span class="ruby-keyword kw">end</span>
218
+ </pre>
219
+ </div>
220
+ </div>
221
+ </div>
222
+ <div class="method">
223
+ <div class="title">
224
+ <a name="M000165"></a><b>should_show_private_dirty_rss?</b>()
225
+ </div>
226
+ <div class="sourcecode">
227
+ <p class="source-link">[ <a href="javascript:toggleSource('M000165_source')" id="l_M000165_source">show source</a> ]</p>
228
+ <div id="M000165_source" class="dyn-source">
229
+ <pre>
230
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools/memory_stats.rb, line 128</span>
231
+ 128: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">should_show_private_dirty_rss?</span>
232
+ 129: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">platform_provides_private_dirty_rss_information?</span> <span class="ruby-operator">&amp;&amp;</span>
233
+ 130: (<span class="ruby-operator">::</span><span class="ruby-constant">Process</span>.<span class="ruby-identifier">euid</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">root_privileges_required_for_private_dirty_rss?</span>)
234
+ 131: <span class="ruby-keyword kw">end</span>
235
+ </pre>
236
+ </div>
237
+ </div>
238
+ </div>
239
+ <div class="method">
240
+ <div class="title">
241
+ <a name="M000162"></a><b>sum_memory_usage</b>(processes)
242
+ </div>
243
+ <div class="description">
244
+ <p>
245
+ Returns the sum of the memory usages of all given processes. Returns a pair
246
+ [usage, accurate]. <tt>usage</tt> is the summed memory usage in KB, and
247
+ <tt>accurate</tt> indicates whether this sum is accurate. This may be false
248
+ if some process&#8216;s memory usage cannot be determined.
249
+ </p>
250
+ </div>
251
+ <div class="sourcecode">
252
+ <p class="source-link">[ <a href="javascript:toggleSource('M000162_source')" id="l_M000162_source">show source</a> ]</p>
253
+ <div id="M000162_source" class="dyn-source">
254
+ <pre>
255
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools/memory_stats.rb, line 97</span>
256
+ 97: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum_memory_usage</span>(<span class="ruby-identifier">processes</span>)
257
+ 98: <span class="ruby-identifier">total</span> = <span class="ruby-value">0</span>
258
+ 99: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">should_show_private_dirty_rss?</span>
259
+ 100: <span class="ruby-identifier">accurate</span> = <span class="ruby-keyword kw">true</span>
260
+ 101: <span class="ruby-identifier">processes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
261
+ 102: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">private_dirty_rss</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
262
+ 103: <span class="ruby-identifier">total</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">private_dirty_rss</span>
263
+ 104: <span class="ruby-keyword kw">else</span>
264
+ 105: <span class="ruby-identifier">accurate</span> = <span class="ruby-keyword kw">true</span>
265
+ 106: <span class="ruby-keyword kw">end</span>
266
+ 107: <span class="ruby-keyword kw">end</span>
267
+ 108: <span class="ruby-keyword kw">return</span> [<span class="ruby-identifier">total</span>, <span class="ruby-identifier">accurate</span>]
268
+ 109: <span class="ruby-keyword kw">else</span>
269
+ 110: <span class="ruby-identifier">processes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
270
+ 111: <span class="ruby-identifier">total</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">rss</span>
271
+ 112: <span class="ruby-keyword kw">end</span>
272
+ 113: <span class="ruby-keyword kw">return</span> [<span class="ruby-identifier">total</span>, <span class="ruby-keyword kw">true</span>]
273
+ 114: <span class="ruby-keyword kw">end</span>
274
+ 115: <span class="ruby-keyword kw">end</span>
275
+ </pre>
276
+ </div>
277
+ </div>
278
+ </div>
279
+ <div class="method">
280
+ <div class="title">
281
+ <a name="M000166"></a><b>system_ram_usage</b>()
282
+ </div>
283
+ <div class="description">
284
+ <p>
285
+ Determine the system&#8216;s RAM usage, not including swap. Returns a tuple
286
+ [total, used] where both numbers are in KB, or nil if the system&#8216;s
287
+ RAM usage cannot be determined.
288
+ </p>
289
+ </div>
290
+ <div class="sourcecode">
291
+ <p class="source-link">[ <a href="javascript:toggleSource('M000166_source')" id="l_M000166_source">show source</a> ]</p>
292
+ <div id="M000166_source" class="dyn-source">
293
+ <pre>
294
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/admin_tools/memory_stats.rb, line 136</span>
295
+ 136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">system_ram_usage</span>
296
+ 137: <span class="ruby-ivar">@total_system_ram</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">begin</span>
297
+ 138: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">ruby_platform</span>
298
+ 139: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/linux/</span>
299
+ 140: <span class="ruby-identifier">free_text</span> = <span class="ruby-value">`free -k`</span>
300
+ 141:
301
+ 142: <span class="ruby-identifier">free_text</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r{Mem:(.+)$}</span>
302
+ 143: <span class="ruby-identifier">line</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">strip</span>
303
+ 144: <span class="ruby-identifier">total</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/ +/</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_i</span>
304
+ 145:
305
+ 146: <span class="ruby-identifier">free_text</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r{buffers/cache:(.+)$}</span>
306
+ 147: <span class="ruby-identifier">line</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">strip</span>
307
+ 148: <span class="ruby-identifier">used</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/ +/</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_i</span>
308
+ 149:
309
+ 150: [<span class="ruby-identifier">total</span>, <span class="ruby-identifier">used</span>]
310
+ 151: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/darwin/</span>
311
+ 152: <span class="ruby-identifier">vm_stat</span> = <span class="ruby-value">`vm_stat`</span>
312
+ 153: <span class="ruby-identifier">vm_stat</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/page size of (\d+) bytes/</span>
313
+ 154: <span class="ruby-identifier">page_size</span> = <span class="ruby-identifier">$1</span>
314
+ 155: <span class="ruby-identifier">vm_stat</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/Pages free: +(\d+)/</span>
315
+ 156: <span class="ruby-identifier">free</span> = <span class="ruby-identifier">$1</span>
316
+ 157: <span class="ruby-identifier">vm_stat</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/Pages active: +(\d+)/</span>
317
+ 158: <span class="ruby-identifier">active</span> = <span class="ruby-identifier">$1</span>
318
+ 159: <span class="ruby-identifier">vm_stat</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/Pages inactive: +(\d+)/</span>
319
+ 160: <span class="ruby-identifier">inactive</span> = <span class="ruby-identifier">$1</span>
320
+ 161: <span class="ruby-identifier">vm_stat</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/Pages wired down: +(\d+)/</span>
321
+ 162: <span class="ruby-identifier">wired</span> = <span class="ruby-identifier">$1</span>
322
+ 163:
323
+ 164: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">page_size</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">free</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">active</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">inactive</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">wired</span>
324
+ 165: <span class="ruby-identifier">page_size</span> = <span class="ruby-identifier">page_size</span>.<span class="ruby-identifier">to_i</span>
325
+ 166: <span class="ruby-identifier">free</span> = <span class="ruby-identifier">free</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">page_size</span> <span class="ruby-operator">/</span> <span class="ruby-value">1024</span>
326
+ 167: <span class="ruby-identifier">active</span> = <span class="ruby-identifier">active</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">page_size</span> <span class="ruby-operator">/</span> <span class="ruby-value">1024</span>
327
+ 168: <span class="ruby-identifier">inactive</span> = <span class="ruby-identifier">inactive</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">page_size</span> <span class="ruby-operator">/</span> <span class="ruby-value">1024</span>
328
+ 169: <span class="ruby-identifier">wired</span> = <span class="ruby-identifier">wired</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">page_size</span> <span class="ruby-operator">/</span> <span class="ruby-value">1024</span>
329
+ 170:
330
+ 171: <span class="ruby-identifier">used</span> = <span class="ruby-identifier">active</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">wired</span>
331
+ 172: [<span class="ruby-identifier">free</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">inactive</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">used</span>, <span class="ruby-identifier">used</span>]
332
+ 173: <span class="ruby-keyword kw">else</span>
333
+ 174: <span class="ruby-keyword kw">nil</span>
334
+ 175: <span class="ruby-keyword kw">end</span>
335
+ 176: <span class="ruby-keyword kw">else</span>
336
+ 177: <span class="ruby-value">`top`</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(\d+)(K|M) Active, (\d+)(K|M) Inact, (\d+)(K|M) Wired,.*?(\d+)(K|M) Free/</span>
337
+ 178: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">$2</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">$3</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">$4</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">$5</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">$6</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">$7</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">$8</span>
338
+ 179: <span class="ruby-identifier">to_kb</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">number</span>, <span class="ruby-identifier">unit</span><span class="ruby-operator">|</span>
339
+ 180: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">unit</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'K'</span>
340
+ 181: <span class="ruby-identifier">number</span>.<span class="ruby-identifier">to_i</span>
341
+ 182: <span class="ruby-keyword kw">else</span>
342
+ 183: <span class="ruby-identifier">number</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">*</span> <span class="ruby-value">1024</span>
343
+ 184: <span class="ruby-keyword kw">end</span>
344
+ 185: <span class="ruby-keyword kw">end</span>
345
+ 186:
346
+ 187: <span class="ruby-identifier">active</span> = <span class="ruby-identifier">to_kb</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">$1</span>, <span class="ruby-identifier">$2</span>)
347
+ 188: <span class="ruby-identifier">inactive</span> = <span class="ruby-identifier">to_kb</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">$3</span>, <span class="ruby-identifier">$4</span>)
348
+ 189: <span class="ruby-identifier">wired</span> = <span class="ruby-identifier">to_kb</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">$5</span>, <span class="ruby-identifier">$6</span>)
349
+ 190: <span class="ruby-identifier">free</span> = <span class="ruby-identifier">to_kb</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">$7</span>, <span class="ruby-identifier">$8</span>)
350
+ 191:
351
+ 192: <span class="ruby-identifier">used</span> = <span class="ruby-identifier">active</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">wired</span>
352
+ 193: [<span class="ruby-identifier">free</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">inactive</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">used</span>, <span class="ruby-identifier">used</span>]
353
+ 194: <span class="ruby-keyword kw">else</span>
354
+ 195: <span class="ruby-keyword kw">nil</span>
355
+ 196: <span class="ruby-keyword kw">end</span>
356
+ 197: <span class="ruby-keyword kw">end</span>
357
+ 198: <span class="ruby-keyword kw">end</span>
358
+ 199: <span class="ruby-keyword kw">end</span>
359
+ </pre>
360
+ </div>
361
+ </div>
362
+ </div>
363
+ </div>
364
+
365
+ </div>
366
+
367
+ </body>
368
+ </html>