rubyrun 0.9.6 → 0.9.7

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 (42) hide show
  1. data/bin/Rakefile +84 -5
  2. data/bin/rubyrun_native_test__.rb +1 -0
  3. data/doc/README +26 -0
  4. data/{docs/rubyrun-0.9.6.htm → doc/rubyrun-0.9.7.htm} +743 -686
  5. data/{docs/rubyrun-0.9.6.pdf → doc/rubyrun-0.9.7.pdf} +0 -0
  6. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/colorschememapping.xml +0 -0
  7. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/filelist.xml +1 -1
  8. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/header.htm +7 -8
  9. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image001.jpg +0 -0
  10. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image002.jpg +0 -0
  11. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image003.jpg +0 -0
  12. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image004.jpg +0 -0
  13. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image005.jpg +0 -0
  14. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image006.jpg +0 -0
  15. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image007.jpg +0 -0
  16. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image008.jpg +0 -0
  17. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image009.jpg +0 -0
  18. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image010.jpg +0 -0
  19. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image011.jpg +0 -0
  20. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image012.jpg +0 -0
  21. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image013.jpg +0 -0
  22. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image014.jpg +0 -0
  23. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image015.jpg +0 -0
  24. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image016.jpg +0 -0
  25. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image017.png +0 -0
  26. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image018.jpg +0 -0
  27. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image019.jpg +0 -0
  28. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image020.jpg +0 -0
  29. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image021.jpg +0 -0
  30. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/image022.png +0 -0
  31. data/{docs/rubyrun-0.9.6_files → doc/rubyrun-0.9.7_files}/themedata.thmx +0 -0
  32. data/etc/rubyrun_opts.yml +2 -2
  33. data/lib/rubyrun/rubyrun_boot__.rb +6 -1
  34. data/lib/rubyrun/rubyrun_commander__.rb +8 -6
  35. data/lib/rubyrun/rubyrun_globals.rb +1 -0
  36. data/lib/rubyrun/rubyrun_initializer__.rb +14 -56
  37. data/lib/rubyrun/rubyrun_instrumentor__.rb +14 -12
  38. data/lib/rubyrun/rubyrun_monitor__.rb +1 -1
  39. data/lib/rubyrun/rubyrun_report__.rb +1 -1
  40. data/lib/rubyrun/rubyrun_rss__.rb +19 -7
  41. metadata +52 -50
  42. data/README +0 -77
@@ -1,5 +1,5 @@
1
1
  <xml xmlns:o="urn:schemas-microsoft-com:office:office">
2
- <o:MainFile HRef="../rubyrun-0.9.6.htm"/>
2
+ <o:MainFile HRef="../rubyrun-0.9.7.htm"/>
3
3
  <o:File HRef="themedata.thmx"/>
4
4
  <o:File HRef="colorschememapping.xml"/>
5
5
  <o:File HRef="image001.jpg"/>
@@ -10,7 +10,7 @@ xmlns="http://www.w3.org/TR/REC-html40">
10
10
  <meta name=ProgId content=Word.Document>
11
11
  <meta name=Generator content="Microsoft Word 12">
12
12
  <meta name=Originator content="Microsoft Word 12">
13
- <link id=Main-File rel=Main-File href="../rubyrun-0.9.6.htm">
13
+ <link id=Main-File rel=Main-File href="../rubyrun-0.9.7.htm">
14
14
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
15
15
  name="PlaceType"/>
16
16
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
@@ -105,16 +105,15 @@ style='mso-bidi-font-weight:normal'><!--[if gte vml 1]><v:shapetype id="_x0000_t
105
105
  style='font-size:10.0pt;font-family:"Arial","sans-serif"'><span
106
106
  style='mso-tab-count:1'>������������������������������������������������� </span></span>Installation
107
107
  and User Guide<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><span
108
- style='mso-tab-count:1'>��������������������������� </span></span>Page <!--[if supportFields]><span
108
+ style='mso-tab-count:1'>������������������������������� </span></span>Page <!--[if supportFields]><span
109
109
  style='mso-element:field-begin'></span><span
110
110
  style='mso-spacerun:yes'>�</span>PAGE <span style='mso-element:field-separator'></span><![endif]--><span
111
- style='mso-no-proof:yes'>32</span><!--[if supportFields]><span
112
- style='mso-element:field-end'></span><![endif]--> of <!--[if supportFields]><span
111
+ style='mso-no-proof:yes'>5</span><!--[if supportFields]><span style='mso-element:
112
+ field-end'></span><![endif]--> of <!--[if supportFields]><span
113
113
  style='mso-element:field-begin'></span><span
