Implemented Admin#profiling_info.
This commit is contained in:
parent
17bbc83f5d
commit
60ab3d99dc
@ -66,6 +66,7 @@ module XGen
|
||||
# Return an array contining current profiling information from the
|
||||
# database.
|
||||
def profiling_info
|
||||
@db.query(DB::SYSTEM_PROFILE_COLLECTION, Query.new({})).to_a
|
||||
end
|
||||
|
||||
# Validate a named collection.
|
||||
|
@ -32,6 +32,7 @@ module XGen
|
||||
|
||||
SYSTEM_NAMESPACE_COLLECTION = "system.namespaces"
|
||||
SYSTEM_INDEX_COLLECTION = "system.indexes"
|
||||
SYSTEM_PROFILE_COLLECTION = "system.profile"
|
||||
SYSTEM_COMMAND_COLLECTION = "$cmd"
|
||||
|
||||
# Strict mode enforces collection existence checks. When +true+,
|
||||
|
@ -37,4 +37,20 @@ class AdminTest < Test::Unit::TestCase
|
||||
assert_equal :off, @admin.profiling_level
|
||||
end
|
||||
|
||||
def test_profiling_info
|
||||
# Perform at least one query while profiling so we have something to see.
|
||||
@admin.profiling_level = :all
|
||||
@coll.find()
|
||||
|
||||
info = @admin.profiling_info
|
||||
assert_kind_of Array, info
|
||||
assert info.length >= 1
|
||||
first = info.first
|
||||
assert_kind_of String, first['info']
|
||||
assert_kind_of Time, first['ts']
|
||||
assert_kind_of Numeric, first['millis']
|
||||
|
||||
@admin.profiling_level = :off
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user