jemal 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jemal.rb +5 -1
- data/lib/jemal/interface.rb +11 -0
- data/lib/jemal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8763d95283d7068ebddb436e87e8a7fbd0ee6cc0
|
4
|
+
data.tar.gz: d5b9c2fa8bfacb26f60099c3538245c956425407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de843bfd2ece8662a1a6c97565d4261335a5ce1ff7aef2e665a3875658f4b8ae7c3e336b7f1e630dbd27530b831d4c52c3fa31b4e6112ad01ecd1abace403ea0
|
7
|
+
data.tar.gz: 1589fbd6532e3cbfdbca688a140a4a0f798fb090f64630ec1bff794f718597e50267d38658243699606acf16fa5c853d9602b4e08dc77b54fe203b129a47467f
|
data/lib/jemal.rb
CHANGED
@@ -153,7 +153,11 @@ module Jemal
|
|
153
153
|
# Public: Get current statistics.
|
154
154
|
#
|
155
155
|
# Returns stats as one big Hash.
|
156
|
-
def self.stats
|
156
|
+
def self.stats(refresh: true)
|
157
|
+
if refresh
|
158
|
+
write_uint64("epoch", 1)
|
159
|
+
end
|
160
|
+
|
157
161
|
res = {}
|
158
162
|
|
159
163
|
GLOBAL_STATS.each { |s| res[s] = get_size_t("stats.#{s}") }
|
data/lib/jemal/interface.rb
CHANGED
@@ -62,6 +62,17 @@ module Jemal
|
|
62
62
|
ptr.read_uint64
|
63
63
|
end
|
64
64
|
|
65
|
+
# Private: Use mallctl to write unsigned 64-bit value.
|
66
|
+
#
|
67
|
+
# name - the String with parameter name.
|
68
|
+
#
|
69
|
+
# Returns nothing.
|
70
|
+
def write_uint64(name, value)
|
71
|
+
ptr = FFI::MemoryPointer.new :uint64
|
72
|
+
ptr.write_uint64 value
|
73
|
+
mallctl name, nil, nil, ptr, ptr.size
|
74
|
+
end
|
75
|
+
|
65
76
|
# Private: Use mallctl to read size_t value.
|
66
77
|
#
|
67
78
|
# name - the String with parameter name.
|
data/lib/jemal/version.rb
CHANGED