114
114
  style='mso-spacerun:yes'>�</span>NUMPAGES <span style='mso-element:field-separator'></span><![endif]--><span
115
- style='mso-no-proof:yes'>32</span><!--[if supportFields]><span
116
- style='mso-element:field-end'></span><![endif]--><b style='mso-bidi-font-weight:
117
- normal'><o:p></o:p></b></p>
115
+ style='mso-no-proof:yes'>5</span><!--[if supportFields]><span style='mso-element:
116
+ field-end'></span><![endif]--><b style='mso-bidi-font-weight:normal'><o:p></o:p></b></p>
118
117
 
119
118
  </div>
120
119
 
@@ -126,7 +125,7 @@ style='mso-bidi-font-weight:normal'><!--[if gte vml 1]><v:shape id="_x0000_i1040
126
125
  <v:imagedata src="image022.png" o:title="rubysophic_logo"/>
127
126
  </v:shape><![endif]--><span style='mso-tab-count:2'>������������������������������������������������������������������ </span></b><span
128
127
  style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Ruby<i
129
- style='mso-bidi-font-style:normal'>Run</i><sup>CE</sup> 0.9.6 Installation and
128
+ style='mso-bidi-font-style:normal'>Run</i><sup>CE</sup> 0.9.7 Installation and
130
129
  User Guide<o:p></o:p></span></p>
131
130
 
132
131
  <p class=MsoHeader><o:p>&nbsp;</o:p></p>
data/etc/rubyrun_opts.yml CHANGED
@@ -82,7 +82,7 @@ DB_ADAPTER_HASH: {ActiveRecord::ConnectionAdapters::MysqlAdapter: [execute]}
82
82
  # TRACE_HASH: {} #=> Stop tracing
83
83
  # TRACE_HASH: {Class1: [method1, method2], Class2: [method3, method4]}
84
84
  # #=> Trace only these instrumented methods
85
- TRACE_HASH: {}
85
+ TRACE_HASH: {*: []}
86
86
 
87
87
  # Only applies when TRACE_HASH is not an empty hash.
88
88
  # Use DEBUG_ARGS to inspect arguments that were passed in method calls.
@@ -123,7 +123,7 @@ REPORT_SHIFT_AGE: 60
123
123
  # Examples:
124
124
  # OUTPUT: [perf_summary]
125
125
  # OUTPUT: [perf_summary, txn_log]
126
- OUTPUT: [perf_summary, txn_log]
126
+ OUTPUT: [perf_summary]
127
127
 
128
128
  # Set the location of the RSS channel and item files
129
129
  # Leave this to blank results in [application directory]/public/rubyrun_rss being used
@@ -76,4 +76,9 @@ end
76
76
  # 2. Start the monitor timer thread
77
77
  instrument_thread_new
78
78
  start_thread_monitor
79
- puts '*** RubyRun successfully started. ***'
79
+ puts '=> [RubyRun] RubyRun successfully started.'
80
+ puts "=> [RubyRun] To find documenation, open #{__FILE__.gsub('\\','/').split('/')[0..-4].join('/') + '/' + RUBYRUN_DOC_DIR}"
81
+ puts "=> [RubyRun] To re-config, use #{$rubyrun_config_filename}"
82
+ puts "=> [RubyRun] To subscribe to Rails report, use http://#{Socket.gethostname}:[port]/rubyrun_rss/perf_summary.xml"
83
+ puts "=> [RubyRun] To view trace, open #{$rubyrun_report_folder}"
84
+ puts "=> [RubyRun] Trace is currently off. To turn on trace, use TRACE_HASH: {*: []} in #{$rubyrun_config_filename}." if $rubyrun_trace_hash.empty?
@@ -19,7 +19,7 @@ module RubyRunCommander__
19
19
  # display the last line # and function of the threads
20
20
  def dump_thread_status
21
21
  (unsupport_function; return) unless $rubyrun_native
22
- $rubyrun_thread_status_reporter = RubyRunHTMLWriter.new($rubyrun_report_folder + '/' + File.basename($0, ".*") + '_' + $rubyrun_startup_id + '_thread_status.html', nil, shift_age = 10, shift_size = 4096000) unless $rubyrun_thread_status_reporter
22
+ $rubyrun_thread_status_reporter = RubyRunHTMLWriter.new($rubyrun_report_folder + '/' + $rubyrun_file_basename + '_' + $rubyrun_startup_id + '_thread_status.html', nil, shift_age = 10, shift_size = 4096000) unless $rubyrun_thread_status_reporter
23
23
  start_time = Time.now
24
24
  th_data_hash = RubyRunNative__.get_all_top_stacks
25
25
  odd_row ||= true
