<commit_before>class PassengerMemoryStatsParser

  attr_accessor :output_to_parse

  def passenger_memory_total(command_output = output_to_parse)
    match = command_output.match(/RSS:\s*([\d\.]+)\s*MB\Z/m)

    return match[1] if match

    total_mem_for_v4_0_33 = passenger_memory_per_app.values.inject(:+)
    return total_mem_for_v4_0_33 if total_mem_for_v4_0_33

    return 0
  end

  def passenger_memory_per_app(command_output = output_to_parse)
    passenger_processes = Hash.new(0)
    passenger_section_found = false
    command_output.lines.each do |line|

      passenger_section_start = /.*----- Passenger processes ------.*/
      passenger_section_found = true if line.match(passenger_section_start)
      next unless passenger_section_found

      #PID    VMSize    Private   Name
      #--------------------------------
      #7402   418.2 MB  53.9 MB   Rack: /var/www/app/current
      passenger_process_line = /^(\d+)\s*([\d\.]+)\s*MB\s*([\d\.]+)\s*MB\s*(.*)$/
      match = line.match(passenger_process_line)
<commit_msg>passenger_memory_total is expected to return string representation<commit_after>class PassengerMemoryStatsParser

  attr_accessor :output_to_parse

  def passenger_memory_total(command_output = output_to_parse)
    match = command_output.match(/RSS:\s*([\d\.]+)\s*MB\Z/m)

    return match[1] if match

    total_mem_for_v4_0_33 = passenger_memory_per_app.values.inject(:+)
    return total_mem_for_v4_0_33.to_s if total_mem_for_v4_0_33

    return 0.to_s
  end

  def passenger_memory_per_app(command_output = output_to_parse)
    passenger_processes = Hash.new(0)
    passenger_section_found = false
    command_output.lines.each do |line|

      passenger_section_start = /.*----- Passenger processes ------.*/
      passenger_section_found = true if line.match(passenger_section_start)
      next unless passenger_section_found

      #PID    VMSize    Private   Name
      #--------------------------------
      #7402   418.2 MB  53.9 MB   Rack: /var/www/app/current
      passenger_process_line = /^(\d+)\s*([\d\.]+)\s*MB\s*([\d\.]+)\s*MB\s*(.*)$/
      match = line.match(passenger_process_line)

{'fraction_non_alphanumeric': 0.14545454545454545, 'fraction_numerical': 0.024242424242424242, 'mean_word_length': 3.011214953271028, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4874946', 'n_tokens_mistral': 766, 'n_tokens_neox': 731, 'n_words': 120}