Revision 4bf81014 src/oca/ruby/opennebula/pool_element.rb

View differences:

src/oca/ruby/opennebula/pool_element.rb
266 266

  
267 267
        return hash
268 268
    end
269

  
270

  
271
    # Alternative method with better performance for huge number of timestamps.
272
    # For reasonable amounts of data, the current method is quicker
273
=begin
274
    def self.process_monitoring(xmldoc, root_elem, timestamp_elem, oid, xpath_expressions)
275
        hash = {}
276

  
277
        xpath_expressions.each { |xpath|
278
            hash[xpath] = []
279
        }
280

  
281
        xmldoc.each("#{root_elem}[ID=#{oid}]") do |elem|
282
            timestamp = elem[timestamp_elem]
283

  
284
            xpath_expressions.each { |xpath|
285
                xpath_value = elem[xpath]
286

  
287
                hash[xpath] << [timestamp, xpath_value] if !xpath_value.nil?
288
            }
289
        end
290

  
291
        return hash
292
    end
293
=end
269 294
end

Also available in: Unified diff