@@ -51,10 +51,12 @@ module RubyRunCommander__
51
51
  }
52
52
  @rubyrun_req_count ||= 0
53
53
  @rubyrun_req_count += buffer.length
54
- if $rubyrun_config['OUTPUT'].include?(RUBYRUN_OUTPUT_PERF_SUMMARY) && dump_all_reports
54
+ if $rubyrun_config['OUTPUT'].include?(RUBYRUN_OUTPUT_PERF_SUMMARY)
55
55
  create_rss_channels if (!$rubyrun_perf_summary_rss && $rubyrun_rails_env)
56
- add_perf_summary_rss_item(@rubyrun_req_count)
57
- @rubyrun_req_count = 0
56
+ if dump_all_reports
57
+ add_perf_summary_rss_item(@rubyrun_req_count)
58
+ @rubyrun_req_count = 0
59
+ end
58
60
  end
59
61
  if $rubyrun_config['OUTPUT'].include?(RUBYRUN_OUTPUT_TXN_LOG)
60
62
  create_csv_files unless $rubyrun_txn_log_reporter
@@ -72,7 +74,7 @@ module RubyRunCommander__
72
74
  def kill_threads(monitor_thr)
73
75
  (unsupport_function; return) unless $rubyrun_native
74
76
  if !$rubyrun_thread_dump_reporter
75
- $rubyrun_thread_dump_reporter = Logger.new($rubyrun_report_folder + '/' + File.basename($0, ".*") + '_' + $rubyrun_startup_id + '_thread_dump.txt', shift_age = 10, shift_size = 4096000)
77
+ $rubyrun_thread_dump_reporter = Logger.new($rubyrun_report_folder + '/' + $rubyrun_file_basename + '_' + $rubyrun_startup_id + '_thread_dump.txt', shift_age = 10, shift_size = 4096000)
76
78
  $rubyrun_thread_dump_reporter.level = Logger::INFO
77
79
  class << $rubyrun_thread_dump_reporter
78
80
  include RubyRunUtils__
@@ -102,7 +104,7 @@ module RubyRunCommander__
102
104
  # The snapshot is taken after a gc call is made
103
105
  def dump_object_map
104
106
  start_time = Time.now
105
- $rubyrun_obj_map_reporter = RubyRunHTMLWriter.new($rubyrun_report_folder + '/' + File.basename($0, ".*") + '_' + $rubyrun_startup_id + '_object_map.html', nil, shift_age = 10, shift_size = 4096000) unless $rubyrun_obj_map_reporter
107
+ $rubyrun_obj_map_reporter = RubyRunHTMLWriter.new($rubyrun_report_folder + '/' + $rubyrun_file_basename + '_' + $rubyrun_startup_id + '_object_map.html', nil, shift_age = 10, shift_size = 4096000) unless $rubyrun_obj_map_reporter
106
108
  object_map = Hash.new
107
109
  ttl_object = 0
108
110
  ObjectSpace.garbage_collect
@@ -22,6 +22,7 @@ module RubyRunGlobals
22
22
  "*" => ['method_added', 'initialize', 'singleton_method_added', 'send', 'caller']}
23
23
  RUBYRUN_WORKING_DIR_NAME = 'rubyrun'
24
24
  RUBYRUN_ETC_DIR = 'etc'
25
+ RUBYRUN_DOC_DIR = 'doc'
25
26
  RUBYRUN_LOG = '/log'
26
27
  RUBYRUN_REPORT = '/report'
27
28
  RUBYRUN_SIGNATURE = '/signatures'
@@ -20,6 +20,7 @@
20
20
  module RubyRunInitializer__
21
21
 
22
22
  require 'logger'
23
+ require 'socket'
23
24
  require 'yaml'
24
25
  require 'digest/md5'
25
26
  require 'ftools'
@@ -31,7 +32,6 @@ module RubyRunInitializer__
31
32
 
32
33
  # 1. Get all directories, logs and properties set up correctly
33
34
  # 2. Scan files in APP_PATHS to create an initial INCLUDE_HASH
34
- # and an EXCLUDE_HASH
35
35
  def init_rubyrun
36
36
  ready_rubyrun_env
37
37
  discover_targets
@@ -55,18 +55,14 @@ module RubyRunInitializer__
55
55
  *rubyrun_folders = $rubyrun_working_dir + RUBYRUN_LOG, $rubyrun_working_dir + RUBYRUN_REPORT, $rubyrun_working_dir + RUBYRUN_SIGNATURE
56
56
  make_folder(rubyrun_folders)
57
57
  $rubyrun_log_folder, $rubyrun_report_folder, $rubyrun_signature_folder = *rubyrun_folders
