Class: Glimpse::Views::Mongo

Inherits:
View
  • Object
show all
Defined in:
lib/glimpse/views/mongo.rb

Instance Method Summary collapse

Instance Method Details

#callsObject



66
67
68
# File 'lib/glimpse/views/mongo.rb', line 66

def calls
  ::Mongo::Connection.command_count.value
end

#durationObject



53
54
55
# File 'lib/glimpse/views/mongo.rb', line 53

def duration
  ::Mongo::Connection.command_time.value
end

#formatted_durationObject



57
58
59
60
61
62
63
64
# File 'lib/glimpse/views/mongo.rb', line 57

def formatted_duration
  ms = duration * 1000
  if ms >= 1000
    "%.2fms" % ms
  else
    "%.0fms" % ms
  end
end

#resultsObject



70
71
72
# File 'lib/glimpse/views/mongo.rb', line 70

def results
  { :duration => formatted_duration, :calls => calls }
end