58
- if ARGV.include?('-p')
59
- $rubyrun_startup_id_type = RUBYRUN_STARTUP_ID_TYPE_PORT
60
- $rubyrun_startup_id = ARGV[ARGV.index('-p')+1]
61
- else
62
- $rubyrun_startup_id_type = RUBYRUN_STARTUP_ID_TYPE_PROCESS
63
- $rubyrun_startup_id = $$.to_s
64
- end
58
+ $rubyrun_startup_id = ARGV.join.slice(/.*-p([\d]+).*/,1)
59
+ $rubyrun_startup_id ? $rubyrun_startup_id_type = RUBYRUN_STARTUP_ID_TYPE_PORT : ($rubyrun_startup_id = $$.to_s; $rubyrun_startup_id_type = RUBYRUN_STARTUP_ID_TYPE_PROCESS)
60
+ $rubyrun_file_basename = File.basename($0, ".*")
65
61
  ready_logfile
66
62
  system_wide_opts = $rubyrun_working_dir + RUBYRUN_OPTS_FILE
67
63
  app_wide_opts = Dir.getwd + '/' + RUBYRUN_OPTS_FILE
68
64
  File.exists?(app_wide_opts) ? load_config_props(app_wide_opts) : load_config_props(system_wide_opts)
69
- $rubyrun_tracer = RubyRunHTMLWriter.new($rubyrun_report_folder + '/' + File.basename($0, ".*") + '_' + $rubyrun_startup_id + '_trace.html', METHOD_TRACE_HEADER, shift_age = 10, shift_size = 4096000) unless $rubyrun_trace_hash.empty?
65
+ $rubyrun_tracer = RubyRunHTMLWriter.new($rubyrun_report_folder + '/' + $rubyrun_file_basename + '_' + $rubyrun_startup_id + '_trace.html', METHOD_TRACE_HEADER, shift_age = 10, shift_size = 4096000) unless $rubyrun_trace_hash.empty?
70
66
  end
71
67
 
72
68
  # Create the working directory, which will be 'rubyrun' under the current directory
@@ -109,7 +105,7 @@ module RubyRunInitializer__
109
105
 
110
106
  # Initialize rubyrun logger and create its own log format
111
107
  def ready_logfile
112
- $rubyrun_logger = Logger.new($rubyrun_log_folder + '/' + File.basename($0, ".*") + '_' + $rubyrun_startup_id + '.log', shift_age = 10, shift_size = 4096000)
108
+ $rubyrun_logger = Logger.new($rubyrun_log_folder + '/' + $rubyrun_file_basename + '_' + $rubyrun_startup_id + '.log', shift_age = 10, shift_size = 4096000)
113
109
  $rubyrun_logger.level = Logger::INFO
114
110
  class << $rubyrun_logger
115
111
  include RubyRunUtils__
@@ -137,13 +133,14 @@ module RubyRunInitializer__
137
133
  # Create new log device in case the log stream is closed.
138
134
  # This happens only in Mongrel cluster scenario
139
135
  def create_log_device
140
- Logger::LogDevice.new($rubyrun_log_folder + '/' + File.basename($0, ".*") + '_' + $rubyrun_startup_id + '.log', :shift_age => 10, :shift_size => 4096000)
136
+ Logger::LogDevice.new($rubyrun_log_folder + '/' + $rubyrun_file_basename + '_' + $rubyrun_startup_id + '.log', :shift_age => 10, :shift_size => 4096000)
141
137
  end
142
138
 
143
139
  # Property file is a yml file.
144
140
  # Load the properties into $config hash
145
141
  def load_config_props(config_file)
146
142
  begin
143
+ $rubyrun_config_filename = config_file
147
144
  $rubyrun_config = YAML.load_file(config_file)
148
145
  $rubyrun_logger.info "Properties found in #{config_file}:"
149
146
  RUBYRUN_PROP_DEFAULTS.each {|prop, def_value|
@@ -212,17 +209,16 @@ module RubyRunInitializer__
212
209
  def identify_candidates
213
210
  $rubyrun_config['APP_PATHS'].each {|element|
214
211
  element = Dir.getwd if element == '.'
212
+ print "=> [RubyRun] Preparing RubyRun for #{element}..."
215
213
  expand_folder(element)
214
+ puts "finished"
216
215
  }
217
216
  unless $rubyrun_file_date_hash.empty?
218
217
  dir_signature = generate_hash($rubyrun_file_date_hash)
219
- exclude_array = []
220
218
  if directory_changed?(dir_signature)
221
219
  $rubyrun_file_date_hash.each {|f, date|
222
- scan_module_class(f)
223
- scan_super(f).each {|name| exclude_array << name}
220
+ scan_module_class(f)
224
221
  }
225
- $rubyrun_exclude_hash['*'] = exclude_array.uniq if exclude_array.length > 0
226
222
  serialize_scan_history(dir_signature)
227
223
  end
228
224
  end
@@ -266,19 +262,16 @@ module RubyRunInitializer__
266
262
  Digest::MD5.hexdigest(hash.to_s)
267
263
  end
268
264
 
269
- # Use Marshal to serialize scan results (the include and exclude hashes)
265
+ # Use Marshal to serialize scan results (the include hash)
270
266
  def serialize_scan_history(dir_signature)
271
267
  File.open(get_include_hash_file, 'w') {|f| Marshal.dump($rubyrun_include_hash, f)}
272
- File.open(get_exclude_hash_file, 'w') {|f| Marshal.dump($rubyrun_exclude_hash, f)}
273
268
  File.open(get_dir_hash_file, 'w') {|f| Marshal.dump(dir_signature, f)}
274
269
  end
275
270
 
276
- # Use Marshal to de-serialize the include and exclude hashes
271
+ # Use Marshal to de-serialize the include hash
277
272
  def deserialize_scan_history
278
273
  f = get_include_hash_file
279
274
  $rubyrun_include_hash = File.exists?(f) ? File.open(f) {|f| Marshal.load(f)} : {}
280
- f = get_exclude_hash_file
281
- $rubyrun_exclude_hash = File.exists?(f) ? File.open(f) {|f| Marshal.load(f)} : {}
282
275
  end
283
276
 
284
277
  # Regular expression that detects the class or module names of a given file
@@ -290,46 +283,11 @@ module RubyRunInitializer__
290
283
  }
291
284
  end
292
285
 
293
- # Line up all the method names in a file by line #
294
- # Line up all the line numbers that contain the keyworkd super
295
- # Collate the two arrays to determine which method has super in it
296
- # Put these method names in EXCLUDE_HASH and skip instrumentation
297
- def scan_super(path)
298
- $rubyrun_logger.info "Method(s) to be excluded from instrumentation in #{path}:"
299
- method_name_array, method_lineno_array, super_array, exclude_array = [],[],[],[]
300
- open(path) {|f|
301
- f.readlines.each_with_index {|code, lineno|
302
- code.scan(/^\s*def\s+(.*)\(+.*\)+/m)
303
- (method_name_array << $1; method_lineno_array << lineno) if $1
304
- code.scan(/^\s*(super)/m)
305
- super_array << lineno if $1
306
- }
307
- }
308
- method_name_array.reverse!
309
- method_lineno_array.reverse!
310
- super_array.each {|lineno|
311
- method_lineno_array.each_with_index {|linenum, i|
312
- unless lineno < linenum
313
- $rubyrun_logger.info "\t #{method_name_array[i]}"
314
- m = method_name_array[i].split('.')
315
- exclude_array << (m.length > 1 ? m[1] : m[0])
316
- break
317
- end
318
- }
319
- }
320
- exclude_array
321
- end
322
-
323
286
  # Return the target file name that stores the serialized INCLUDE_HASH
324
287
  def get_include_hash_file
325
288
  $rubyrun_signature_folder + '/' + RUBYRUN_INCLUDE_HASH_FILE
326
289
  end
327
-
328
- # return the target file name that stores the serialized EXCLUDE_HASH
329
- def get_exclude_hash_file
330
- $rubyrun_signature_folder + '/' + RUBYRUN_EXCLUDE_HASH_FILE
331
- end
332
-
290
+
333
291
  # Return the target file name that stores the serialized directory contents digest
334
292
  # This file has to be application dependent, and we use the current directory of the
335
293
  # running process to represent the application directory.
@@ -139,15 +139,16 @@ module RubyRunInstrumentor__
139
139
  # 5. All these must be done in the context of the class
140
140
  def insert_code_to_instance_method(klass, mid)
141
141
  klass.class_eval {
142
- alias_method "#{RubyRunGlobals::RUBYRUN_PREFIX}_#{mid.id2name}", mid.id2name
143
- eval <<-CODE1
142
+ alias_name = "#{RubyRunGlobals::RUBYRUN_PREFIX}_#{rand.to_s.split('.')[1]}_#{mid.id2name}"
143
+ alias_method alias_name, mid.id2name
144
+ eval <<-BODY1
144
145
  def #{mid.id2name} (*args, &blk)
145
- RubyRunInstrumentor__.collect_method_data(self, #{klass}, '#{mid}', *args) {self.send("#{RubyRunGlobals::RUBYRUN_PREFIX}_#{mid.id2name}", *args, &blk)}
146
+ RubyRunInstrumentor__.collect_method_data(self, #{klass}, '#{mid}', *args) {self.send("#{alias_name}", *args, &blk)}
146
147
  end
147
- CODE1
148
- if klass.private_instance_methods(false).include?("#{RubyRunGlobals::RUBYRUN_PREFIX}_#{mid.id2name}")
148
+ BODY1
149
+ if klass.private_instance_methods(false).include?(alias_name)
149
150
  private mid
150
- elsif klass.protected_instance_methods(false).include?("#{RubyRunGlobals::RUBYRUN_PREFIX}_#{mid.id2name}")
151
+ elsif klass.protected_instance_methods(false).include?(alias_name)
151
152
  protected mid
152
153
  end
153
154
  }
@@ -156,15 +157,16 @@ module RubyRunInstrumentor__
156
157
  # Same as insert_code_to_instance_method
157
158
  def insert_code_to_singleton_method(klass, mid)
158
159
  (class << klass; self; end).class_eval {
159
- alias_method "#{RubyRunGlobals::RUBYRUN_PREFIX}_#{mid.id2name}", mid.id2name
160
- eval <<-EOF2
160
+ alias_name = "#{RubyRunGlobals::RUBYRUN_PREFIX}_#{rand.to_s.split('.')[1]}_#{mid.id2name}"
161
+ alias_method alias_name, mid.id2name
162
+ eval <<-BODY2
161
163
  def #{mid.id2name} (*args, &blk)
162
- RubyRunInstrumentor__.collect_method_data(self, #{klass}, '#{mid}', *args) {self.send("#{RubyRunGlobals::RUBYRUN_PREFIX}_#{mid.id2name}", *args, &blk)}
164
+ RubyRunInstrumentor__.collect_method_data(self, #{klass}, '#{mid}', *args) {self.send("#{alias_name}", *args, &blk)}
163
165
  end
164
- EOF2
165
- if self.private_instance_methods(false).include?("#{RubyRunGlobals::RUBYRUN_PREFIX}_#{mid.id2name}")
166
+ BODY2
167
+ if self.private_instance_methods(false).include?(alias_name)
166
168
  private mid
167
- elsif self.protected_instance_methods(false).include?("#{RubyRunGlobals::RUBYRUN_PREFIX}_#{mid.id2name}")
169
+ elsif self.protected_instance_methods(false).include?(alias_name)
168
170
  protected mid
169
171
  end
170
172
  }
@@ -84,7 +84,7 @@ module RubyRunMonitor__
84
84
  dump_object_map if object_map?
85
85
  kill_threads($rubyrun_monitor_thr) if soft_kill? || hard_kill?
86
86
  rescue Exception => e
87
- $stderr.print e.to_s + "\n" + e.backtrace.join("\n")
87
+ $rubyrun_logger.error e.to_s + "\n" + e.backtrace.join("\n")
88
88
  exit(-1)
89
89
  end
90
90
  }
@@ -103,7 +103,7 @@ module RubyRunReport__
103
103
 
104
104
  # Create the CSV files
105
105
  def create_csv_files
106
- $rubyrun_txn_log_reporter = Logger.new("#{$rubyrun_report_folder}/#{File.basename($0, ".*")}_#{$rubyrun_startup_id}_txn_log.csv", shift_age = 10, shift_size = 4096000)
106
+ $rubyrun_txn_log_reporter = Logger.new("#{$rubyrun_report_folder}/#{$rubyrun_file_basename}_#{$rubyrun_startup_id}_txn_log.csv", shift_age = 10, shift_size = 4096000)
107
107
  $rubyrun_txn_log_reporter.info "#\n# Format: [URL],[thread ID],[timestamp],[response time],[action time],[database IO time],[view time],[dispatch delay time],[uncaptured time]\n#"
108
108
  end
109
109
 
@@ -41,7 +41,6 @@ class RubyRunRSS
41
41
  @apps_name = Rails::Configuration.new.root_path.split('/').last
42
42
  @rss_xml_destination = "#{@directory}/#{@rss_filename}"
43
43
  create_channel_content unless File::exists?(@rss_xml_destination)
44
- @rss = load_rss_content
45
44
  end
46
45
 
47
46
  # Create the RSS channel
@@ -70,16 +69,29 @@ class RubyRunRSS
70
69
  item.title = sprintf(title, "#{$rubyrun_startup_id_type} #{$rubyrun_startup_id}",Time.now.strftime("%H:%M:%S"))
71
70
  item.description = sprintf(description, @apps_name, "#{$rubyrun_startup_id_type} #{$rubyrun_startup_id}", Time.now.strftime("%H:%M:%S"))
72
71
  item.link = "http://#{$rubyrun_host_with_port}/#{RUBYRUN_RSS_FOLDER}/#{filename}"
73
- sleep(rand(3))
74
- @rss = load_rss_content
75
- remove_old_item(@rss) if @rss.items.length == $rubyrun_report_shift_age
76
- @rss.items << item
72
+ acquire_lock
73
+ rss = load_rss_content
74
+ remove_old_item(rss) if rss.items.length == $rubyrun_report_shift_age
75
+ rss.items << item
77
76
  File.open(@rss_xml_destination,"w") do |f|
78
- f.write(@rss)
79
- end
77
+ f.write(rss)
78
+ end
79
+ release_lock
80
80
  end
81
81
 
82
82
  private
83
+
84
+ # Acquire a lock so that only one Ruby process can write to the RSS XML file
85
+ def acquire_lock
86
+ @lock_file = File.new(File.join(@directory,'lock'),'w')
87
+ @lock_file.flock(File::LOCK_EX)
88
+ end
89
+
90
+ # Release a lock after writing the RSS XML file content
91
+ def release_lock
92
+ @lock_file.flock(File::LOCK_UN)
93
+ @lock_file.close
94
+ end
83
95
 
84
96
  # Load the existing RSS XML file. Create a new channel if the channel is blank
85
97
  def load_rss_content
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyrun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - RubySophic Inc
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-08 00:00:00 -07:00
12
+ date: 2008-10-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -18,67 +18,67 @@ email: info@rubysophic.com
18
18
  executables: []
19
19
 
20
20
  extensions:
21
- - ext/extconf.rb
22
21
  - bin/Rakefile
23
- extra_rdoc_files: []
24
-
22
+ extra_rdoc_files:
23
+ - doc/README
25
24
  files:
26
- - README
25
+ - doc/README
27
26
  - LICENSE
28
27
  - lib/rubyrun
29
- - lib/rubyrun/rubyrun.rb
30
- - lib/rubyrun/rubyrun_boot__.rb
31
- - lib/rubyrun/rubyrun_buffer_mgr__.rb
28
+ - lib/rubyrun/rubyrun_instrumentor__.rb
29
+ - lib/rubyrun/rubyrun_tracer__.rb
30
+ - lib/rubyrun/rubyrun_initializer__.rb
31
+ - lib/rubyrun/rubyrun_rss__.rb
32
32
  - lib/rubyrun/rubyrun_commander__.rb
33
- - lib/rubyrun/rubyrun_dad__.rb
34
- - lib/rubyrun/rubyrun_globals.rb
35
33
  - lib/rubyrun/rubyrun_html_writer__.rb
36
34
  - lib/rubyrun/rubyrun_html__.rb
37
- - lib/rubyrun/rubyrun_initializer__.rb
38
- - lib/rubyrun/rubyrun_instrumentor__.rb
39
35
  - lib/rubyrun/rubyrun_monitor__.rb
40
- - lib/rubyrun/rubyrun_report__.rb
41
- - lib/rubyrun/rubyrun_rss__.rb
42
- - lib/rubyrun/rubyrun_tracer__.rb
43
36
  - lib/rubyrun/rubyrun_utils__.rb
37
+ - lib/rubyrun/rubyrun_globals.rb
38
+ - lib/rubyrun/rubyrun.rb
39
+ - lib/rubyrun/rubyrun_dad__.rb
40
+ - lib/rubyrun/rubyrun_boot__.rb
41
+ - lib/rubyrun/rubyrun_buffer_mgr__.rb
42
+ - lib/rubyrun/rubyrun_report__.rb
43
+ - bin/rubyrun_native_test__.rb
44
44
  - bin/Rakefile
45
+ - ext/rubyrunnative__x86-mswin32.so
45
46
  - ext/extconf.rb
46
- - ext/rubyrunnative__.c
47
- - ext/rubyrunnative__.def
48
- - ext/rubyrunnative__.h
49
47
  - ext/rubyrunnative__ppc-darwin.bundle
48
+ - ext/rubyrunnative__.def
50
49
  - ext/rubyrunnative__x86-darwin.bundle
51
50
  - ext/rubyrunnative__x86-linux.so
52
- - ext/rubyrunnative__x86-mswin32.so
53
- - docs/rubyrun-0.9.6.htm
54
- - docs/rubyrun-0.9.6.pdf
55
- - docs/rubyrun-0.9.6_files
56
- - docs/rubyrun-0.9.6_files/colorschememapping.xml
57
- - docs/rubyrun-0.9.6_files/filelist.xml
58
- - docs/rubyrun-0.9.6_files/header.htm
59
- - docs/rubyrun-0.9.6_files/image001.jpg
60
- - docs/rubyrun-0.9.6_files/image002.jpg
61
- - docs/rubyrun-0.9.6_files/image003.jpg
62
- - docs/rubyrun-0.9.6_files/image004.jpg
63
- - docs/rubyrun-0.9.6_files/image005.jpg
64
- - docs/rubyrun-0.9.6_files/image006.jpg
65
- - docs/rubyrun-0.9.6_files/image007.jpg
66
- - docs/rubyrun-0.9.6_files/image008.jpg
67
- - docs/rubyrun-0.9.6_files/image009.jpg
68
- - docs/rubyrun-0.9.6_files/image010.jpg
69
- - docs/rubyrun-0.9.6_files/image011.jpg
70
- - docs/rubyrun-0.9.6_files/image012.jpg
71
- - docs/rubyrun-0.9.6_files/image013.jpg
72
- - docs/rubyrun-0.9.6_files/image014.jpg
73
- - docs/rubyrun-0.9.6_files/image015.jpg
74
- - docs/rubyrun-0.9.6_files/image016.jpg
75
- - docs/rubyrun-0.9.6_files/image017.png
76
- - docs/rubyrun-0.9.6_files/image018.jpg
77
- - docs/rubyrun-0.9.6_files/image019.jpg
78
- - docs/rubyrun-0.9.6_files/image020.jpg
79
- - docs/rubyrun-0.9.6_files/image021.jpg
80
- - docs/rubyrun-0.9.6_files/image022.png
81
- - docs/rubyrun-0.9.6_files/themedata.thmx
51
+ - ext/rubyrunnative__.c
52
+ - ext/rubyrunnative__.h
53
+ - doc/rubyrun-0.9.7.htm
54
+ - doc/rubyrun-0.9.7.pdf
55
+ - doc/rubyrun-0.9.7_files
56
+ - doc/rubyrun-0.9.7_files/image014.jpg
57
+ - doc/rubyrun-0.9.7_files/themedata.thmx
58
+ - doc/rubyrun-0.9.7_files/image016.jpg
59
+ - doc/rubyrun-0.9.7_files/image008.jpg
60
+ - doc/rubyrun-0.9.7_files/image001.jpg
61
+ - doc/rubyrun-0.9.7_files/image019.jpg
62
+ - doc/rubyrun-0.9.7_files/header.htm
63
+ - doc/rubyrun-0.9.7_files/image020.jpg
64
+ - doc/rubyrun-0.9.7_files/image021.jpg
65
+ - doc/rubyrun-0.9.7_files/image010.jpg
66
+ - doc/rubyrun-0.9.7_files/image012.jpg
67
+ - doc/rubyrun-0.9.7_files/image007.jpg
68
+ - doc/rubyrun-0.9.7_files/image009.jpg
69
+ - doc/rubyrun-0.9.7_files/image005.jpg
70
+ - doc/rubyrun-0.9.7_files/colorschememapping.xml
71
+ - doc/rubyrun-0.9.7_files/image006.jpg
72
+ - doc/rubyrun-0.9.7_files/image013.jpg
73
+ - doc/rubyrun-0.9.7_files/image003.jpg
74
+ - doc/rubyrun-0.9.7_files/image022.png
75
+ - doc/rubyrun-0.9.7_files/image018.jpg
76
+ - doc/rubyrun-0.9.7_files/image004.jpg
77
+ - doc/rubyrun-0.9.7_files/image011.jpg
78
+ - doc/rubyrun-0.9.7_files/image017.png
79
+ - doc/rubyrun-0.9.7_files/image002.jpg
80
+ - doc/rubyrun-0.9.7_files/filelist.xml
81
+ - doc/rubyrun-0.9.7_files/image015.jpg
82
82
  - etc/rubyrun_opts.yml
83
83
  has_rdoc: true
84
84
  homepage: http://www.rubysophic.com
@@ -88,6 +88,8 @@ rdoc_options:
88
88
  - RubyRun Community Edition
89
89
  - --line-numbers
90
90
  - --inline-source
91
+ - --main
92
+ - doc/README
91
93
  require_paths:
92
94
  - .
93
95
  - lib
@@ -107,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
109
  requirements: []
108
110
 
109
111
  rubyforge_project: rubyrunce
110
- rubygems_version: 1.1.1
112
+ rubygems_version: 1.2.0
111
113
  signing_key:
112
114
  specification_version: 2
113
115
  summary: RubyRun Community Edition is an application performance diagnostic solution for Ruby developers